Skip to content

Commit

Permalink
fix: replace netrw with lf, improve nonest_nvim
Browse files Browse the repository at this point in the history
  • Loading branch information
adamtabrams committed Aug 24, 2021
1 parent ed6bb1a commit 8c58212
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 19 deletions.
46 changes: 33 additions & 13 deletions home/.config/nvim/init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,22 @@ syntax enable
highlight! link MatchParen SpellBad

"### Autocmds ####################################
autocmd TermOpen * setlocal nonu nornu
autocmd TermOpen * IndentLinesDisable
autocmd TermOpen * startinsert
autocmd BufWritePre * %s:\s\+$::e
autocmd BufNewFile,BufRead * set formatoptions-=o conceallevel=0
autocmd BufWritePre * %s:\s\+$::e
autocmd TermOpen * setlocal nonu nornu | IndentLinesDisable | startinsert

autocmd BufNewFile,BufRead Jenkinsfile setlocal filetype=groovy
autocmd BufNewFile,BufRead *.mom setlocal filetype=groff
autocmd BufNewFile,BufRead *.avsc setlocal filetype=json
autocmd BufNewFile,BufRead calcurse-note* setlocal filetype=markdown
autocmd BufNewFile,BufRead * set formatoptions-=o conceallevel=0
autocmd BufNewFile,BufRead Jenkinsfile setlocal filetype=groovy
autocmd BufNewFile,BufRead *.mom setlocal filetype=groff
autocmd BufNewFile,BufRead *.avsc setlocal filetype=json
autocmd BufNewFile,BufRead calcurse-note* setlocal filetype=markdown

autocmd FileType yaml,json set ts=2 sw=2
autocmd FileType json,markdown,text,help IndentLinesDisable
autocmd FileType markdown,text setlocal spell lbr
autocmd FileType yaml,json set ts=2 sw=2
autocmd FileType json,markdown,text,help IndentLinesDisable
autocmd FileType markdown,text setlocal spell lbr

let g:loaded_netrw = 1
" autocmd VimEnter * silent! autocmd! FileExplorer *
autocmd BufEnter * if isdirectory(expand('%')) | call NetrwReplacement("lf")

"### Functions ##################################
function! ResizeMode()
Expand Down Expand Up @@ -237,8 +239,26 @@ endfunction

function! TempTerm(...)
let command = get(a:, 1)
exe "au TermClose * ++once :b#|bd!#"
exe "autocmd TermClose * ++once b#|bd!#"
exe "terminal ".command
return ""
endfunction

function! DelBufferOrQuit()
if len(getbufinfo({"buflisted":1})) == 1
exe "q"
else
exe "b#|bw!#"
endif
return ""
endfunction

function! NetrwReplacement(...)
let command = get(a:, 1)
exe "terminal ".command
exe "bw #"
exe "autocmd TermClose * ++once call DelBufferOrQuit()"
exe "setlocal nonu nornu | IndentLinesDisable | startinsert"
return ""
endfunction

Expand Down
8 changes: 2 additions & 6 deletions home/.config/zsh/nonest_nvim/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,14 @@ func main() {
fmt.Println(err)
os.Exit(1)
}

defer v.Close()

b := v.NewBatch()
b.Command(":file temp_terminal")

for _, filePath := range filePaths {
b.Command(":e " + filePath)
}

b.Command(":b temp_terminal")
b.Command(":bd!")
b.Command(":b term://")
b.Command(":bw!")

// fix airline statusbar
b.Command(":if exists(':AirlineRefresh') == 2 | AirlineRefresh | endif")
Expand Down
Binary file modified home/.config/zsh/nonest_nvim/nonest_nvim
Binary file not shown.

0 comments on commit 8c58212

Please sign in to comment.