You are not logged in.
Pages: 1
.vimrc is as follows:
"set working directory DIR
let DIR = expand("$HOME/Projects/tinyos")
"set the shortcut gr to search the current word under cursor in directory DIR
nnoremap gr :call Look_For_String()<CR><C-L>
function! Look_For_String()
exe "grep -R " . expand("<cword> ") . DIR
endfunction
A very simple code, but failed. Vim told me that DIR not defined. why?
Offline
IIRC, global variables need to be defined g:name - eg. g:DIR
The other alternative would be to pass it in as an argument - see a:name
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
Pages: 1