vimrc的配置(插件从gitee上进行下载)

分享一下自己的vimrc的配置

需要注意的是,其他的插件都是从gitee上进行下载的,因此如果想复用下边的vimrc配置文件,需要对plug管理插件工具的配置文件中修改为gitee,这也是可以解决使用国外github下载插件慢的问题。

具体修改plug插件管理的gitee的方法见我的一个博客:
安装vim插件慢怎么办?

set number
set cursorline
set showcmd
set wildmenu
set incsearch
set hlsearch
set incsearch
set ignorecase
set smartcase
set wrap
set laststatus=2
"set list
set ruler
set autoindent
set tabstop=4
set softtabstop=4
set smartcase
set shiftwidth=4
set cindent
set nocompatible
set backspace=2
set fileformat=unix
set encoding=utf-8
set fileencoding=utf-8                                                                                                               
set fileencodings=ucs-bom,utf-8,cp936,latin1   
set smartindent
set noexpandtab "noexpandtab / expandtab" 设置tab是否为四个空格
set list lcs=tab:\|\ 
set timeout 
set noendofline binary
set timeoutlen=300
"set autochdir	
"set tags+=tags
syntax on

set term=xterm-256color    “开启256色
"set termguicolors     "开启真彩
set pastetoggle=<F9>

"前进和后退的快捷键”
:map fh ^
:map fl $

:noremap fj <esc>
:inoremap fj <esc>

"设置查看系统函数快捷键
:nnoremap ? <s-k> 

"退出的快捷键
:map W :w!<CR>
:map Q :q!<CR>

"space to command mode.
:map <space> :
:map <F12> :TagbarToggle<CR>

"分屏的设置快捷键
:map sl :set splitright<CR>:vsplit<CR>
:map sh :set nosplitright<CR>:vsplit<CR>
:map sk :set nosplitbelow<CR>:split<CR>
:map sj :set splitbelow<CR>:split<CR>

"设置分屏的快捷键
:nnoremap <s-h> <C-w>h
:nnoremap <s-j> <C-w>j
:nnoremap <s-k> <C-w>k
:nnoremap <s-l> <C-w>l

"设置函数前进和后退的快捷键
":nnoremap o <c-o>
":nnoremap i <c-i>
:nnoremap <s-o> <c-o>
:nnoremap <s-i> <c-i>

"设置在插入模式下光标移动的快捷键
:inoremap h <left>
:inoremap j <down>
:inoremap k <up>
:inoremap l <right>  

"调整尺寸的快捷键
:map <up> :res +5<CR>
:map <down> :res -5<CR>
:map <left> :vertical resize-5<CR>
:map <right> :vertical resize+5<CR>

"上下左右键的行为 会显示其他信息
inoremap <expr> <Down>     pumvisible() ? "\<C-n>" : "\<Down>"
inoremap <expr> <Up>       pumvisible() ? "\<C-p>" : "\<Up>"
inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>"
inoremap <expr> <PageUp>   pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>"

"插件的管理工具“
call plug#begin('~/.vim/plugged')
" Shorthand notation for plugin
Plug 'rulei_mirror/vim-airline'
Plug 'HasturBoss/nerdtree'
Plug 'rulei_mirror/vim-gutentags'
Plug 'archongum/fzf'
Plug 'wangjiaming0909/indentLine'
Plug 'yaozhijin/fzf.vim'
Plug 'mirrors_jiangmiao/auto-pairs'
Plug 'yaozhijin/ale'
Plug 'yaozhijin/tagbar'
Plug 'zgpio/coc.nvim', {'branch': 'release'}
Plug 'foyon/molokai'
Plug 'bon-ami/vim-signature'
Plug 'ProVim/vim-easymotion'
Plug 'hwyang/vim-snippets'
call plug#end()

"一、设置mark的快捷键
:nnoremap <s-m> :Marks<CR>
"========================================================================
"mx           Toggle mark 'x' and display it in the leftmost column
"dmx          Remove mark 'x' where x is a-zA-Z
"
"m,           Place the next available mark
"m.           If no mark on line, place the next available mark. Otherwise, remove (first) existing mark.
"m-           Delete all marks from the current line
"m<Space>     Delete all marks from the current buffer
"========================================================================

