Skip to content

Instantly share code, notes, and snippets.

"-----------------------------------------------------------------------------
" Comment-out
" caw.vim
" https://github.com/tyru/caw.vim
let g:caw_sp_i = ''
let g:caw_sp_I = ''
let g:caw_i_startinsert_at_blank_line = 0
function! s:multi_map(modes, map_cmd)
for mode in split(a:modes, '\zs')
execute mode . a:map_cmd
endfor
endfunction
@h1mesuke
h1mesuke / keymaps.vim
Created September 1, 2011 21:14
Vim - Relative Jump
" Relative Jump
call s:multi_map('nxo', 'noremap <silent> ;q :<C-u>call <SID>relative_jump(20, 0)<CR>')
call s:multi_map('nxo', 'noremap <silent> ;a :<C-u>call <SID>relative_jump(50, 0)<CR>')
call s:multi_map('nxo', 'noremap <silent> ;z :<C-u>call <SID>relative_jump(80, 0)<CR>')
call s:multi_map('nxo', 'noremap <silent> ;w :<C-u>call <SID>relative_jump(20, 20)<CR>')
call s:multi_map('nxo', 'noremap <silent> ;s :<C-u>call <SID>relative_jump(50, 20)<CR>')
call s:multi_map('nxo', 'noremap <silent> ;x :<C-u>call <SID>relative_jump(80, 20)<CR>')
call s:multi_map('nxo', 'noremap <silent> ;e :<C-u>call <SID>relative_jump(20, 66)<CR>')
Sources: outline
>
- XCopyPlane : macro
-
- USE_PAINT_REGION : macro
-
- num_hatches : macro
@h1mesuke
h1mesuke / unite_converter_sample.vim
Created March 13, 2011 01:28
Vim - Sample of custom filter for unite.vim
let s:converter = {
\ 'name' : 'converter_file_mru',
\ 'description' : 'file_mru converter',
\ }
function! s:converter.filter(candidates, context)
let candidates = copy(a:candidates)
for cand in candidates
let cand.abbr = substitute(cand.abbr, '^([^)]*)', '', '')
endfor
@h1mesuke
h1mesuke / string.vim
Created March 5, 2011 07:16
Vim - Levenshtein Distance
function! lib#string#levenshtein_distance(str1, str2)
let str1_chars = split(a:str1, '\zs') | let str1_len = len(str1_chars)
let str2_chars = split(a:str2, '\zs') | let str2_len = len(str2_chars)
let matrix = []
let y = 0
while y <= str2_len
let row = range(0, str1_len)
let row[0] = y
call add(matrix, row)
@h1mesuke
h1mesuke / scheme.snip
Created January 4, 2011 13:49
Vim - My snippets for Scheme
# Snippets for Scheme
snippet shebang
#!/usr/bin/env gosh
snippet modeline
; vim: filetype=scheme
#----------------------------------------------------------------------------
# Abbrevs
@h1mesuke
h1mesuke / vim.snip
Created January 4, 2011 13:44
Vim - My snippets for Vim script
# Snippets for VimScript
include separator_vim.snip
snippet modeline
prev_word '^'
" vim: filetype=vim
#-----------------------------------------------------------------------------
# Abbrevs
@h1mesuke
h1mesuke / helek.vim
Created January 3, 2011 23:03
Vim - My colorscheme
" ORIGINAL FILE:
" /usr/share/vim/vim72/colors/delek.vim
" ORIGINAL HEADER:
" Vim color file
" Maintainer: David Schweikert <dws@ee.ethz.ch>
" Last Change: 2006 Apr 30
" MODIFIED BY:
" h1mesuke <himesuke@gmail.com>
@h1mesuke
h1mesuke / abbrev.vim
Created November 9, 2010 15:13
Vim - A port of Ruby's abbrev
"-----------------------------------------------------------------------------
" Abbrev
function! util#abbrev(words)
let table = {}
let seen = {}
for word in a:words
let abbrev = substitute(word, '.$', '', '')
let ablen = strlen(abbrev)
while ablen > 0