vim - 使用vim9 + command t ,以及vim plugin

发布时间: 2023-05-03 00:57:00

refer to:







先保证你的ruby版本是2.7.0 的。 (安装asdf, ruby的过程略 ) 


安装支持 vim-ruby的包:

sudo apt install vim-nox  (这个包是支持到ruby 2.7.0 patch 0 的)

asdf global ruby 2.7.0

安装 python3

git clone

./configure --prefix=/usr/local \
  --with-x \
  --disable-nls \
  --disable-netbeans \
  --disable-gui \
  --enable-multibyte \
  --enable-rubyinterp \
  --enable-python3interp \
  --with-features=huge \
  --with-tlib=ncurses \

make && sudo make install


编辑 .vimrc

filetype on
set langmenu=none
set fileencodings=utf-8
set fileencoding=utf-8
set encoding=utf8

set expandtab
set shiftwidth=2
set softtabstop=2
set tabstop=2
set number
set autoindent
set hlsearch
set incsearch
set encoding=utf-8
" highlight Normal ctermfg=white ctermbg=cyan
set nowrap
syntax enable

let g:proj_window_width=5
set laststatus=2

" map <C-T> :FufFile<CR>
map <C-E> :MRU<CR>
map <C-S-M> :Rmodel<CR>
map <C-S-C> :Rcontroller<CR>
map <C-S-U> :Runit<CR>
map <C-S-L> :Rfunctional<CR>
map <C-H> :Rhelper<CR>
map <C-V> :Rview<CR>
map <C-J> :ZoomWin<CR>

" Strip trailing whitespace
function! <SID>StripTrailingWhitespaces()
    " Preparation: save last search, and cursor position.
    let _s=@/
    let l = line(".")
    let c = col(".")
    " Do the business:
    " Clean up: restore previous search history, and cursor position
    let @/=_s
    call cursor(l, c)
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces()

" match Todo /\s\+$/
filetype plugin on
let mapleader = ","

" defaults:
let otl_install_menu=1
let no_otl_maps=0
let no_otl_insert_maps=0

" overrides:
let otl_bold_headers=0
let otl_use_thlnk=0

" au BufWinLeave *.otl mkview
" au BufWinEnter *.otl silent loadview
let maplocalleader = ","

""Only do this part when compiled with support for autocommands.
"if has("autocmd")
"  autocmd Filetype java setlocal omnifunc=javacomplete#Complete

set nocompatible               " be iMproved
filetype off                   " required!

" ============== Vundle part =================
set rtp+=~/.vim/bundle/vundle/

call plug#begin()

Plug 'gmarik/vundle'
Plug 'tpope/vim-fugitive'
Plug 'Lokaltog/vim-easymotion'
Plug 'tpope/vim-rails'
Plug 'vim-scripts/'
Plug 'ecomba/vim-ruby-refactoring'
Plug 'vim-scripts/L9'
Plug 'vim-scripts/FuzzyFinder'
Plug 'wincent/command-t'
Plug 'vim-scripts/YankRing.vim'
Plug 'tpope/vim-vividchalk'
Plug 'preservim/nerdcommenter'
Plug 'preservim/nerdtree'
Plug 'kchmck/vim-coffee-script'
Plug 'yegappan/mru'
Plug 'skwp/greplace.vim'
Plug 'tomlion/vim-solidity'

call plug#end()

colorscheme vividchalk
set background=light
set background=dark

filetype plugin indent on     " required!

map <S-F> <Leader><Leader>f
map <Leader>a :YRShow<CR>
map <Leader>t :NERDTree<CR>
map <Leader>q :q<CR>
map <Leader>f :Rfixture<CR>
map <Leader>rj :Rjavascript<CR>

"autocmd BufWritePost,FileWritePost *.coffee :silent !coffee --compile --join appstore/static/javascripts/angular/controllers.js appstore/static/javascripts/angular/ appstore/static/javascripts/angular/tabs/*coffee appstore/static/javascripts/angular/applications/*coffee appstore/static/javascripts/angular/users/*coffee appstore/static/javascripts/angular/commons/*coffee
"autocmd BufWritePost,FileWritePost *.coffee :silent !coffee --compile appstore/static/javascripts/angular/ appstore/static/javascripts/angular/ appstore/static/javascripts/angular/ appstore/static/javascripts/angular/

"autocmd BufWritePost,FileWritePost *.coffee :silent !coffee --compile --join tvboxcms/static/javascripts/angular/controllers.js tvboxcms/static/javascripts/angular/ tvboxcms/static/javascripts/angular/tabs/*coffee tvboxcms/static/javascripts/angular/applications/*coffee tvboxcms/static/javascripts/angular/users/*coffee tvboxcms/static/javascripts/angular/commons/*coffee
"autocmd BufWritePost,FileWritePost *.coffee :silent !coffee --compile tvboxcms/static/javascripts/angular/ tvboxcms/static/javascripts/angular/ tvboxcms/static/javascripts/angular/ tvboxcms/static/javascripts/angular/

"autocmd BufWritePost,FileWritePost *.coffee :silent !coffee --compile --join m-cms-preview/static/javascripts/angular/controllers.js m-cms-preview/static/javascripts/angular/ m-cms-preview/static/javascripts/angular/tabs/*coffee m-cms-preview/static/javascripts/angular/applications/*coffee m-cms-preview/static/javascripts/angular/users/*coffee m-cms-preview/static/javascripts/angular/commons/*coffee
"autocmd BufWritePost,FileWritePost *.coffee :silent !coffee --compile m-cms-preview/static/javascripts/angular/ m-cms-preview/static/javascripts/angular/ m-cms-preview/static/javascripts/angular/ m-cms-preview/static/javascripts/angular/
autocmd BufWritePost,FileWritePost *.raml silent! !raml2html doc/api.raml > public/api_doc.html
"" For fuf plugin , ignore the node_modules folder
" Truth be told, I don't remember what these do, but I must have
" found them necessary back when I installed fuzzyfinder years ago
let s:slash = '[/\\]'
let s:startname = '(^|'.s:slash.')'
let s:endname = '($|'.s:slash.')'

" directories and extensions to ignore when listing files
" these contain a lot of Python-isms, yours will probably vary
let s:extension = '\.bak|\.dll|\.exe|\.o|\.pyc|\.pyo|\.swp|\.swo'
let s:dirname = 'build|deploy|dist|vms|\.bzr|\.git|\.hg|\.svn|.+\.egg-info|node_modules|logs|log|tmp|coverage'
let g:fuf_file_exclude = '\v'.'('.s:startname.'('.s:dirname.')'.s:endname.')|(('.s:extension.')$)'
let g:fuf_dir_exclude = '\v'.s:startname.'('.s:dirname.')'.s:endname

" limit number of displayed matches
" (makes response instant even on huge source trees)
let g:fuf_enumeratingLimit = 200

然后下载 vim-plug 插件:

curl -fLo ~/.vim/autoload/plug.vim --create-dirs \

进入vim ,然后 :PlugInstall



$ vim --version  看一下是否支持ruby

asdf global ruby 2.7.0 切记这一点

cd ~/.vim/plugged/command-t/ruby/command-t/ext/command-t

ruby extconf.rb && make clean &&  make

sudo make install