32 lines
915 B
VimL
32 lines
915 B
VimL
"" Only current word would be taken care of.
|
|
"" That too only if cursor is not on the first char of the word.
|
|
|
|
"function! Fn(prefix)
|
|
" a:prefix . expand("<cword>") . "}"
|
|
"endfunction
|
|
|
|
function! Fn2(prefix, suffix)
|
|
" colnum starts from 1 whereas string indexing starts from 0
|
|
let curcolnum = col(".") - 1
|
|
let curline = getline(".")
|
|
if curcolnum > 0:
|
|
let prevchar = strcharpart(curline, curcolnum-1, 1)
|
|
if prevchar != " "
|
|
normal! "b"
|
|
endif
|
|
else
|
|
normal! "ct " . a:prefix . "<Esc>pa}<Esc>" "but what if there is no space remaining
|
|
endif
|
|
endfunction
|
|
|
|
" texttt
|
|
"inoremap <Leader>t <Esc>bi\texttt{<Esc>ea}
|
|
nnoremap <Leader>t ciw\texttt{<Esc>pa}<Esc>
|
|
" textit
|
|
"inoremap <Leader>i <Esc>bi\textit{<Esc>ea}
|
|
nnoremap <Leader>i ciw\textit{<Esc>pa}<Esc>
|
|
|
|
" textbf
|
|
"inoremap <Leader>b <Esc>bi\textbf{<Esc>ea}
|
|
nnoremap <Leader>b ciw\textbf{<Esc>pa}<Esc>
|