Skip to content

Instantly share code, notes, and snippets.

require 'set'
class SnippetGenerator
def initialize
@done = Set.new
end
def snippet_from_trigger_and_expansion(trigger, expansion, options = {})
return nil if @done.include?(trigger)
let s:plugin_setting_dirname = expand('~/.vim/plugin_settings')
function! s:edit_plugin_setting(plugin_name)
if !isdirectory(s:plugin_setting_dirname)
call mkdir(s:plugin_setting_dirname)
endif
execute 'edit' s:plugin_setting_dirname . '/' . a:plugin_name . '.vim'
endfunction
command! -nargs=1
augroup LightLine
autocmd!
autocmd WinEnter,BufWinEnter,FileType,ColorScheme * call s:filtered_lightline_call('update')
autocmd ColorScheme,SessionLoadPost * call s:filtered_lightline_call('highlight')
autocmd CursorMoved,BufUnload * call s:filtered_lightline_call('update_once')
augroup END
function! s:filtered_lightline_call(funcname)
if bufname('%') == '__CS__'
return
endif
execute 'call lightline#' . a:funcname . '()'
endfunction
augroup LightLine
autocmd!
autocmd WinEnter,BufWinEnter,FileType,ColorScheme * call lightline#update()
autocmd ColorScheme,SessionLoadPost * call lightline#highlight()
autocmd CursorMoved,BufUnload * call lightline#update_once()
augroup END
let g:switch_custom_definitions =
\ [
\ {
\ '\vhttps://github.com/(.*)/(.*)': '\1/\2'
\ }
\ ]
let s:my_bundles = g:yaml_load('~/.vim/bundles.yml')
for bundle in s:my_bundles
for [bundle_source_name, bundle_options] in items(bundle)
execute 'NeoBundle "' . bundle_source_name . '", ' . string(bundle_options)
endfor
endfor
function! g:yaml_load(filename)
ruby << EOF
require 'yaml'
obj = YAML.load_file(File.expand_path(VIM::evaluate('a:filename')))
obj_hash = obj.inspect.gsub('=>', ':').gsub('nil', '{}')
VIM::command("let l:ret = #{obj_hash}")
EOF
return l:ret
endfunction