"二、设置easymotion的快捷键
nmap ss <Plug>(easymotion-overwin-f2)
let g:coc_global_extensions = ['coc-json', 'coc-go', 'coc-python', 'coc-snippets', 'coc-clangd', 'coc-marketplace', 'coc-highlight', 'coc-jedi' ] 

"三、设置fzf的快捷键“
:map <s-p> :Files<CR>     
:map <s-b> :Buffers<CR>    # crtl + b 会和tmux的前缀出现冲突,因次将其更换为shift + b的方式
:map <C-f> :Ag<CR>
:map <C-k> :Ag <C-R><C-W><CR>
:map <s-f> :BLInes<CR>

"四、neadtree的插件配置“
:map tt :NERDToggle<CR>

"五、设置ctags列出多函数列表
:nnoremap ; g<c-]>

"六、gutentags搜索工程目录的标志,碰到这些文件/目录名就停止向上一级目录递归
let g:gutentags_project_root = ['.root', '.svn', '.git', '.project']
 let g:gutentags_modules = ['ctags']

" 所生成的数据文件的名称
let g:gutentags_ctags_tagfile = '.tags'

" gutentags_pus 插件                                                                                                                                                      
let g:gutentags_plus_switch = 1  "change focus to quickfix window after search                                                                                             
let g:gutentags_plus_nomap = 1 "失效默认的按键映射"  

" 将自动生成的 tags 文件全部放入 ~/.cache/tags 目录中,避免污染工程目录
let s:vim_tags = expand('~/.cache/tags')
let g:gutentags_cache_dir = s:vim_tags

" 检测 ~/.cache/tags 不存在就新建
if !isdirectory(s:vim_tags)
   silent! call mkdir(s:vim_tags, 'p')
endif

" 配置 ctags 的参数
let g:gutentags_ctags_extra_args = ['--fields=+niazS', '--extra=+q']
let g:gutentags_ctags_extra_args += ['--c++-kinds=+pxI']
let g:gutentags_ctags_extra_args += ['--c-kinds=+px']

"七、设置主题
let g:molokai_original = 1
let g:rehash256 = 1
colorscheme molokai     "设置主题为molokai

" 设置窗口在下方
let g:fzf_layout = { 'down': '~70%' }

"八、实现回车补全,coc插件的配置
inoremap <silent><expr> <cr> coc#pum#visible() ? coc#_select_confirm() : "\<C-g>u\<CR>"

"实现tab自动补全,coc插件的配置
" use <tab> for trigger completion and navigate to the next complete item
function! CheckBackspace() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction

inoremap <silent><expr> <Tab>
      \ coc#pum#visible() ? coc#pum#next(1) :
      \ CheckBackspace() ? "\<Tab>" :
      \ coc#refresh()

"实现c-j的上下移动,coc插件的配置
inoremap <expr> <c-j> coc#pum#visible() ? coc#pum#next(1) : "\<Tab>"
inoremap <expr> <c-k> coc#pum#visible() ? coc#pum#prev(1) : "\<S-Tab>"

"九、设置indentline缩进线
let g:indentLine_enabled = 1
let g:indentLine_char = '┊'
let g:indentLine_conceallevel = 2

"十、参数的选择
" Use <C-j> for select text for visual placeholder of snippet.
"vmap <c-g> <Plug>(coc-snippets-select)

" Use <C-j> for jump to next placeholder, it's default of coc.nvim
let g:coc_snippet_next = '<c-l>'

" Use <C-k> for jump to previous placeholder, it's default of coc.nvim
let g:coc_snippet_prev = '<c-h>'

noremap <Tab> :bnext<CR>
noremap <S-Tab> :bprevious<CR>

"airline的配置过程
if !exists('g:airline_symbols')
	let g:airline_symbols = {}
endif

" 开启tabline
let g:airline#extensions#tabline#enabled = 1      "tabline中当前buffer两端的分隔字符
let g:airline#extensions#tabline#left_sep = ' '   "tabline中未激活buffer两端的分隔字符
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'

" 关闭空白符检测
let g:airline#extensions#whitespace#enabled=0
let g:airline_powerline_fonts = 1  
set laststatus=2  "永远显示状态栏

二、nvim下的init.nvim

与vim的插件略有不同

