On Wed, Oct 19, 2011 at 7:00 AM, sinbad wrote:
> i want to be able to mark locations in files with some text (marking-
> text) of my choice.
You can use a temporary file to store your marks and the quickfix
window to navigate through them. For example source the script listed
below and mark a location with:
:Mark some text
Display the quickfix window with:
:Getmarks
--
Xavier
Les Chemins de Lokoti: http://lokoti.alwaysdata.net
===========================================================
let s:tmpfile = tempname()
" mark a location in a file with some text
function! s:mark(text)
try
let l:lines = readfile(s:tmpfile)
catch /.*/
let l:lines = []
endtry
let l:lines += [bufname("%") . ":" . line(".") . ":" . a:text]
call writefile(l:lines, s:tmpfile)
endfunction
" open the quickfix window
function! s:cwindow()
let l:gp=&gp
let l:gfm=&gfm
let l:gp = "set gp=cat\\ " . s:tmpfile
exe l:gp
set gfm=%f:%l:%m
grep
let &gp=l:gp
let &gfm=l:gfm
cwindow
endfunction
command! -bar -nargs=1 Mark call s:mark(<f-args>)
command! -bar Getmarks call s:cwindow()
===========================================================
--
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