博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Linux-安装plug-vim

Posted on 2023-03-14 07:02  乔55  阅读(85)  评论(0编辑  收藏  举报

安装plug-vim

// 安装plug.vim
cd 
git clone https://github.com/junegunn/vim-plug
mk ~/.vim/autoload -p
cd ~/.vim/autoload
cp ~/vim-plug/plug.vim ./

// 配置~/.vimrc

syntax on
set nu
set norelativenumber

set tabstop=2
set shiftwidth=2
set matchtime=2

set smartindent
set cindent
set autoindent

set ruler
set cursorline

set showmatch
set showcmd

set hlsearch
set incsearch
set ignorecase
set smartcase

set wildmenu



let mapleader=" "
noremap <LEADER><CR> :noh<CR>


noremap n h
map m <nop>
map s <nop>
map S :w<CR>
map Q :q<CR>


map msl :set splitright<CR>:vsplit<CR>
map msh :set nosplitright<CR>:vsplit<CR>
map msk :set nosplitbelow<CR>:split<CR>
map msj :set splitbelow<CR>:split<CR>
map <LEADER>l <C-w>l
map <LEADER>h <C-w>h
map <LEADER>k <C-w>k
map <LEADER>j <C-w>j
map <up> :res +1<CR>
map <down> :res -1<CR>
map <left> :vertical resize-1<CR>
map <right> :vertical resize+1<CR>
map mk :tabn<CR>
map mj :tabp<CR>
map ml :tablast<CR>
map mh :tabfirst<CR>

inoremap ( ()<Esc>i
inoremap [ []<Esc>i
inoremap { {}<Esc>i<Enter><Esc>O
inoremap " ""<Esc>i
inoremap ' ''<Esc>i
inoremap <C-b> <Backspace>
inoremap <C-g> <Down><Right>
inoremap <C-j> <Down>
inoremap <C-k> <Up>
inoremap <C-h> <Left>
inoremap <C-l> <Right>

func SkipPair()  
    if getline('.')[col('.') - 1] == ')' || getline('.')[col('.') - 1] == ']' || getline('.')[col('.') - 1] == '"' || getline('.')[col('.') - 1] == "'" || getline('.')[col('.') - 1] == '}'  
        return "\<ESC>la"  
    else  
        return "\t"  
    endif  
endfunc  

inoremap <TAB> <c-r>=SkipPair()<CR>



call plug#begin('~/.vim/plugged')

call plug#end()