set number
set cursorline cursorcolumn
set showcmd
set wildmenu
set incsearch
set hlsearch
set incsearch
set ignorecase
set smartcase
set wrap
set laststatus=2
"set relativenumber
"set list
set ruler
set autoindent
set tabstop=4
set softtabstop=4
set smartcase
set shiftwidth=4
set mouse=""
set cindent
set nocompatible
set backspace=2
set fileformats=unix,dos
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936,latin1,gb18030,gbk,gb2312,chinese
set termencoding=utf-8 
set guifont=Consolas:h12
set showmode 
 set linebreak
 set scrolloff=5
 set showmatch
set smartindent
set noexpandtab "noexpandtab / expandtab" 设置tab是否为四个空格
set list lcs=tab:\¦\ 
set timeoutlen=130
"set autochdir	
set noendofline binary  "设置vim打开保存时,不会在末尾自动加上0a"
"set tags+=tags
syntax on
syntax enable
filetype plugin on

"set term=xterm-256color
set pastetoggle=<F9>
"set termguicolors

"前进和后退的快捷键”
:map fh ^
:map fl $

:noremap fj <esc>
:inoremap fj <esc>

"设置查看系统函数快捷键
:nnoremap ? <s-k> 

"退出的快捷键
:map W :w!<CR>
:map Q :q!<CR>

"space to command mode.
:map <space> :
:map <F12> :TagbarToggle<CR>

"分屏的设置快捷键
:map sl :set splitright<CR>:vsplit<CR>
:map sh :set nosplitright<CR>:vsplit<CR>
:map sk :set nosplitbelow<CR>:split<CR>
:map sj :set splitbelow<CR>:split<CR>

"设置分屏的快捷键
:nnoremap <s-h> <C-w>h
:nnoremap <s-j> <C-w>j
:nnoremap <s-k> <C-w>k
:nnoremap <s-l> <C-w>l

"设置函数前进和后退的快捷键
":nnoremap o <c-o>
":nnoremap i <c-i>
:nnoremap <s-o> <c-o>
:nnoremap <s-i> <c-i>

"设置在插入模式下光标移动的快捷键
:inoremap h <left>
:inoremap j <down>
:inoremap k <up>
:inoremap l <right>  

"调整尺寸的快捷键
:map <up> :res +5<CR>
:map <down> :res -5<CR>
:map <left> :vertical resize-5<CR>
:map <right> :vertical resize+5<CR>

"上下左右键的行为 会显示其他信息
inoremap <expr> <Down>     pumvisible() ? "\<C-n>" : "\<Down>"
inoremap <expr> <Up>       pumvisible() ? "\<C-p>" : "\<Up>"
inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>"
inoremap <expr> <PageUp>   pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>"

"插件的管理工具“
call plug#begin('~/.config/nvim/plugged')
Plug 'itl/vim-airline'
Plug 'liquzhi/nerdtree'
Plug 'trunkMode/vim-gutentags'
Plug 'archongum/fzf'
Plug 'yaozhijin/fzf.vim'
Plug 'mirrors_jiangmiao/auto-pairs'
Plug 'wangjiaming0909/indentLine'
Plug 'yaozhijin/ale'
Plug 'yaozhijin/tagbar'
Plug 'zgpio/coc.nvim', {'branch': 'release'}
Plug 'rockmanlc/molokai'
Plug 'bon-ami/vim-signature'
Plug 'duyz1218/vim-easymotion'
Plug 'hwyang/vim-snippets'
Plug 'cangmj/plenary.nvim'
Plug 'dglxlcl/vim-signify'
Plug 'zsdfbb/telescope.nvim', { 'tag': '0.1.2' }
call plug#end()

"一、设置mark的快捷键
":nnoremap <s-m> :Marks<CR>
:nnoremap <s-m> <cmd>Telescope marks<cr>   
"========================================================================
"mx           Toggle mark 'x' and display it in the leftmost column
"dmx          Remove mark 'x' where x is a-zA-Z
"
"m,           Place the next available mark
"m.           If no mark on line, place the next available mark. Otherwise, remove (first) existing mark.
"m-           Delete all marks from the current line
"m<Space>     Delete all marks from the current buffer
"========================================================================

"二、设置easymotion的快捷键
nmap s <Plug>(easymotion-overwin-f2)
let g:coc_global_extensions = ['coc-json', 'coc-go', 'coc-python', 'coc-snippets', 'coc-clangd', 'coc-marketplace', 'coc-highlight', 'coc-jedi' , 'coc-marketplace','coc-tsserver'] 

