作者Bellkna (柔弱气质伪少女)
看板Editor
标题[vim ] 颜色设定档读取
时间Sat Dec 5 02:50:24 2015
#1BhpWFTo 看了这篇的建议後
自己写了 text 的颜色设定
然後现在有个读取的问题
/opt/test/test.txt //文字档
/opt/test/hl.vim //颜色档
每次开档後
:e /mnt/test/test.txt
:source /mnt/test/hl.vim
试过用 expand() 能正确展开
echo substitute(expand('%'), expand('%:t'), 'hl.vim', 'g')
但就写成热键 就一直跳错误
因为那目录会挂在不同的 linux 和 windows
所以不能写成固定的路径名称
想请问有没有什麽方法可以弄成热键
感谢回答
nnoremap <F3> :let g:highlightfilepath=substitute(expand('%'), expand('%:t'), 'highlight.vim', 'g')<CR>:execute 'source ' g:highlightfilepath<CR>
结果弄好了 不知道昨天脑袋在打结啥鬼
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 114.33.123.103
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Editor/M.1449255026.A.53A.html
※ 编辑: Bellkna (114.33.123.103), 12/05/2015 10:58:19
※ 编辑: Bellkna (114.33.123.103), 12/05/2015 18:18:25
1F:推 andy433268: 谢谢 受益良多 07/12 19:54