vim初级

" Vim with all enhancements
source $VIMRUNTIME/vimrc_example.vim

" Use the internal diff if available.
" Otherwise use the special 'diffexpr' for Windows.
if &diffopt !~# 'internal'
set diffexpr=MyDiff()
endif
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg1 = substitute(arg1, '!', '\!', 'g')
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg2 = substitute(arg2, '!', '\!', 'g')
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let arg3 = substitute(arg3, '!', '\!', 'g')
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
if empty(&shellxquote)
let l:shxq_sav = ''
set shellxquote&
endif
let cmd = '"' . $VIMRUNTIME . '\diff"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
let cmd = substitute(cmd, '!', '\!', 'g')
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
if exists('l:shxq_sav')
let &shellxquote=l:shxq_sav
endif
endfunction
syntax enable
"leader设置为,键,可以让vim更加灵活
let mapleader=','
let g:mapleader=','
"让光标在各个窗口移动
noremap <C-h> <C-w>h
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-l> <C-w>l
set background=dark
"文件保存快捷键
inoremap <leader>w <esc>:w<cr>
noremap <leader>w :w<cr>
"设置jj等于esc,esc太远了
inoremap jj <esc>`^
"行号
set number
"d文件查找比较方便
let g:ctrlp_map='<c-p>'
"文件查找快捷键,来源于NERDRTree插件
nnoremap <leader>v :NERDTreeFind<cr>
"弹出和关闭文件管理器,类似于vscode的左边部分
nnoremap <leader>g :NERDTreeToggle<cr>
"显示出隐藏的文件
let NERDTreeShowHidden=1
"查找的时候忽略大小写
set ignorecase
call plug#begin("D:\\Vim\\vimfiles\\pluged")
"ss-> 69
Plug 'easymotion/vim-easymotion'
"background
Plug 'w0ng/vim-hybrid'
"file find fuzzy ctrl+p
Plug 'ctrlpvim/ctrlp.vim'

Plug 'mhinz/vim-startify'
"file manager tool ,g 55(open or close the manager tree)
Plug 'scrooloose/nerdtree'

Plug 'fatih/vim-go',{'do':':GoUpdateBinaries'}
Plug 'Yggdroot/indentLine'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
"(){}[] change(cs AB)
Plug 'tpope/vim-surround'
call plug#end()
"让插件提供的命令和ss(连续按两次s)绑定,非常方便
"n=normal i=insert v=visual
"nore=非递归
"map=映射
nmap ss <Plug>(easymotion-s2)

posted @ 2022-07-20 22:00  丁庄主啊  阅读(47)  评论(0编辑  收藏  举报