赞
踩
- set fileencodings=utf-8,gb2312,gbk,gb18030
- set termencoding=utf-8
- set encoding=utf-8
- set gfn=Consolas:h12 "字体,大小
- "=============================================================================
- " vim 内置配置
- "==============================================================================
- " 设置 vimrc 修改保存后立刻生效,不用在重新打开
- " 配置完成后将这个关闭
- autocmd BufWritePost $MYVIMRC source $MYVIMRC
- filetype off
- " 关闭兼容模式
- set nocompatible
- set showcmd "显示命令行
- set backspace=indent,eol,start
- set clipboard+=unnamed
- set nu " 设置行号
- set cursorline "突出显示当前行
- " set cursorcolumn " 突出显示当前列
- set showmatch " 显示括号匹配
- set backspace=2
- " tab 缩进
- set tabstop=4 " 设置Tab长度为4空格
- set shiftwidth=4 " 设置自动缩进长度为4空格
- set noswapfile "不生成swap文件
- set autoindent " 继承前一行的缩进方式,适用于多行注释
- set ruler "打开状态栏标尺
- set laststatus=2 "总是显示状态行
- set showtabline=2 "标签栏的显示,0永远不显示 1两个以上显示 2 永远显示
- set statusline=%F%m%r%h%w\[POS=%l,%v][%p%%]\%{strftime(\"%d/%m/%y\ -\ %H:%M\")} "我的状态行显示的内容(包括文件类型和解码)
- set hlsearch "搜索时高亮显示被找到的文本
- set foldmethod=syntax "代码折叠
- set fdm=indent "代码折叠
- set foldlevel=100 "启动vim时不要自动折叠代码
- nnoremap <space> zo "代码折叠快捷键
- let autosave=15 "15s,自动保存文件" 定义快捷键的前缀,即<Leader>
- let mapleader=","
- nnoremap <silent> <Leader>w :WMToggle <CR>
- " ==== 系统剪切板复制粘贴 ====
- " v 模式下复制内容到系统剪切板
- vmap <Leader>c "+yy
- " n 模式下复制一行到系统剪切板
- nmap <Leader>c "+yy
- " n 模式下粘贴系统剪切板的内容
- nmap <Leader>v "+p
-
- imap <F9> <C-x><C-o>
-
- " 开启实时搜索
- set incsearch
- " 搜索时大小写不敏感
- set ignorecase
- syntax enable
-
- :inoremap ( ()<ESC>i
- :inoremap ) <c-r>=ClosePair(')')<CR>
- :inoremap { {<CR>}<ESC>O
- :inoremap } <c-r>=ClosePair('}')<CR>
- :inoremap [ []<ESC>i
- :inoremap ] <c-r>=ClosePair(']')<CR>
- :inoremap " ""<ESC>i
- :inoremap ' ''<ESC>i
- function! ClosePair(char)
- if getline('.')[col('.') - 1] == a:char
- return "\<Right>"
- else
- return a:char
- endif
- endfunction
- " 退出插入模式指定类型的文件自动保存
- au InsertLeave *.go,*.sh,*.php write
-
- "==============================================================================
- " Plugin
- "==============================================================================
- " set the runtime path to include Vundle and initialize
- set rtp+=~/.vim/bundle/Vundle.vim
- call vundle#begin()
- Plugin 'VundleVim/Vundle.vim'
- " Install Vim-go
- Plugin 'fatih/vim-go'
- Plugin 'tpope/vim-fugitive'
- Plugin 'scrooloose/nerdtree'
- Plugin 'majutsushi/tagbar'
- Plugin 'Valloric/YouCompleteMe'
- " 代码自动完成,安装完插件还需要额外配置才可以使用
- "Plugin 'ycm-core/YouCompleteMe'
- call vundle#end() " required
- "==============================================================================
- " 主题配色
- "==============================================================================
- " 开启24bit的颜色,开启这个颜色会更漂亮一些
- " set termguicolors
- " 配色方案, 可以从上面插件安装中的选择一个使用
- "colorscheme one " 主题
- "set background=dark " 主题背景 dark-深色; light-浅色
-
- filetype plugin indent on
-
- syntax on " 开启文件类型侦测
- "==============================================================================
- " vim-go 插件
- "==============================================================================
- let g:go_fmt_command = "goimports" " 格式化将默认的 gofmt 替换
- let g:go_debug=['shell-commands']
- let g:go_metalinter_command = "golangci-lint" "语法校验
- let g:go_autodetect_gopath = 1
- let g:go_list_type = "quickfix"
-
- let g:go_version_warning = 1
- let g:go_highlight_types = 1
- let g:go_highlight_fields = 1
- let g:go_highlight_functions = 1
- let g:go_highlight_function_calls = 1
- let g:go_highlight_operators = 1
- let g:go_highlight_extra_types = 1
- let g:go_highlight_methods = 1
- let g:go_highlight_generate_tags = 1
-
- let g:godef_split=2
-
- " vim-go custom mappings
- "au FileType go nmap <Leader>s <Plug>(go-implements)
- "au FileType go nmap <Leader>i <Plug>(go-info)
- "au FileType go nmap <Leader>gd <Plug>(go-doc)
- "au FileType go nmap <Leader>gv <Plug>(go-doc-vertical)
- "au FileType go nmap <leader>r <Plug>(go-run)
- "au FileType go nmap <leader>b <Plug>(go-build)
- "au FileType go nmap <leader>t <Plug>(go-test)
- "au FileType go nmap <leader>c <Plug>(go-coverage)
- "au FileType go nmap <Leader>ds <Plug>(go-def-split)
- "au FileType go nmap <Leader>dv <Plug>(go-def-vertical)
- "au FileType go nmap <Leader>dt <Plug>(go-def-tab)
- "au FileType go nmap <Leader>e <Plug>(go-rename)
- "==============================================================================
- " auto-pairs 插件
- "==============================================================================
- "let g:AutoPairsFlyMode = 0
- "let g:AutoPairsShortcutBackInsert = '<M-b>'
-
- "==============================================================================
- " NERDTree 插件
- "==============================================================================
- " 打开和关闭NERDTree快捷键
- map <F3> :NERDTreeToggle<CR>
- nnoremap <silent> <Leader>n :NERDTreeToggle <CR>
- " 显示行号
- "let NERDTreeShowLineNumbers=1
- " 打开文件时是否显示目录
- let NERDTreeAutoCenter=0
- " 是否显示隐藏文件
- let NERDTreeShowHidden=0
- " 设置宽度
- let NERDTreeWinSize=25
- " 忽略一下文件的显示
- let NERDTreeIgnore=['\.pyc','\~$','\.swp']
- " 打开 vim 文件及显示书签列表
- let NERDTreeShowBookmarks=2
- " 在终端启动vim时,共享NERDTree
- let g:nerdtree_tabs_open_on_console_startup=1
-
- "==============================================================================
- " majutsushi/tagbar 插件
- "==============================================================================
- " majutsushi/tagbar 插件打开关闭快捷键
- nmap <F12> :TagbarToggle<CR>
- "nnoremap <silent> <Leader>t :TagbarToggle <CR>
- "nmap <F12>tb :TagbarToggle<CR>
- let g:tagbar_ctags_bin='/usr/bin/ctags'
- let g:tagbar_width=30
- "autocmd BufReadPost *.go,*.cpp,*.c,*.h,*.hpp,*.cc,*.cxx call tagbar#autoopen()
- let g:tagbar_type_go = {
- \ 'ctagstype' : 'go',
- \ 'kinds' : [
- \ 'p:package',
- \ 'i:imports:1',
- \ 'c:constants',
- \ 'v:variables',
- \ 't:types',
- \ 'n:interfaces',
- \ 'w:fields',
- \ 'e:embedded',
- \ 'm:methods',
- \ 'r:constructor',
- \ 'f:functions'
- \ ],
- \ 'sro' : '.',
- \ 'kind2scope' : {
- \ 't' : 'ctype',
- \ 'n' : 'ntype'
- \ },
- \ 'scope2kind' : {
- \ 'ctype' : 't',
- \ 'ntype' : 'n'
- \ },
- \ 'ctagsbin' : 'gotags',
- \ 'ctagsargs' : '-sort -silent'
- \ }
- "==============================================================================
- " nerdtree-git-Plugin 插件
- "==============================================================================
- let g:NERDTreeGitStatusIndicatorMapCustom = {
- \ "Modified" : "✹",
- \ "Staged" : "✚",
- \ "Untracked" : "✭",
- \ "Renamed" : "➜",
- \ "Unmerged" : "═",
- \ "Deleted" : "✖",
- \ "Dirty" : "✗",
- \ "Clean" : "✔︎",
- \ 'Ignored' : '☒',
- \ "Unknown" : "?"
- \ }
-
- let g:NERDTreeGitStatusShowIgnored = 1
-
- "==============================================================================
- " Valloric/YouCompleteMe 插件
- "==============================================================================
- let g:ycm_server_python_interpreter='/usr/bin/python3.6'
- let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'
- "是否开启语义补全"
- let g:ycm_seed_identifiers_with_syntax=1
- "是否在注释中也开启补全"
- let g:ycm_complete_in_comments=1
- let g:ycm_collect_identifiers_from_comments_and_strings = 0
- "开始补全的字符数"
- let g:ycm_min_num_of_chars_for_completion=2
- "补全后自动关机预览窗口"
- let g:ycm_autoclose_preview_window_after_completion=1
- " 禁止缓存匹配项,每次都重新生成匹配项"
- let g:ycm_cache_omnifunc=0
- "字符串中也开启补全"
- let g:ycm_complete_in_strings = 1
- let g:ycm_show_diagnostics_ui = 0 "关闭语法提示
- let g:ycm_complete_in_comments=1 " 补全功能在注释中同样有效
- let g:ycm_confirm_extra_conf=0 " 允许 vim 加载 .ycm_extra_conf.py 文件,不再提示
- let g:ycm_collect_identifiers_from_tags_files=1 " 开启 YCM 标签补全引擎
- let g:ycm_min_num_of_chars_for_completion=1 " 从第一个键入字符就开始罗列匹配项
- let g:ycm_cache_omnifunc=0 " 禁止缓存匹配项,每次都重新生成匹配项
- let g:ycm_seed_identifiers_with_syntax=1 " 语法关键字补全
- let g:ycm_goto_buffer_command = 'horizontal-split' " 跳转打开上下分屏
- "离开插入模式后自动关闭预览窗口"\
- autocmd InsertLeave * if pumvisible() == 0|pclose|endif
- "回车即选中当前项"
- "inoremap <expr> <CR> pumvisible() ? '<C-y>' : '\<CR>'
-
- " better key bindings for UltiSnipsExpandTrigger
- "let g:UltiSnipsExpandTrigger = "<tab>"
- "let g:UltiSnipsJumpForwardTrigger = "<tab>"
- "let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
-
- "==============================================================================
- " easymotion/vim-easymotion
- "==============================================================================
- "let g:EasyMotion_do_mapping = 0 " Disable default mappings"
- " --暂时停用下面一行 @kevin 2019-7-18
- "let g:EasyMotion_leader_key = '<Space>'
- " Bi-directional find motion
- " Jump to anywhere you want with minimal keystrokes, with just one key binding.
- " `s{char}{label}`
- " --暂时停用下面一行 @kevin 2019-7-18
- "map s <Plug>(easymotion-s)
- " or
- " `s{char}{char}{label}`
- " Need one more keystroke, but on average, it may be more comfortable.
- ""nmap s <Plug>(easymotion-s2)
- ""map t <Plug>(easymotion-t2)
-
- " Turn on case insensitive feature
- "let g:EasyMotion_smartcase = 0
-
- " JK motions: Line motions
- "map <Leader>j <Plug>(easymotion-j)
- "map <Leader>k <Plug>(easymotion-k)
- " search
- "map // <Plug>(easymotion-sn)
- "omap // <Plug>(easymotion-tn)
-
- "==============================================================================
- " ctrlp插件
- "==============================================================================
- map <F2> :CtrlPMixed <CR>
- let g:ctrlp_by_filename = 0
- let g:ctrlp_regexp=1
- let g:ctrlp_working_path_mode = 'rw'
- let g:ctrlp_working_path_mode="ra"
- let g:ctrlp_lazy_update=1
- let g:ctrlp_use_caching=1
- let g:ctrlp_cache_dir=$HOME.'/.vim/.cache/ctrlp'
- let g:ctrlp_clear_cache_on_exit=1
- let g:ctrlp_max_depth=20
- let g:ctrlp_max_height=15
- set wildignore+=*/.git/*,*/.hg/*,*/.svn/*
- let g:ctrlp_custom_ignore={
- \ 'dir': '\v[\/]\.(git|hg|svn)$',
- \ 'file': '\v\.(exe|so|dll|a|o|tar|tar.gz|pyc|zip)$',
- \ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
- \ }
- "==============================================================================
- " 多标签支持(minibuf)
- "==============================================================================
- let g:miniBufExplMapWindowNavVim=1
- let g:miniBufExplMapWindowNavArrows=1
- let g:miniBufExplMapCTabSwitchBufs=1
- let g:miniBufExplModSelTarget=1
- let g:miniBufExplorerMoreThanOne=0
- hi MBEVisibleActive guifg=#A6DB29 guibg=fg
- hi MBEVisibleChangedActive guifg=#F1266F guibg=fg
- hi MBEVisibleChanged guifg=#F1266F guibg=fg
- hi MBEVisibleNormal guifg=#5DC2D6 guibg=fg
- hi MBEChanged guifg=#CD5907 guibg=fg
- hi MBENormal guifg=#808080 guibg=fg
-
- "==============================================================================
- " 其他插件配置
- "==============================================================================
- " markdwon 的快捷键
- map <silent> <F5> <Plug>MarkdownPreview
- map <silent> <F6> <Plug>StopMarkdownPreview
-
- " tab 标签页切换快捷键
- :nn <Leader>1 1gt
- :nn <Leader>2 2gt
- :nn <Leader>3 3gt
- :nn <Leader>4 4gt
- :nn <Leader>5 5gt
- :nn <Leader>6 6gt
- :nn <Leader>7 7gt
- :nn <Leader>8 8gt
- :nn <Leader>9 8gt
- :nn <Leader>0 :tablast<CR>
- set t_Co=256
- colorscheme molokai
- "colorscheme one
- set background=dark " 主题背景 dark-深色; light-浅色
molokai安装:.vim文件夹下新建colors文件夹,新建文件molokai.vim
gcc-8.5:CentOS 編譯安裝 gcc/c++ 8.5
CMake导入第三方库 及 新Centos7环境配置 2022.7.1记_凉巷少年与狸猫的博客-CSDN博客
复制以下配置:
https://github.com/tomasr/molokai/blob/master/colors/molokai.vim
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。