improve ltag

Wed, 31 May 2017 11:57:26 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Wed, 31 May 2017 11:57:26 -0400
changeset 586
ab5763bb6ca7
parent 585
6136cb64836c
child 587
32068b7aaac6

improve ltag

.vim/autoload/vimrc.vim file | annotate | diff | comparison | revisions
.vimrc file | annotate | diff | comparison | revisions
--- a/.vim/autoload/vimrc.vim
+++ b/.vim/autoload/vimrc.vim
@@ -7,6 +7,11 @@ func! vimrc#AutoFmtToggle() abort
   endif
 endfunc
 
+func! vimrc#Ltag(term) abort
+  exe "ltag " . a:term
+  lopen
+endfunc
+
 " Make paths when writing, as necessary
 func! vimrc#MkNonExDir(file, buf) abort
   if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/'
--- a/.vimrc
+++ b/.vimrc
@@ -98,7 +98,7 @@ nmap gB :ls<CR>:b<Space>
 map gV `[v`]
 
 " Use ltag over tselect
-nmap g<C-]> :ltag <C-r><C-w><CR>
+nmap g<C-]> :call vimrc#Ltag(expand('<cword>'))<CR>
 
 " clear all interestingwords with \\k since \K is ri.vim
 nmap <silent> <leader><leader>k :call UncolorAllWords()<CR>
@@ -277,6 +277,16 @@ augroup vimrc
   " double-click to edit in vimfiler
   autocmd FileType vimfiler nmap <buffer> <2-LeftMouse> <Plug>(vimfiler_edit_file)
 
+  " Simplify noisy ltag output
+  autocmd BufReadPost quickfix
+    \ if w:quickfix_title =~ '^:ltag' |
+      \ setl modifiable |
+      \ silent exe ':%s/\^\\V\s*\|\\\$|.*//g' |
+      \ setl nomodifiable |
+    \ endif
+
+  autocmd BufReadPost quickfix nmap <buffer> q <C-w>c
+
 augroup END
 
 " Make paths when writing, as necessary

mercurial