Skip to content

Commit 8c58212

Browse files
committed
fix: replace netrw with lf, improve nonest_nvim
1 parent ed6bb1a commit 8c58212

File tree

3 files changed

+35
-19
lines changed

3 files changed

+35
-19
lines changed

home/.config/nvim/init.vim

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -127,20 +127,22 @@ syntax enable
127127
highlight! 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 ##################################
146148
function! ResizeMode()
@@ -237,8 +239,26 @@ endfunction
237239

238240
function! 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 ""
243263
endfunction
244264

home/.config/zsh/nonest_nvim/main.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,14 @@ func main() {
4040
fmt.Println(err)
4141
os.Exit(1)
4242
}
43-
4443
defer v.Close()
4544

4645
b := v.NewBatch()
47-
b.Command(":file temp_terminal")
48-
4946
for _, filePath := range filePaths {
5047
b.Command(":e " + filePath)
5148
}
52-
53-
b.Command(":b temp_terminal")
54-
b.Command(":bd!")
49+
b.Command(":b term://")
50+
b.Command(":bw!")
5551

5652
// fix airline statusbar
5753
b.Command(":if exists(':AirlineRefresh') == 2 | AirlineRefresh | endif")
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)