Vim设置

傷城~ 2022-01-17 03:57 421阅读 0赞

为什么80%的码农都做不了架构师?>>> hot3.png

  1. " Make Vim more useful
  2. set nocompatible
  3. " Use the OS clipboard by default (on versions compiled with `+clipboard`)
  4. " Set color scheme!¬
  5. colorscheme candy
  6. set clipboard=unnamed
  7. " Enhance command-line completion
  8. set wildmenu
  9. " Allow cursor keys in insert mode
  10. set esckeys
  11. " Allow backspace in insert mode
  12. set backspace=indent,eol,start
  13. " Optimize for fast terminal connections
  14. set ttyfast
  15. " Add the g flag to search/replace by default
  16. set gdefault
  17. " Use UTF-8 without BOM
  18. set encoding=utf-8 nobomb
  19. " Change mapleader
  20. let mapleader=","
  21. " Don’t add empty newlines at the end of files
  22. set binary
  23. set noeol
  24. " Centralize backups, swapfiles and undo history
  25. set backupdir=~/.vim/backups
  26. set directory=~/.vim/swaps
  27. if exists("&undodir")
  28. set undodir=~/.vim/undo
  29. endif
  30. set viminfo+=! " make sure vim history works
  31. map <C-J> <C-W>j<C-W>_ " open and maximize the split below
  32. map <C-K> <C-W>k<C-W>_ " open and maximize the split above
  33. set wmh=0 " reduces splits to a single line
  34. " Enable per-directory .vimrc files and disable unsafe commands in them
  35. set exrc
  36. set secure
  37. " Enable syntax highlighting
  38. syntax on
  39. " Highlight current line
  40. set cursorline
  41. " Make tabs as wide as two spaces
  42. set tabstop=2
  43. " Enable line numbers
  44. set number
  45. " Show invisible characters
  46. set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_
  47. set list
  48. " Highlight searches
  49. set hlsearch
  50. " Ignore case of searches
  51. set ignorecase
  52. " Highlight dynamically as pattern is typed
  53. set incsearch
  54. " Always show status line
  55. set laststatus=2
  56. " Respect modeline in files
  57. set modeline
  58. set modelines=4
  59. " Enable mouse in all modes
  60. set mouse=a
  61. " Disable error bells
  62. set noerrorbells
  63. " Dont reset cursor to start of line when moving around.
  64. set nostartofline
  65. " Show the cursor position
  66. set ruler
  67. " Dont show the intro message when starting Vim
  68. set shortmess=atI
  69. " Show the current mode
  70. set showmode
  71. " Show the filename in the window titlebar
  72. set title
  73. " Show the (partial) command as it’s being typed
  74. set showcmd
  75. " Start scrolling three lines before the horizontal window border
  76. set scrolloff=3
  77. " Strip trailing whitespace (,ss)
  78. function! StripWhitespace()
  79. let save_cursor = getpos(".")
  80. let old_query = getreg('/')
  81. :%s/\s\+$//e
  82. call setpos('.', save_cursor)
  83. call setreg('/', old_query)
  84. endfunction
  85. noremap <leader>ss :call StripWhitespace()<CR>
  86. " Save a file as root (,W)
  87. noremap <leader>W :w !sudo tee % > /dev/null<CR>
  88. " Automatic commands
  89. if has("autocmd")
  90. " Enable file type detection
  91. filetype on
  92. " Treat .json files as .js
  93. autocmd BufNewFile,BufRead *.json setfiletype json syntax=javascript
  94. endif

转载于:https://my.oschina.net/imot/blog/368027

发表评论

表情:
评论列表 (有 0 条评论,421人围观)

还没有评论,来说两句吧...

相关阅读

    相关 vim字符编码设置

    vim 编码方式的设置 和所有的流行文本编辑器一样,Vim 可以很好的编辑各种字符编码的文件,这当然包括UCS-2、UTF-8 等流行的 Unicode 编码方式。然而不幸

    相关 vim颜色设置

    vim 都是 通过 hi 这个命令来设置 例:设置关键字为蓝色非粗体 : hi Identifier ctermfg=blue cterm=none(bold 就设置成粗体

    相关 Vim设置

    [为什么80%的码农都做不了架构师?>>> ][80_] ![hot3.png][] " Make Vim more useful set nocompati

    相关 Vim设置鼠标模式

    有时候我们会在win下面远程到linux系统,此时用vim修改部分代码。如果想使用xshell中自带的复制快捷键是被禁止的,这个时候我们可以通过修改鼠标模式的方法来达到这种目的