Skip to content

Commit c10e744

Browse files
committed
no defx icon for large file slow
1 parent 5deee6a commit c10e744

File tree

3 files changed

+44
-26
lines changed

3 files changed

+44
-26
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#### ubuntu
1515
```bash
1616
./init.sh --with_php --with_cpp --with_go --with_python --with_java \
17-
--with_lua --with_leetcode --with_man --with_dict --with_bash
17+
--with_lua --with_leetcode --with_man --with_dict --with_bash --without_defx_icon
1818
```
1919
#### mac and centos
2020
./init.sh

helper/option.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ OPT_MAN=
99
OPT_DICT=
1010
OPT_BASH=
1111
OPT_FE=
12+
OPT_NO_DEFX_ICON=
1213

1314
for option
1415
do
@@ -24,5 +25,6 @@ do
2425
--with_dict) OPT_DICT=yes ;;
2526
--with_bash) OPT_BASH=yes ;;
2627
--with_fe) OPT_FE=yes ;;
28+
--without_defx_icon) OPT_NO_DEFX_ICON=yes ;;
2729
esac
2830
done

tools/neovim/ubuntu_init.sh

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -219,30 +219,8 @@ cat >> ~/.config/nvim/init.vim <<END
219219
"defx
220220
augroup vimrc_defx
221221
autocmd!
222-
autocmd FileType defx call s:defx_my_settings() "Defx mappings
223-
autocmd VimEnter * call s:setup_defx()
224-
augroup END
225-
let s:default_columns = 'indent:git:icons:filename'
226-
function! s:setup_defx() abort
227-
call defx#custom#option('_', {
228-
\ 'columns': s:default_columns,
229-
\ 'show_ignored_files': 0,
230-
\ 'buffer_name': '',
231-
\ 'toggle': 1,
232-
\ 'resume': 1,
233-
\ })
234-
235-
call defx#custom#column('filename', {
236-
\ 'min_width': 80,
237-
\ 'max_width': 80,
238-
\ })
239-
call s:defx_open()
240-
endfunction
241-
242-
function! s:defx_open(...) abort
243-
sil! au! FileExplorer *
244-
if s:isdir(expand('%')) | bd | exe 'Defx' | endif
245-
endfunction
222+
autocmd FileType defx call s:defx_my_settings() "Defx_mappings
223+
augroup
246224
247225
function! s:defx_my_settings() abort
248226
" Define mappings
@@ -308,8 +286,8 @@ function! s:defx_my_settings() abort
308286
nnoremap <silent><buffer><expr> cd
309287
\ defx#do_action('change_vim_cwd')
310288
endfunction
311-
312289
END
290+
313291
if [ "Y$OPT_DICT" == "Yyes" ];then
314292
! ( grep -F "QuerySel" ~/.config/nvim/init.vim ) && \
315293
cat >> ~/.config/nvim/init.vim <<END
@@ -359,3 +337,41 @@ function! s:show_documentation()
359337
endfunction
360338
nmap <leader>rn <Plug>(coc-rename)
361339
END
340+
341+
if [ "Y$OPT_NO_DEFX_ICON" == "Yyes" ];then
342+
! (grep -F 'kristijanhusak/defx-icons' ~/.config/nvim/init.vim &>/dev/null ) && \
343+
sed -i "/plug#begin/aPlug 'kristijanhusak/defx-icons'" ~/.config/nvim/init.vim && \
344+
sed -i "/plug#begin/aPlug 'kristijanhusak/defx-git'" ~/.config/nvim/init.vim
345+
346+
! (grep -F 'Defx_mappings' ~/.config/nvim/init.vim &>/dev/null ) && \
347+
sed -i "/Defx_mappings/a autocmd VimEnter * call s:setup_defx()" ~/.config/nvim/init.vim
348+
349+
350+
351+
! ( grep -F "indent:git:icons:filename" ~/.config/nvim/init.vim ) && \
352+
cat >> ~/.config/nvim/init.vim <<END
353+
function! s:setup_defx() abort
354+
call defx#custom#option('_', {
355+
\ 'columns': s:default_columns,
356+
\ 'show_ignored_files': 0,
357+
\ 'buffer_name': '',
358+
\ 'toggle': 1,
359+
\ 'resume': 1,
360+
\ })
361+
362+
call defx#custom#column('filename', {
363+
\ 'min_width': 80,
364+
\ 'max_width': 80,
365+
\ })
366+
call s:defx_open()
367+
endfunction
368+
369+
function! s:defx_open(...) abort
370+
sil! au! FileExplorer *
371+
if s:isdir(expand('%')) | bd | exe 'Defx' | endif
372+
endfunction
373+
374+
let s:default_columns = 'indent:git:icons:filename'
375+
END
376+
fi
377+

0 commit comments

Comments
 (0)