forked from danieluhl/dotfiles-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
129 lines (102 loc) · 3.32 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
let mapleader = " "
" set terminal title
set title
set titleold=""
set titlestring=vim\ %F
if $TERM =~# '^\%(screen\|tmux\)'
let &t_ts = "\e]2;" " Set pane title in tmux
endif
set backspace=2 " Backspace deletes like most programs in insert mode
set nobackup
set nowritebackup
set noswapfile " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287
set history=50
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set laststatus=2 " Always display the status line
set autowrite " Automatically :write before running commands
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
syntax on
endif
" Load bundles
if filereadable(expand("~/.vimrc.bundles"))
source ~/.vimrc.bundles
endif
" Colorscheme
colorscheme github
" Make it obvious where 80 characters is
set textwidth=80
set colorcolumn=+1
highlight ColorColumn ctermbg=255 guibg=#ECECEC
" Softtabs, 2 spaces
set tabstop=2
set shiftwidth=2
set shiftround
set expandtab
" Display extra whitespace
set list listchars=tab:»·,trail:·,nbsp:·
" Use one space, not two, after punctuation.
set nojoinspaces
" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher
if executable('ag')
" Use Ag over Grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag -Q -l --nocolor --hidden -g "" %s'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
" Numbers
set number
set numberwidth=5
set relativenumber
" Switch between the last two files
nnoremap <leader><leader> <c-^>
" Get off my lawn
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
" Open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
" Quicker window movement
let g:tmux_navigator_no_mappings = 1
let g:tmux_navigator_save_on_switch = 1
nnoremap <silent> <C-h> :TmuxNavigateLeft<cr>
nnoremap <silent> <C-j> :TmuxNavigateDown<cr>
nnoremap <silent> <C-k> :TmuxNavigateUp<cr>
nnoremap <silent> <C-l> :TmuxNavigateRight<cr>
nnoremap <silent> <C-\> :TmuxNavigatePrevious<cr>
" Set spellfile to location that is guaranteed to exist, can be symlinked to
" Dropbox or kept in Git and managed outside of thoughtbot/dotfiles using rcm.
set spellfile=$HOME/.vim-spell-en.utf-8.add
" Autocomplete with dictionary words when spell check is on
set complete+=kspell
" Always use vertical diffs
set diffopt+=vertical
" Startify Configuration
let g:startify_files_number = 5
let g:startify_bookmarks = [
\{'b': '~/src/our-boxen'},
\{'d': '~/dotfiles'},
\{'v': '~/.vimrc'},
\{'z': '~/.zshrc'}
\]
" Syntastic
let g:syntastic_check_on_open = 1 " Show linting errors immediately
let g:syntastic_javascript_checkers = ['eslint', 'flow']
" Avoid escape
:imap jj <Esc>
:imap jk <Esc>
:imap kk <Esc>
" Markdown
let g:markdown_fenced_languages = ['html', 'coffee', 'json', 'javascript',
\'js=javascript', 'python', 'bash=sh']
" Local config
if filereadable($HOME . "/.vimrc.local")
source ~/.vimrc.local
endif