.vimrc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. """"""""""""""""""""""""""""""""
  2. " General
  3. """"""""""""""""""""""""""""""""
  4. " Use pathogen https://github.com/tpope/vim-pathogen
  5. execute pathogen#infect()
  6. filetype plugin indent on
  7. " Use vim-sensible https://github.com/tpope/vim-sensible
  8. " for default settings.
  9. "set ruler " Enables the ruler
  10. "set autoindent " Add indentation of previous line
  11. "set backspace=indent,eol,start " Use Backspace more intuitively
  12. "set complete-=i " <C-P> <C-N> for previous and next completion
  13. "set smarttab " Tab at the beginning of line adds shiftwidth spaces
  14. "set nrformats-=octal " Don't use octal as nr format
  15. "set ttimeout " Set the timeout for mapped keybindings
  16. "set ttimeoutlen=100 " Set timeout to 100ms
  17. "set incsearch " Don't wait for <CR>, start searching right away.
  18. "nnoremap <silent> <C-L> :nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L>
  19. " <C-L> switches off search result highlighting
  20. "set laststatus=2 " Always draw the status line
  21. "set wildmenu " Show expansion candidates in status line
  22. "set scrolloff=2 " Minimum number of lines above and below cursor
  23. "set sidescrolloff=5 " Minimum number of columns to keep (only in nowrap)
  24. "set display+=lastline
  25. "set encoding=utf-8
  26. "set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
  27. "set formatoptions+=j " Delete comment characters when joining lines.
  28. "setglobal tags-=./tags tags-=./tags; tags^=./tags;
  29. "set shell=/bin/bash
  30. "set autoread " When a change is detected, auto reload the file
  31. "set history=1000
  32. "set tabpagemax=50
  33. "set viminfo^=!
  34. "set sessionoptions-=options
  35. "set t_Co=16
  36. "runtime! macros/matchit.vim
  37. "inoremap <C-U> <C-G>u<C-U>
  38. set backupdir=$HOME/.vim/backup_files//
  39. set directory=$HOME/.vim/swap_files//
  40. set undodir=$HOME/.vim/undo_files//
  41. " Use Syntastic https://github.com/vim-syntastic/syntastic
  42. " for syntax checks.
  43. let g:syntastic_javascript_checkers = ['standard']
  44. " JavaScript
  45. " Check syntax on write and fix formatting.
  46. autocmd bufwritepost *.js silent !standard --fix %
  47. " use , as map leader.
  48. let mapleader=","
  49. let g:mapleader=","
  50. " quick save with ,w
  51. nmap <leader>w :w!<cr>
  52. set cmdheight=2
  53. set hid
  54. set whichwrap+=<,>,h,l
  55. """""""""""
  56. " Searching
  57. """""""""""
  58. set hlsearch
  59. " ignore case when searching.
  60. set smartcase
  61. set lazyredraw
  62. set magic
  63. set showmatch
  64. set mat=2
  65. set noerrorbells
  66. set novisualbell
  67. set t_vb=
  68. set tm=500
  69. try
  70. colorscheme desert
  71. catch
  72. endtry
  73. set background=dark
  74. set ffs=unix,dos,mac
  75. set nobackup
  76. set nowb
  77. set noswapfile
  78. set expandtab
  79. set lbr
  80. set tw=500
  81. set smartindent
  82. set wrap
  83. " Keybindings
  84. map <leader>l :bnext<cr>
  85. map <leader>h :bprev<cr>
  86. map <leader>tn :tabnew<cr>
  87. map <leader>to :tabonly<cr>
  88. map <leader>tc :tabclose<cr>
  89. map <leader>tm :tabmove
  90. map <leader>t<leader> :tabnext<cr>
  91. set statusline=\ %F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l\ \ Column:\ %c
  92. map 0 ^
  93. set gdefault
  94. set number
  95. set background=dark
  96. set ffs=unix,dos,mac
  97. " Indentation
  98. set shiftwidth=2
  99. set softtabstop=2