Monday, September 30, 2013

Each buffer in own tab/function lookup seem to clash

Greets,

I've tried this on vim 7.3 and 7.4.

The problem:  if I enable "au BufAdd,BufNewFile...", then C-] often jumps to the incorrect position in the file containing a function/subroutine declaration.  This happens whether I use the call to MatchCaseTag() or not.

If I disable "au BufAdd,BufNewFile...", then it always jumps to the correct position - without fail.  But having vim remember my cursor position per file is indispensable.

My .vimrc contains:

set ai
set tabstop=4
set shiftwidth=4
syntax on
set expandtab
set smarttab
set smartindent
set backspace=indent,eol,start
set tags+=tags;~

" don't format/autoindent pasted text
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
set showmode

" remember last cursor position
if has("autocmd")
  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif

" toggle last search term highlighting
"map  <F12> :set hls!<CR>
"imap <F12> <ESC>:set hls!<CR>a
"vmap <F12> <ESC>:set hls!<CR>gv
map  <C-h> :set hls!<CR>
imap <C-h> <ESC>:set hls!<CR>a
vmap <C-h> <ESC>:set hls!<CR>gv

" uppercase current word
map <C-u> gUiw
" lowercase current word
map <C-l> guiw

" switch off last found highlight
map ; /adfadf<CR><C-g>

map <C-]> :call MatchCaseTag()<CR>
" following is so g] works on class::method
set iskeyword+=:
nmap <C-Enter> <C-w><C-]><C-w>T


set hlsearch
highlight MatchParen ctermbg=yellow guibg=yellow

set showtabline=2               " File tabs allways visible
" c-pageup/down switches tabs
" :tabnew etc

" each buffer in it's own tab.
au BufAdd,BufNewFile * nested tab sball

"set nocompatible
map OA k
map <Down> j
map <Left> h
map <Right> l

fun! MatchCaseTag()
    let ic = &ic
    set noic
    try
        exe 'tjump ' . expand('<cword>')
    finally
       let &ic = ic
    endtry
endfun

" auto-add comments
set formatoptions+=r

" check with :make
autocmd FileType perl set makeprg=perl\ -c\ %\ $*
autocmd FileType perl set errorformat=%f:%l:%m
autocmd FileType perl set autowrite

" Tidy selected lines (or entire file) with _t:
" (perltidy does not exist on eros)
nnoremap <silent> _t :%!perltidy -q<Enter>
vnoremap <silent> _t :!perltidy -q<Enter>

" my perl includes pod
let perl_include_pod = 1
" syntax color complex things like @{${"foo"}}
let perl_extended_vars = 1

---

I'd appreciate any pointers on what I'm doing incorrectly.

Thanks
Henry

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
 
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment