# HG changeset patch # User Meredith Howard # Date 1676826212 21600 # Node ID 9dfc1a5a52dcfac89900f61a201e930f5215f913 # Parent edacbb66fc8f76a00dc592049c474b67ce107fdb Fix up tig for nvim diff --git a/.config/nvim/autoload/tig.vim b/.config/nvim/autoload/tig.vim deleted file mode 100644 --- a/.config/nvim/autoload/tig.vim +++ /dev/null @@ -1,18 +0,0 @@ -" Why this wrapper? vim :term sets $TERM to xterm but supports -256color and -" all the suggestions for fixing that involve changing $TERM for vim itself -" rather than just the subprocess. Also since this runs in place we can -" switch back after. -func! tig#Tig(...) abort - call term_start( - \ ['/usr/bin/env', 'TERM=xterm-256color', 'tig'] + a:000, - \ {'curwin': 1, 'term_name': join(['!tig'] + a:000, ' '), 'exit_cb': 'tig#TigExit'} - \ ) -endfunc - -func! tig#TigBlame() abort - call tig#Tig('blame', '+' . line('.'), '--', expand('%')) -endfunc - -func! tig#TigExit(...) abort - buffer # -endfunc diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -8,7 +8,7 @@ "fidget.nvim": { "branch": "main", "commit": "9dc6d15fdb877b2fb09ea0ba2dfde9beccb5965a" }, "indent-blankline.nvim": { "branch": "master", "commit": "8299fe7703dfff4b1752aeed271c3b95281a952d" }, "jellybeans.vim": { "branch": "master", "commit": "ef83bf4dc8b3eacffc97bf5c96ab2581b415c9fa" }, - "lazy.nvim": { "branch": "main", "commit": "c778b7aa04c484e1536ba219e71f2fd0f05302aa" }, + "lazy.nvim": { "branch": "main", "commit": "4917222c7e5c924bf7471b72a5e2d3e661530b40" }, "lualine.nvim": { "branch": "master", "commit": "0050b308552e45f7128f399886c86afefc3eb988" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "d2d55255a0295ba0a75ef2dd5535e4c89c46e773" }, "mason.nvim": { "branch": "main", "commit": "47e9f6bc4c5bb3d6453949f07b8280c725ef7490" }, diff --git a/.config/nvim/lua/config/options.lua b/.config/nvim/lua/config/options.lua --- a/.config/nvim/lua/config/options.lua +++ b/.config/nvim/lua/config/options.lua @@ -28,6 +28,7 @@ end o.autowriteall = true o.backup = true o.completeopt:append({"menuone", "noselect"}) +o.hidden = false o.ignorecase = true o.scrolloff = 15 o.sessionoptions = {"buffers", "curdir", "localoptions"} diff --git a/.config/nvim/plugin/tig.vim b/.config/nvim/plugin/tig.vim new file mode 100644 --- /dev/null +++ b/.config/nvim/plugin/tig.vim @@ -0,0 +1,18 @@ +func! tig#Tig(...) abort + enew + setl nonumber + call termopen(["tig"] + a:000, {'on_exit': 'tig#TigExit'}) +endfunc + +func! tig#TigBlame() abort + call tig#Tig('blame', '+' . line('.'), '--', expand('%')) +endfunc + +func! tig#TigExit(...) abort + buffer # +endfunc + +command! -nargs=* -complete=file Tig call tig#Tig() +command! TigBlame call tig#TigBlame() +command! TigLog call tig#Tig('log', '-p', '--', expand('%')) + diff --git a/.config/nvim/plugin/vimrc/autocmds.vim b/.config/nvim/plugin/vimrc/autocmds.vim --- a/.config/nvim/plugin/vimrc/autocmds.vim +++ b/.config/nvim/plugin/vimrc/autocmds.vim @@ -1,6 +1,8 @@ augroup vimrc autocmd! + autocmd TermOpen * startinsert + autocmd WinLeave * if !pumvisible() | stopinsert | endif " complement to autowriteall diff --git a/.config/nvim/plugin/vimrc/commands.vim b/.config/nvim/plugin/vimrc/commands.vim --- a/.config/nvim/plugin/vimrc/commands.vim +++ b/.config/nvim/plugin/vimrc/commands.vim @@ -8,10 +8,6 @@ command! SyntaxCompleteOn setl omnifunc= command! Mksession execute "mksession! " . v:this_session command! PruneSession call vimrc#PruneSession() -command! -nargs=* -complete=file Tig call tig#Tig() -command! TigBlame call tig#TigBlame() -command! TigLog call tig#Tig('log', '-p', '--', expand('%')) - " Preview markdown mail -- I edit with headers so I box them in a code block. command! MailPreview enew | set bt=nofile | 0r # | exe 'norm! 0O```}O```' | silent exe '%!mutt-md2html | mutt-html2txt' | 0 command! MailPreviewHTML enew | set bt=nofile | setf html | 0r # | exe 'norm! 0O```}O```' | silent exe '%!mutt-md2html' | 0