Hi Victor, (and vim list cc'd)
I posted a script similar to your file:line script to [email protected]
and Christian Brabandt was good enough to point me at your file:line plugin
here:
http://www.vim.org/scripts/script.php?script_id=2184
My script also deals with file:line: and file:line:column and file:line:column:
but the original version wasn't as tidy as yours and hadn't taken into account
things like folding and deleting the original buffer like yours had.
So please find below a modified version of your script that adds the
file:line:column
varient and allows a : at the end.
------------------------------------------------------------------------------
function! s:gotoline()
let file = bufname("%")
if file =~ ':$'
let file = substitute(file, ':$', "", "")
endif
" Lets try with name:line:column
let names = matchlist( file, '\(.*\):\(\d\+\):\(\d\+\)')
if len(names) == 0
" OK, lets try just name:line
let names = matchlist( file, '\(.*\):\(\d\+\)')
endif
if len(names) != 0 && filereadable(names[1])
let l:bufn = bufnr("%")
exec ":e " . names[1]
exec ":" . names[2]
exec ":bdelete " . l:bufn
if foldlevel(names[2]) > 0
exec ":foldopen!"
endif
if (names[3])
exe "normal " . names[3] . "|"
endif
endif
endfunction
autocmd! BufNewFile *:* nested call s:gotoline()
------------------------------------------------------------------------------
--
-----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert | Running GNU/Linux | Happy \
\ gro.gilbert @ treblig.org | | In Hex /
\ _________________________|_____ http://www.treblig.org |_______/
--
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