Saturday, August 18, 2012

VIM: Cdargs

Cdargs is a curses based directory bookmarking tool. See http://www.skamphausen.de/cgi-bin/ska/CDargs/

This works nice on bash but I wanted something like that to work with VIM. Tried NERDTree bookmarking but still wanted something like curses. Press a key a list is displayed where you can move around. Something like screen window list shown on pressing C-A+"

I found it that it was way too easy to integrate cdargs with vim using a vim function. The function is self-explanatory. Read the see links and you will be able to decipher the function.

" See http://vim.wikia.com/wiki/Write_your_own_Vim_function
function! Cd()
    exe "!cdargs"
    let mydir = system("cat /home/jay/.cdargsresult")
    " See http://stackoverflow.com/questions/4596932/vim-cd-to-path-stored-in-variable
    cd `=mydir`
endfunction
" Alias to my function so you do not need to type call everytime.
command Cd call Cd()


There is also  VIM plugin which uses cdargs but it does not show the curses window. See: https://github.com/vim-scripts/cdargs

No comments:

Post a Comment