Skip to content

Commit

Permalink
Fixes errors when opening vim without a file arg
Browse files Browse the repository at this point in the history
I threw in a try-catch statement, it was a list index
error that goes off when there's a no-name buffer.

Also cleans up the Darwin detection now that I've
discovered =~
  • Loading branch information
ndreynolds committed Jul 14, 2011
1 parent d2d2ee0 commit 3c97c37
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions plugin/cakephp.vim
Expand Up @@ -16,7 +16,7 @@ set cpo&vim
let s:statusline_modified = 0

let s:DS = '/'
if has('unix') && strpart(system('uname'),0,6) == 'Darwin'
if has('unix') && system('uname') =~ 'Darwin'
let s:OS = 'mac'
elseif has('unix')
let s:OS = 'unix'
Expand Down Expand Up @@ -155,7 +155,11 @@ endfunction

function! s:build_associations(...)
let path = expand('%:p')
let name = remove(split(expand('%:r'),s:DS),-1) " Get filename from rel or abs path
try
let name = split(expand('%:r'), s:DS)[-1] " Get filename from rel or abs path
catch
return {}
endtry
let ext = expand('%:e')
let parent = expand('%:p:h:t')
let parent_path = expand('%:p:h')
Expand Down

0 comments on commit 3c97c37

Please sign in to comment.