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.

181 lines
2.7 KiB

  1. """"
  2. " General Settings
  3. """"
  4. set history=500
  5. " File based settings and indentation
  6. filetype plugin on
  7. filetype indent on
  8. " Auto reload files
  9. set autoread
  10. " define a leader symbol
  11. let mapleader = ","
  12. let g:mapleader = ","
  13. " Fast saving
  14. nmap <leader>w :w!<cr>
  15. " :W sudo saves the file
  16. " Useful for avoiding permission-denied errors
  17. command W w !sudo tee % > /dev/null
  18. """"
  19. " VIM Interface Settings
  20. """"
  21. " set j/k to move by 7 lines
  22. set so=7
  23. " Enable the WiLd menu
  24. set wildmenu
  25. " Ignore compiled files
  26. set wildignore=*.o,*~,*.pyc
  27. set wildignore+=*/.git/*,*/.hg/*,*/.svn/*
  28. " Show the ruler
  29. set ruler
  30. " Command bar height should be 2 rows
  31. set cmdheight=2
  32. " Hide buffers when they're abandoned
  33. set hid
  34. " Configure backspace
  35. set backspace=eol,start,indent
  36. set whichwrap+=<,>,h,l
  37. " Ingore case while searching
  38. set ignorecase
  39. " Be smart about case while searching
  40. set smartcase
  41. " Highlight results
  42. set hlsearch
  43. " Search more like modern browsers
  44. set incsearch
  45. " Avoid redrawing during macros
  46. set lazyredraw
  47. " For regular expressions
  48. set magic
  49. " Show matching brackets
  50. set showmatch
  51. set mat=2
  52. " Disable annoying sounds
  53. set noerrorbells
  54. set novisualbell
  55. set t_vb=
  56. set tm=500
  57. " Extra column on the left
  58. set foldcolumn=1
  59. """"
  60. " Colors and Fonts
  61. """"
  62. " Enable syntax highlighting
  63. syntax enable
  64. " Optimize colors for a dark terminal
  65. set background=dark
  66. " Default to a utf8 encoding
  67. set encoding=utf8
  68. " Unix will be the default file type
  69. set ffs=unix,dos,mac
  70. """"
  71. " Text, Tab, Indent
  72. """"
  73. " Expand Tabs
  74. set expandtab
  75. " Smart Tabs
  76. set smarttab
  77. " Tabs are 4 spaces
  78. set shiftwidth=4
  79. set tabstop=4
  80. " 500 character max per line
  81. set lbr
  82. set tw=500
  83. " Auto Indent, Smart Indent and Line Wrapping
  84. set ai
  85. set si
  86. set wrap
  87. """"
  88. " Movement, Tabs, Buffers, Windows
  89. """"
  90. " Long lines are break lines
  91. map j gj
  92. map k gk
  93. " Better movement between windows
  94. map <C-j> <C-W>j
  95. map <C-k> <C-W>k
  96. map <C-h> <C-W>h
  97. map <C-l> <C-W>l
  98. """"
  99. " Status Line
  100. """"
  101. " Show the status line
  102. set laststatus=2
  103. " Format for the status line
  104. set statusline=\ %{HasPaste()}
  105. set statusline+=%F%m%r%h
  106. set statusline+=\ %y
  107. set statusline+=\ %w
  108. set statusline+=\ \ CWD:\ %r%{getcwd()}%h
  109. set statusline+=\ \ \ Line:\ %l.%c/%L
  110. """"
  111. " Spell Checking
  112. """"
  113. " Pressing ,ss will toggle spell checking
  114. map <leader>ss :setlocal spell!<cr>
  115. " Leader shortcuts
  116. map <leader>sn ]s " Next Spelling Mistake
  117. map <leader>sp [s " Previous Spelling Mistake
  118. map <leader>sa zg " Add Spelling
  119. map <leader>s? z= " Search Spelling
  120. """"
  121. " Misc
  122. """"
  123. " Toggle paste mode
  124. map <leader>pp :setlocal paste!<cr
  125. """"
  126. " Helper Functions
  127. """"
  128. " Returns true if paste mode is enabled
  129. function! HasPaste()
  130. if &paste
  131. return 'Paste Mode '
  132. endif
  133. return ''
  134. endfunction