首页 行业资讯 宠物日常 宠物养护 宠物健康 宠物故事

中"vim配置"到底有多强大

发布网友 发布时间:2022-04-23 14:15

我来回答

1个回答

热心网友 时间:2022-04-27 19:37

虽然我是 SpaceVim/NeoVim 党。如果你不准备用 SpaceVim 或者直接下载别人的 vimrc,那么有几点可以提示一下
首先是 text-object 这块,除了默认的以外你可以考虑 argtextobj 和 vim-surround 等等增强,但是可惜的一点是,虽然 text-obj 是 Vim 开始的,但是 Emacs/Spacemacs 这方面更会玩。
然后是 vim-slime 这一块,你可以考虑和一个 quake-like terminal 搭配,这样你可以很方便的在调试程序是打开,而在不调试程序的时候收起。
vim-sensible 一般是所有识大体的人的选择
熟悉 ultisnips 的 Vimmer 可能可以获得「身手不凡,身手不凡呐」的称号。(不过熟悉 Yas 或者类似的 emacser 也有高概率获得如此称号
另外稍微用得多了一点之后千万不要一个 .vimrc 写所有设置,最好还是分成几个然后再 source,否则你的 .vimrc 看起来想死
为了速度,你需要 dein 或者 vim-plug 之类支持 auto-load 的插件管理
另外虽然自己用插件比较多,大部分时候 nyaovim 除了显示代码的主窗口只有下面的 status line 和 cmd line,以及上面的 tab line;其他的窗口比如 nerdtree, neomake 之类的都是按需打开,于是你会发现 C-w 系列其实也是很重要的
应评论晒一下自己用了 SpaceVim 之后的 init.vim,其中 layer#lang#org 是自写的一个关于 vim-orgmode 的 layer
" Dark powered mode of SpaceVim, generated by SpaceVim automatically.
let g:spacevim_enable_debug = 0
let g:spacevim_realtime_leader_guide = 1
let g:spacevim_automatic_update = 1

call SpaceVim#layers#load('incsearch')
call SpaceVim#layers#load('autocomplete')
if has('nvim')
let g:deoplete#enable_at_startup = 1
end
set autochdir
let g:spacevim_filemanager = 'nerdtree'
call SpaceVim#layers#load('lang#c')
call SpaceVim#layers#load('lang#elixir')
call SpaceVim#layers#load('lang#go')
call SpaceVim#layers#load('lang#haskell')
call SpaceVim#layers#load('lang#java')
call SpaceVim#layers#load('lang#javascript')
call SpaceVim#layers#load('lang#lua')
call SpaceVim#layers#load('lang#perl')
call SpaceVim#layers#load('lang#edit')
" call SpaceVim#layers#load('lang#php')
call SpaceVim#layers#load('lang#python')
call SpaceVim#layers#load('lang#org')
call SpaceVim#layers#load('lang#rust')
call SpaceVim#layers#load('lang#swig')
call SpaceVim#layers#load('lang#tmux')
call SpaceVim#layers#load('lang#julia')

call SpaceVim#layers#load('lang#vim')
" call SpaceVim#layers#load('lang#latex')
call SpaceVim#layers#load('lang#xml')
call SpaceVim#layers#load('shell')
call SpaceVim#layers#load('tools#screensaver')

let g:spacevim_enable_vimfiler_welcome = 1
let g:spacevim_enable_debug = 1
let g:deoplete#auto_complete_delay = 150
let g:spacevim_enable_tabline_filetype_icon = 1
let g:spacevim_enable_os_fileformat_icon = 1
let g:spacevim_buffer_index_type = 1
let g:neomake_vim_enabled_makers = []
if executable('vimlint')
call add(g:neomake_vim_enabled_makers, 'vimlint')
endif
if executable('vint')
call add(g:neomake_vim_enabled_makers, 'vint')
endif

let g:neomake_tex_enabled_makers = ['chktex']

if has('python3')
let g:ctrlp_map = ''
nnoremap <silent> <C-p> :Denite file_rec<CR>
endif
let g:clang2_placeholder_next = ''
let g:clang2_placeholder_prev = ''

" set tabstop=2
set shiftwidth=2
" call dein#check_clean();
let g:spacevim_custom_plugins= [
\ ['tpope/vim-sensible'],
\ ['kana/vim-smartword'],
\ ['vim-scripts/argtextobj.vim'],
\ ['saihoooooooo/vim-textobj-space'],
\ ['zhujinxuan/snippets-tex-equations', {'on_ft' : 'tex'}],
\]
let g:spacevim_unite_leader = '<F6>'
let g:spacevim_denite_leader = 'h'
let g:spacevim_snippet_engine = 'ultisnips'

call SpaceVim#custom#SPC('nmap', ['c', 'c'], '<plug>NERDCommenterInvert', 'toggle comment lines', 0)
call SpaceVim#custom#SPC('nmap', ['c', 'C'], '<plug>NERDCommenterComment', 'comment lines', 0)
call SpaceVim#custom#SPC('nmap', ['c', 'l'], '<plug>NERDCommenterInvert', 'toggle comment lines', 0)
call SpaceVim#custom#SPC('nmap', ['c', 'L'], '<plug>NERDCommenterComment', 'comment lines', 0)
call SpaceVim#custom#SPC('nmap', ['c', 'p'], 'vip<Plug>NERDCommenterInvert', 'toggle comment paragraphs', 0)
call SpaceVim#custom#SPC('nmap', ['c', 'P'], 'vip<Plug>NERDCommenterComment', 'comment paragraphs', 0)
call SpaceVim#custom#SPC('nmap', ['b', '#'], ':b #<CR>', 'Previously active buffer(:b #)', 0)

call SpaceVim#layers#load('vim#slime')

" let g:spacevim_colorscheme = 'molokai'

let g:spacevim_enable_powerline_fonts = 1
let g:spacevim_guifont='DroidSansMonoForPowerline\ Nerd\ Font:h11'
let g:spacevim_enable_tabline_filetype_icon=0
let g:spacevim_buffer_index_type = 4

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com