Skip to content

Instantly share code, notes, and snippets.

@karthikselva
karthikselva / run_ruby
Created March 14, 2013 11:34
Whenever I need to run ruby from VIM I used to exit and run the script and load back VIM. ( Bad ) Then learned to use **:!ruby** which would execute the supplied command in shell and return back. ( Better ) But the below gist would help you run with press of F6 key.
" Save the current file and run current ruby script
function! RunRuby()
:w
let name = input('Enter Argument (if any): ')
execute ':!ruby % '.name
endfunc
" Use F6 to trigger a run
@karthikselva
karthikselva / vim_wrap_long_lines
Last active August 11, 2016 23:31
In normal editors we would have used **word wrap** option which displays the long misbehaving lines in next line.Usually clean developers adhere to 80 characters per line rule.But sometimes I end up seeing code with > 80 characters. I use this gist in VIM to break those lines.
" Wrap or Nowrap words if it exceeds 80 characters
function! WrapWords()
if(&wrap == 1)
set nowrap
else
set wrap
set linebreak
set nolist " list disables linebreak
endif