@@ -127,20 +127,22 @@ syntax enable
127127highlight ! link MatchParen SpellBad
128128
129129" ### Autocmds ####################################
130- autocmd TermOpen * setlocal nonu nornu
131- autocmd TermOpen * IndentLinesDisable
132- autocmd TermOpen * startinsert
133- autocmd BufWritePre * % s: \s\+ $ ::e
134- autocmd BufNewFile ,BufRead * set formatoptions -= o conceallevel= 0
130+ autocmd BufWritePre * % s: \s\+ $ ::e
131+ autocmd TermOpen * setlocal nonu nornu | IndentLinesDisable | startinsert
135132
136- autocmd BufNewFile ,BufRead Jenkinsfile setlocal filetype = groovy
137- autocmd BufNewFile ,BufRead *.mom setlocal filetype = groff
138- autocmd BufNewFile ,BufRead *.avsc setlocal filetype = json
139- autocmd BufNewFile ,BufRead calcurse-note* setlocal filetype = markdown
133+ autocmd BufNewFile ,BufRead * set formatoptions -= o conceallevel= 0
134+ autocmd BufNewFile ,BufRead Jenkinsfile setlocal filetype = groovy
135+ autocmd BufNewFile ,BufRead *.mom setlocal filetype = groff
136+ autocmd BufNewFile ,BufRead *.avsc setlocal filetype = json
137+ autocmd BufNewFile ,BufRead calcurse-note* setlocal filetype = markdown
140138
141- autocmd FileType yaml,json set ts = 2 sw = 2
142- autocmd FileType json,markdown,text,help IndentLinesDisable
143- autocmd FileType markdown,text setlocal spell lbr
139+ autocmd FileType yaml,json set ts = 2 sw = 2
140+ autocmd FileType json,markdown,text,help IndentLinesDisable
141+ autocmd FileType markdown,text setlocal spell lbr
142+
143+ let g: loaded_netrw = 1
144+ " autocmd VimEnter * silent! autocmd! FileExplorer *
145+ autocmd BufEnter * if isdirectory (expand (' %' )) | call NetrwReplacement (" lf" )
144146
145147" ### Functions ##################################
146148function ! ResizeMode ()
@@ -237,8 +239,26 @@ endfunction
237239
238240function ! TempTerm (... )
239241 let command = get (a: , 1 )
240- exe " au TermClose * ++once :b#|bd!#"
242+ exe " autocmd TermClose * ++once b#|bd!#"
243+ exe " terminal " .command
244+ return " "
245+ endfunction
246+
247+ function ! DelBufferOrQuit ()
248+ if len (getbufinfo ({" buflisted" :1 })) == 1
249+ exe " q"
250+ else
251+ exe " b#|bw!#"
252+ endif
253+ return " "
254+ endfunction
255+
256+ function ! NetrwReplacement (... )
257+ let command = get (a: , 1 )
241258 exe " terminal " .command
259+ exe " bw #"
260+ exe " autocmd TermClose * ++once call DelBufferOrQuit()"
261+ exe " setlocal nonu nornu | IndentLinesDisable | startinsert"
242262 return " "
243263endfunction
244264
0 commit comments