Personal blog written from scratch using Node.js, Bootstrap, and MySQL. https://jrtechs.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

146 lines
3.4 KiB

  1. # Vim Configuration
  2. Stock vim is pretty boring.
  3. The good news is that vim has a very comprehensive configuration file which
  4. allows you to tweak it to your liking.
  5. To make changes to vim you simply modify the ~/.vimrc file in your home
  6. directory.
  7. By adding simple commands this file you can easily change the way your text editor looks.
  8. When most people get started with vim configurations, they will simply heave
  9. a few massive vim configurations into their vimrc file.
  10. In addition to basic vim configurations, there are also hundreds of plugins
  11. which you can install.
  12. The problem with shoveling a ton of stuff in your vim configuration and installing a ton
  13. of plugins is that it becomes a pain maintain.
  14. Making simple changes is more difficult when you have to wade through a sea of gobble
  15. gook configurations that you did not write.
  16. Also, if you have a ton of vim plugins it is difficult to transfer them to a new system
  17. since you have to look up how to install all the dependencies.
  18. When designing my vim configuration I decided to use the minimum amount
  19. configurations as possible to make vim the most usable for me.
  20. I feel that it is important for everyone to know exactly what every line of their
  21. vim configuration does.
  22. This will ensure that you are only adding the things that you want and you can
  23. customize it for your workflow.
  24. As a small disclaimer, I want to mention that I don't use vim as my primary
  25. IDE.
  26. When working on any large project I tend to use a JetBrains product or VSCode
  27. because of the auto complete functionality and code generation.
  28. There are great vim configurations out there on the internet; however, most
  29. tend to be a bit overkill for what most people want to do.
  30. # Spell Check
  31. ```vim
  32. autocmd BufRead,BufNewFile *.md setlocal spell spelllang=en_us
  33. autocmd BufRead,BufNewFile *.txt setlocal spell spelllang=en_us
  34. ```
  35. # Appearance
  36. ```vim
  37. syntax enable
  38. ```
  39. ```vim
  40. " Enable 256 colors palette in Gnome Terminal
  41. if $COLORTERM == 'gnome-terminal'
  42. set t_Co=256
  43. endif
  44. try
  45. colorscheme desert
  46. catch
  47. endtry
  48. set background=dark
  49. " Set extra options when running in GUI mode
  50. if has("gui_running")
  51. set guioptions-=T
  52. set guioptions-=e
  53. set t_Co=256
  54. set guitablabel=%M\ %t
  55. endif
  56. ```
  57. # Indentation and Tabs
  58. ```vim
  59. " search as characters are entered
  60. set incsearch
  61. " highlight matched characters
  62. set hlsearch
  63. " Ignore case when searching
  64. set ignorecase
  65. ```
  66. # Useful UI Tweaks
  67. ```vim
  68. " Set Line Numbers to show
  69. set number
  70. " Highlights the current line with a underscore
  71. set cursorline
  72. " Displays a red bar at 80 characters
  73. set colorcolumn=80
  74. ```
  75. # Searching and Auto Complete
  76. ```vim
  77. " Shows a auto complete tab when you are typing a command
  78. " like :sp <tab>
  79. set wildmenu
  80. set wildignorecase
  81. " Searching when in command mode type /words to find
  82. " search as characters are entered
  83. set incsearch
  84. " highlight matched characters
  85. set hlsearch
  86. " Ignore case when searching
  87. set ignorecase
  88. ```
  89. # Useful Things to Have
  90. ```vim
  91. "Disable ding sound on error, flashes cursor instead
  92. set visualbell
  93. " Display ruler on bottom right -- should be there by default
  94. set ruler
  95. " Enables mouse support
  96. set mouse=a
  97. " Auto updates file if an external source edits the file
  98. set autoread
  99. " Improves performance by only redrawing screen when needed
  100. set lazyredraw
  101. ```
  102. ```vim
  103. " Set utf8 as standard encoding and en_US as the standard language
  104. set encoding=utf8
  105. " Use Unix as the standard file type
  106. set ffs=unix,dos,mac
  107. ```