diff options
Diffstat (limited to '.vimrc')
-rw-r--r-- | .vimrc | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -59,6 +59,7 @@ autocmd BufLeave,FocusLost * silent! wall let g:auto_save = 1 let g:auto_save_in_insert_mode = 0 "}}} + " Abbreviations {{{ " easier markdown links: @@ -113,6 +114,20 @@ noremap <C-l> <C-w>l inoremap <F5> <C-R>=strftime("%Y-%m-%d")<CR> +nmap ,t yiw:call AddTag('<C-R>"')<CR> +vmap ,t y:call AddTag('<C-R>"')<CR> + +function! AddTag(tagname) + let tagname = input('Tag name: ', a:tagname, 'tag') + let tagfile = expand('%:p') + let tagaddress = input('Address: ', '/\<' . a:tagname . '\>/') + if (tagname == '' || tagaddress == '') + return + endif + let cmd = '!echo -e "' . tagname . '\t' . tagfile . '\t' . tagaddress . '" >> ' . $HOME . '/.tags.global' + execute cmd +endfunction + " Convert curly quotes to straight. {{{ " Any argument causes substitute to confirm changes. function! ToStraight(line1, line2, args) |