Re: [vim ] 如何command下展開變數

看板Editor作者 (Crazy Rhythm)時間5年前 (2019/03/17 02:07), 編輯推噓1(102)
留言3則, 3人參與, 5年前最新討論串2/2 (看更多)
(其餘恕刪) : → ggirls: 有類似 <ctrl-R>" 這種直接展開的方法嗎? 03/16 23:38 比如說有定義了這個function function! My_Variable_Expand() let l:_input = input("the var to be expanded: ") if l:_input == "MYDOC" return g:MYDOC endif return "" endfunction 在執行了下面這行後 :cmap <F3> <c-r>=My_Variable_Expand()<CR> 以後在command mode按F3,於提示後再輸入MYDOC 按enter後就會自動展開變數儲存的值 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.26.208.31 ※ 文章網址: https://www.ptt.cc/bbs/Editor/M.1552759640.A.C83.html

03/17 09:09, 5年前 , 1F
也可以在vimrc直接call function
03/17 09:09, 1F

03/18 16:21, 5年前 , 2F
謝謝flu
03/18 16:21, 2F

03/20 18:37, 5年前 , 3F
欸我上一篇推太快,還沒看這篇XD OP了
03/20 18:37, 3F
文章代碼(AID): #1SZJjOo3 (Editor)
文章代碼(AID): #1SZJjOo3 (Editor)