Nithin Bekal

Posts About Notes Slides

Vim

Troubleshooting

Vim has a problem with getting the correct path in OSX. This leads to it using system Ruby if you run :!rake test. To fix, run the command:

sudo chmod ugo-x /usr/libexec/path_helper

Blog posts, links, etc.

Screencasts

Other vim implementations

Books

Videos:

Vimscript

function HelloWorld()
  echo "Hello, world!"
endfunction

call HelloWorld()


function ReturnSomethign()
  return "Something"
endfunction

echo ReturnSomethign()

function Foo()
endfunction
" Returns 0 by default

function TooBigEh(foo)
  if a:foo > 10
    return 1
  end
endfunction
" Returns 1 if cond matches, falls back to 0 otherwise
" a:foo is for variable scoping - tells vimscript that it's the argument foo


" Truthiness
"  'hey' is coerced in to 0, so falsey
"  '8 hello' is coerced to 8 because it starts with a number, so truthy


" Local vars
function Foo()
  let bar = 'baz'
  return bar
endfunction


" Match url in the following line:
" foo bar http://hello.baz hai
" Matches string starting with http, until it runs into spaces
matchstr(getline('.', "http[^ ]*"))