vim定制

Git | vimwiki | ctags


Linux 内核中的 Device Mapper 机制

LeaderF

极简完美配置b-vim


vim install git下载

Vundle-Git

Vim for PHP IDE

vim 安装神器级的补全工具youcompleteme

Vim基础配置

vim for git-pro

#设置鼠标右键拷贝
let g:skip_defaults_vim = 1

vim-plug

#for linux
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    
#for windows powershell
iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
    ni $HOME/vimfiles/autoload/plug.vim -Force

#vim .vimrc
call plug#begin('~/.vim/plug')
call plug#end()

" PlugInstall
" PlugUpdate
" plugClean[!]
" PlugUpgrade
" PlugStatus
" PlugDirr

设置git代理
git config --global http.proxy http://username:password@proxy.server.com:8080
git config --global http.proxy https://98.12.195.129:443
git config --global https.proxy https://98.12.195.129:443

git config --global http.proxy socks5://127.0.0.1:1088
git config --global https.proxy socks5://127.0.0.1:1088
git config --global --unset http.proxy
git config --global --unset https.proxy

修改用户主目录下的 .gitconfig 文件
[http]
    proxy = socks5://127.0.0.1:1088
[https]
    proxy = socks5://127.0.0.1:1088

Vim Session设置

保存buffer列表
:let buffers = filter(range(1, bufnr('$')), 'bufexists(v:val)'
:let buffers = map(copy(getbufinfo()), 'v:val.bufnr')
:set sessionoptions=buffers
:mksession .vimses
:mksession! .vimses
:so Session.vim, or from the commandline with vim -S Session.vim

sessionoptions选项: 
blank       //空窗口
buffers     //所有的缓冲区
curdir      //当前目录
folds       //折叠(fold)相关的信息
help        //帮助窗口
options     //所有的选项和映射
tabpages    //所有的标签页
winsize"    //窗口大小
slash       //windows路径改为'/'
unix        //linux换行

session设置:
:set sessionoptions=buffers,sesdir,folds,slash
:mksession .vimses      //保存session
:mksession! .vimses
:source .vimses         //恢复session
vim -S .vimses

自动打开session
vim -S .vimses

:wviminfo               //保存.viminfo
:rviminfo

windows定制安装

vim-dadbod
:DB mysql://root:passwd@localhost/wcn2018

docker composer start
docker composer stop

visualstudio build tools
https://visualstudio.microsoft.com/zh-hans/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16
https://www.python.org/downloads/windows/

下载二进制安装程序
https://releases.llvm.org/download.html

https://github.com/vim/vim-win32-installer/releases
//不产生交换文件
:set noswpfile
//设置交换文件在当前目录下的子目录
:set directory=./tmp    

Customer Vim

编译安装VIM:
git clone https://github.com/vim/vim.git
./configure --with-features=huge \
            --enable-multibyte \
            --enable-rubyinterp=yes \
            --enable-pythoninterp=yes \
            --with-python-config-dir=/usr/lib64/python2.7/config \
            --enable-python3interp=yes \
            --with-python3-config-dir=$(python3-config --configdir) \
            --enable-perlinterp=yes \
            --enable-luainterp=yes \
            --enable-gui=gtk2 \
            --enable-cscope \
            --prefix=/usr
make VIMRUNTIMEDIR=/usr/share/vim/vim82
sudo make install

sudo apt remove vim vim-tiny vim-common vim-runtime gvim
./configure --with-features=huge 
            --enable-multibyte 
            --enable-rubyinterp
            --enable-pythoninterp
            --with-python-config-dir=/usr/lib/python2.7/usr/lib/python2.7/config-x86_64-linux-gnu
            --enable-python3interp
            --enable-perlinterp
            --enable-luainterp
            --enable-gui=gtk2
            --enable-cscope
            --prefix=/usr
sudo make VIMRUNTIMEDIR=/usr/local/share/vim/vim81
sudo make install


指定user vimrc
vim -u /etc/vimrc

下载Vundle插件:
yum install -y git
git clone https://github.com/VundleVim/Vundle.vim.git .vim/bundle/

下载 ctags并编译安装:
yum -y install gcc
wget http://ctags.sourceforge.net/
./configure&make&make install

安装universal ctags:
yum install autoconf automake
git clone https://github.com/universal-ctags/ctags.git
#cd ctags
#./autogen.sh
#./configure  #--prefix=/usr/local
#make
#make install # may require extra privileges depending on where to install

echo $TERM      //查看终端类型
tput colors     //查看xterm终端支持的颜色

xterm开启256色
修改.bashrc文件
if ["$TERM" == "xterm"];then
    export TERM=xterm-256color
fi
编辑.vimrc文件
set t_Co=256    //terminal Color之意


设置颜色
colorscheme vick

Plugin 'VundleVim/Vundle.vim'

" Plugin 'tpope/vim-fugitive'
" Plugin 'L9'
" Plugin 'git://git.wincent.com/command-t.git'
" Plugin 'file:///home/gmarik/path/to/plugin'
" Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Plugin 'ascenator/L9', {'name': 'newL9'}
Plugin 'Zenburn'
"Plugin 'DrawIt'
"Plugin 'Conque-Shell'
"Plugin 'Vimpress'
"Plugin 'DoxygenToolkit.vim'
"Plugin 'c.vim'
"Plugin 'OmniCppComplete'
"Plugin 'SuperTab'

"Plugin 'joonty/vim-phpqa'
"Plugin 'joonty/vim-taggatron'
"Plugin 'EasyMotion'

-- LeaderF

leaderF

安装C extension
~/.vim/bundle/LeaderF/install.sh
./install.bat

ctrl+F  -- fullpath to filename;  综合查找方式: filename;pathname
ctrl+R  -- to regex

查看当前buffer
:ls :buffers :file

批量删除buffers
:3,5bd
:bd 3 4 5
:bd *.vue <c-a>     --clear *.vue file buffer
:%bd                --clear all buffers

ctrlp.vim|ctrlp-Git

ctrlP

<f5>  更新目录缓存。
<c-f> / <c-b> 在模式之间切换
<c-d> 在”完整路径匹配“ 和 ”文件名匹配“ 之间切换
<c-r> 在“字符串模式” 和 “正则表达式模式” 之间切换
<c-j> / <c-k> 上下移动光标
<c-t> 在新的 tab 打开文件
<c-v> 垂直分割打开
<c-x> 水平分割打开
<c-p>, <c-n> 选择历史记录
<c-y> 文件不存在时创建文件及目录
<c-z> 标记/取消标记, 标记多个文件后可以使用 <c-o> 同时打开多个文件

定制自己的snippet

snipMate定制

定制的位置
1.snippets/<filetype>.snippets
2.snippets/<filetpe>/<trigger>.snipMate
nnoremap <C-H> <C-W>h
nnoremap <C-L> <C-W>l
nnoremap <C-J> <C-W>j
nnoremap <C-K> <C-W>k

xml omnofunc

omnofunc

;help omnifunc
autocmd FileType php set omnifunc=phpcomplete#CompletePHP

autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete

MiniBufExpl

if g:miniBufExplMapCTabSwitchBufs
  noremap gt :call <SID>CycleBuffer(1)<CR>:<BS>
  noremap gT :call <SID>CycleBuffer(0)<CR>:<BS>
  "noremap <C-TAB>   :call <SID>CycleBuffer(1)<CR>:<BS>
  "noremap <C-S-TAB> :call <SID>CycleBuffer(0)<CR>:<BS>
endif

molokai colorscheme
MiniBufExpl.vim Elegant buffer explorer - takes very little screen space
The-NERD-tree A tree explorer plugin for navigating the filesystem
The-NERD-Commenter A plugin that allows for easy commenting of code for many filetypes
FuzzyFinder buffer/file/command/tag/etc explorer with fuzzy matching
dbext.vim Provides database access to many DBMS (Oracle, Sybase, Microsoft, MySQL, DBI,..)
Markdown Syntax highlight for Markdown text files
vimwiki Personal Wiki for Vim
taglist.vim Source code browser (supports C/C++, java, perl, python, tcl, sql, php, etc
Emmet.vim vim plugins for HTML and CSS hi-speed coding.
Visual-Mark visual mark, similar to UltraEdit's bookmark
L9 vim-script library
Syntastic automatic syntax checking
AutoComplPop automatically opens popup menu for completions
snipMate extmate's style code reuse for programmers.
phpvim PHP syntax file
python.vim enhanced version of the python syntax highlighting script
fugitive.vim Git wrapper so awesome, it should be illegal
JavaScript-syntax Javascript syntax
joonty/vim-sauce load different settings for different environments.
beyondwords/vim-twig Twig syntax highlighting, snipMate, etc.
itchyny/calendar.vim A calendar application for Vim
aklt/plantuml-syntax vim syntax file for plantuml
AD7six/vim-activity-log vimscript to log what you're doing in vim