"三、设置fzf的快捷键“
":map <s-p> :Files<CR>                                                                                                                                                            
:nnoremap <s-p> <cmd>Telescope find_files<cr>                                                                                                                                     
:nnoremap <C-f> <cmd>Telescope live_grep<cr>                                                                                                                                      
:nnoremap <s-b> <cmd>Telescope buffers<cr>                                                                                                                                        
":map <s-b> :Buffers<CR>                                                                                                                                                          
":map <C-f> :Rg <CR>                                                                                                                                                              
:map <C-k> :Rg <C-R><C-W><CR>                                                                                                                                                     
":map <s-f> :BLines<CR>    
:nnoremap <s-f> <cmd>Telescope current_buffer_fuzzy_find<cr> 
 
" 四、neadtree的插件配置“
:map <F11> :NERDTreeToggle<CR>

"五、设置ctags列出多函数列表
:map ; g<c-]>

"六、gutentags搜索工程目录的标志,碰到这些文件/目录名就停止向上一级目录递归
let g:gutentags_project_root = ['.root', '.svn', '.git', '.project']
let g:gutentags_modules = ['ctags']

" gutentags_pus 插件
let g:gutentags_plus_switch = 1  "change focus to quickfix window after search
let g:gutentags_plus_nomap = 1 "失效默认的按键映射"

" 所生成的数据文件的名称
let g:gutentags_ctags_tagfile = '.tags'

" 将自动生成的 tags 文件全部放入 ~/.cache/tags 目录中,避免污染工程目录
let s:vim_tags = expand('~/.cache/tags')
let g:gutentags_cache_dir = s:vim_tags

" 检测 ~/.cache/tags 不存在就新建
if !isdirectory(s:vim_tags)
   silent! call mkdir(s:vim_tags, 'p')
endif

" 配置 ctags 的参数
let g:gutentags_ctags_extra_args = ['--fields=+niazS', '--extra=+q']
let g:gutentags_ctags_extra_args += ['--c++-kinds=+pxI']
let g:gutentags_ctags_extra_args += ['--c-kinds=+px']

"七、设置主题
let g:molokai_original = 1
let g:rehash256 = 1

colorscheme molokai

" 设置窗口在下方
let g:fzf_layout = { 'down': '~70%' }

"八、实现回车补全,coc插件的配置
inoremap <silent><expr> <cr> coc#pum#visible() ? coc#_select_confirm() : "\<C-g>u\<CR>"

"实现tab自动补全,coc插件的配置
" use <tab> for trigger completion and navigate to the next complete item
function! CheckBackspace() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction

inoremap <silent><expr> <Tab>
      \ coc#pum#visible() ? coc#pum#next(1) :
      \ CheckBackspace() ? "\<Tab>" :
      \ coc#refresh()

"实现c-j的上下移动,coc插件的配置
inoremap <expr> <c-j> coc#pum#visible() ? coc#pum#next(1) : "\<Tab>"
inoremap <expr> <c-k> coc#pum#visible() ? coc#pum#prev(1) : "\<S-Tab>"

"十、参数的选择
" Use <C-j> for select text for visual placeholder of snippet.
vmap <c-g> <Plug>(coc-snippets-select)

" Use <C-j> for jump to next placeholder, it's default of coc.nvim
let g:coc_snippet_next = '<c-l>'

" Use <C-k> for jump to previous placeholder, it's default of coc.nvim
let g:coc_snippet_prev = '<c-h>'

" 关闭空白符检测
let g:airline#extensions#whitespace#enabled=0
let g:airline_powerline_fonts = 1  
let laststatus = 2

let g:indentLine_enabled = 1
let g:indentLine_char = '¦'
let g:indentLine_conceallevel = 2

"vim-signify
if has('nvim') || has('patch-8.0.902') 
	Plug 'dglxlcl/vim-signify'
else
	Plug 'dglxlcl/vim-signify', { 'branch': 'legacy' } 
endif
" default updatetime 4000ms is not good for async update 
set updatetime=100 
:map <F10> :SignifyDiff!<CR>v

"ale插件的提示
let g:ale_sign_column_always=1 "一直显示"
let g:ale_set_highlights = 0
let g:ale_sign_error='×'
let g:ale_sign_warning='~'
let g:ale_linters={'c++':['clang'], 'c':['clang']}
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

绛洞花主敏明

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值