[关闭]
@AlexWuYh 2022-06-10T14:27:35.000000Z 字数 3017 阅读 72

.vimrc

Linux vim


安装Vundle插件:

  1. git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

安装vim-plug:

  1. curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
  2. https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

自用vim配置文件备份

  1. " encoding dectection
  2. set fileencodings=utf-8,gb2312,gb18030,gbk,ucs-bom,cp936,latin1
  3. " Set vundle settings here
  4. " git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
  5. set nocompatible " be iMproved, required
  6. filetype off " required
  7. " set the runtime path to include Vundle and initialize
  8. set rtp+=~/.vim/bundle/Vundle.vim
  9. call vundle#begin()
  10. " alternatively, pass a path where Vundle should install plugins
  11. "call vundle#begin('~/some/path/here')
  12. " let Vundle manage Vundle, required
  13. "Plugin 'VundleVim/Vundle.vim' "https://github.com/VundleVim/Vundle.vim
  14. Bundle 'Valloric/YouCompleteMe'
  15. Plugin 'gmarik/Vundle.vim'
  16. " Custom plugins
  17. Plugin 'scrooloose/nerdtree' "https://github.com/scrooloose/nerdtree
  18. Plugin 'MattesGroeger/vim-bookmarks' "https://github.com/MattesGroeger/vim-bookmarks
  19. Plugin 'maciakl/vim-neatstatus' "https://github.com/maciakl/vim-neatstatus
  20. " All of your Plugins must be added before the following line
  21. call vundle#end() " required
  22. filetype plugin indent on " required
  23. " To ignore plugin indent changes, instead use:
  24. "filetype plugin on
  25. "
  26. " Brief help
  27. " :PluginList - lists configured plugins
  28. " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
  29. " :PluginSearch foo - searches for foo; append `!` to refresh local cache
  30. " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
  31. "
  32. " see :h vundle for more details or wiki for FAQ
  33. " Put your non-Plugin stuff after this line
  34. " Vim5 and later versions support syntax highlighting. Uncommenting the
  35. " following enables syntax highlighting by default.
  36. if has("syntax")
  37. syntax on " 语法高亮
  38. endif
  39. " Uncomment the following to have Vim jump to the last position when
  40. " reopening a file
  41. if has("autocmd")
  42. au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
  43. "have Vim load indentation rules and plugins according to the detected
  44. "filetype on
  45. "filetype plugin indent on
  46. endif
  47. set number
  48. set autoindent
  49. set softtabstop=4 " 设置软制表符的宽度
  50. set shiftwidth=4 " (自动) 缩进使用的4个空格
  51. set tabstop=4 " 设置制表符(tab键)的宽度
  52. set expandtab " 行首tab转换为4个空格
  53. set cindent " 使用 C/C++ 语言的自动缩进方式
  54. set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s "设置C/C++语言的具体缩进方式
  55. set showmatch " 设置匹配模式,显示匹配的括号
  56. set linebreak " 整词换行
  57. set whichwrap=b,s,<,>,[,] " 光标从行首和行末时可以跳到另一行去
  58. set ruler " 标尺,用于显示光标位置的行号和列号,逗号分隔。每个窗口都有自己的标尺。如果窗口有状态行,标尺在那里显示。否则,它显示在屏幕的最后一行上
  59. set showcmd " 命令行显示输入的命令
  60. set showmode " 命令行显示vim当前模式
  61. set incsearch " 输入字符串就显示匹配点
  62. set hlsearch
  63. set enc=utf-8 " 文件编码
  64. set cursorline
  65. set cursorcolumn
  66. highlight CursorLine cterm=NONE ctermbg=blue ctermfg=white guibg=NONE guifg=NONE
  67. "highlight CursorColumn cterm=NONE ctermbg=green ctermfg=NONE guibg=NONE guifg=NONE
  68. highlight CursorColumn cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white
  69. " NERDTree settings
  70. autocmd StdinReadPre * let s:std_in=1
  71. autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
  72. " vim-bookmarks settings
  73. let g:bookmark_auto_close = 1
  74. let g:bookmark_save_per_working_dir = 1
  75. let g:bookmark_highlight_lines = 1
  76. let g:bookmark_center = 1
  77. let g:bookmark_location_list = 1
  78. " key mapping
  79. :inoremap { {}<ESC>i
  80. :map <f2> :NERDTreeToggle<CR>
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注