33 lines
560 B
VimL
33 lines
560 B
VimL
" various tools inside vim
|
|
function! GetCharUnderCursor()
|
|
let line = getline('.')
|
|
let col = col('.')
|
|
return line[col - 1]
|
|
endfunction
|
|
|
|
" predefined macros in functions
|
|
function SpacedLine()
|
|
normal o
|
|
normal O
|
|
normal O
|
|
normal j
|
|
endfunction
|
|
|
|
function SwapWords()
|
|
normal dw
|
|
normal e
|
|
exec 'normal! a '
|
|
normal p
|
|
normal l
|
|
let char = GetCharUnderCursor()
|
|
if char == ' '
|
|
normal x
|
|
endif
|
|
normal h
|
|
normal b
|
|
normal b
|
|
endfunction
|
|
|
|
let @o = ':call SpacedLine()
|
|
'
|
|
let @s = ':call SwapWords()
|
|
'
|