Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last cdargs directory #1

Merged
merged 1 commit into from Aug 31, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions cdargs.vim
Expand Up @@ -35,6 +35,7 @@ let g:loaded_cdargs = 1

" What file to read
let s:cdargs_file = $HOME . '/.cdargs'
let g:cdargs_current_directory = ''

" Bookmark caching
let s:cached_bookmarks = {}
Expand Down Expand Up @@ -235,6 +236,10 @@ function! s:execute(command, raw)
" Escape spaces in the path
let l:path = substitute(s:path_for(a:raw), " ", '\\ ', "g")

if a:command == 'cd'
let g:cdargs_current_directory = split(a:raw, '/')[0]
endif

if strlen(l:path)
try
execute a:command . ' ' . l:path
Expand All @@ -244,6 +249,10 @@ function! s:execute(command, raw)
end
endfunction

function! CdargsCurrentDirectory()
return g:cdargs_current_directory
endfunction

" Change working directory to bookmark or it's subpath
command! -nargs=1 -complete=customlist,s:directory_completion Cdb call s:execute('cd', <f-args>)

Expand Down