LaTeX 텍스트의 크기를 늘리거나 줄이는 함수를 작성하고 싶습니다. 커서가 단어 \ footnotesize 이상인 경우, 예를 들어, 나는 \ normalsize로 변경 작은 및 Tex_ChangeSize(1)
\ 로 변경 Tex_ChangeSize(-1)
를 호출합니다.vim 함수 내부에서 커서 아래 단어 바꾸기
function! Tex_ChangeSize(direction) let sizes = ["tiny", "scriptsize", "footnotesize", "small", "normalsize", "large", "Large", "LARGE", "huge", "Huge"] let cursize = index(sizes,expand("<cword>")) if cursize != -1 "FIXME: replace current word under cursor with the following echo sizes[cursize + a:direction] endif endfunction imap <C-h> <C-o>:call Tex_ChangeSize(-1)<Enter> imap <C-g> <C-o>:call Tex_ChangeSize(1)<Enter>
, 커서 아래에있는 단어를 교체하는 방법 (참조 FIXME) :
는 내가 가지고있는 것은 다음과 같다. 더 정확하게 말하면 : getline(line('.'))
을 파싱하고 setline()
으로 다시 설정하는 것보다 나은 방법이 있습니까?