-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
188 lines (158 loc) · 5.9 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
scriptencoding utf-8
set encoding=utf-8
" https://github.com/VundleVim/Vundle.vim/issues/312
set shell=bash
set rtp+=~/.vim/bundle/Vundle.vim
" set rtp+=$GOROOT/misc/vim
" Vundle config https://github.com/gmarik/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'kien/ctrlp.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'bling/vim-airline'
Plugin 'scrooloose/syntastic'
Plugin 'elzr/vim-json'
Plugin 'vim-scripts/Vim-R-plugin'
Plugin 'LnL7/vim-nix'
Plugin 'fatih/vim-go'
call vundle#end()
filetype plugin indent on
"----------------------------------------------------------------------
"" Basic Options
"----------------------------------------------------------------------
"
set nocompatible " turn off vi shenanigans
let mapleader="\\" " default
set autoread " Reload files that have not been modified
set backspace=2 " Makes backspace not behave all retarded-like
set colorcolumn=80 " Highlight 80 character limit
set cursorline " Highlight the line the cursor is on
set hidden " Allow buffers to be backgrounded without being saved
set laststatus=2 " Always show the status bar
nmap <leader>l :set list!<CR> " To see invisible chars
set listchars=tab:▸\ ,eol:¬
set relativenumber " Show relative line numbers
set ruler " Show the line number and column in the status bar
set t_Co=256 " Use 256 colors
set scrolloff=999 " Keep the cursor centered in the screen
set showmatch " Highlight matching braces
set showmode " Show the current mode on the open buffer
set splitbelow " Splits show up below by default
set splitright " Splits go to the right by default
set title " Set the title for gvim
set visualbell " Use a visual bell to notify us
syntax on " Enable filetype detection by syntax
" Backup settings
let vimhomepath=$HOME . "/.vim"
execute "set directory=" . vimhomepath . "/swap"
execute "set backupdir=" . vimhomepath . "/backup"
execute "set undodir=" . vimhomepath . "/undo"
set backup
set undofile
set writebackup
"if isdirectory($HOME . '/.vim/swap') == 0
" :silent !mkdir -p ~/.vim/swap >/dev/null 2>&1
"endif
"set dir=~/.vim/swap
"
"if isdirectory($HOME . '/.vim/undo') == 0
" :silent !mkdir -p ~/.vim/undo > /dev/null 2>&1
"endif
" search
set hlsearch " Highlight results
set ignorecase " Ignore casing of searches
set incsearch " Start showing results as you type
set smartcase " Be smart about case sensitivity when searching
" tab settings
set expandtab tabstop=4 shiftwidth=4 softtabstop=4
" ruby files
:nmap \m :set expandtab tabstop=2 shiftwidth=2 softtabstop=2<CR>
" Tab completion settings
set wildmode=list:longest " Wildcard matches show a list, matching the longest first
set wildignore+=.git,.hg,.svn " Ignore version control repos
set wildignore+=*.6 " Ignore Go compiled files
set wildignore+=*.pyc " Ignore Python compiled files
set wildignore+=*.rbc " Ignore Rubinius compiled files
set wildignore+=*.swp " Ignore vim backups
" colors
Plugin 'flazz/vim-colorschemes'
colors zenburn
"----------------------------------------------------------------------
" Key Mappings
"----------------------------------------------------------------------
" Remap a key sequence in insert mode to kick me out to normal
" mode. This makes it so this key sequence can never be typed
" again in insert mode, so it has to be unique.
inoremap jj <esc>
inoremap jJ <esc>
inoremap Jj <esc>
inoremap JJ <esc>
inoremap jk <esc>
inoremap jK <esc>
inoremap Jk <esc>
inoremap JK <esc>
" Make j/k visual down and up instead of whole lines. This makes word
" wrapping a lot more pleasent.
:nmap j gj
:nmap k gk
" Shortcut to yanking to the system clipboard
map <leader>y "*y
map <leader>p "*p
" Toggle paste mode
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
" Save the file using C-s
command -nargs=0 -bar Update if &modified
\| if empty(bufname('%'))
\| browse confirm write
\| else
\| confirm write
\| endif
\|endif
nnoremap <silent> <C-S> :<C-u>Update<CR>
:inoremap <c-s> <c-o>:Update<CR>
" Command to write as root if we dont' have permission
cmap w!! %!sudo tee > /dev/null %
" Get rid of search highlights
noremap <silent><leader>/ :nohlsearch<cr>
" Expand in command mode to the path of the currently open file
cnoremap %% <C-R>=expand('%:h').'/'<CR>
" Buffer management
nnoremap <leader>d :bd<cr>
" windows management
:nmap <C-e> :e#<CR>
"----------------------------------------------------------------------
" Autocommands
"----------------------------------------------------------------------
" Clear whitespace at the end of lines automatically
"autocmd BufWritePre * :%s/\s\+$//e
" CtrlP settings
:nmap <leader>; :CtrlPBuffer<CR>
let g:ctrlp_max_files = 10000
"#let g:ctrlp_custom_ignore = '\v\~$|\.(o|swp|pyc|wav|mp3|ogg|blend|class)$|(^|[/\\])\.(hg|git|bzr|svn)($|[/\\])|__init__\.py'
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)|(target)$',
\ 'file': '\v\.(exe|so|dll|o|swp|pyc|wav|mp3|ogg|blend|class)$',
\ 'link': 'some_bad_symbolic_links',
\ }
let g:ctrlp_match_window_reversed = 0
let g:ctrlp_working_path_mode = 0
let g:ctrlp_dotfiles = 0
let g:ctrlp_switch_buffer = 0
" Nerd tree
:nmap <leader>e :NERDTreeTabsToggle<CR>
let NERDTreeIgnore = ['\.pyc$']
" Syntastic
" http://superuser.com/questions/302186/vim-scrolls-very-slow-when-a-line-is-to-long
set synmaxcol=80
"
:nnoremap <silent> <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>
" JSON
let g:vim_json_syntax_conceal = 0
" https://github.com/fatih/vim-go/issues/2365
let g:go_gopls_enabled = 0
"TODO's
"https://github.com/Lokaltog/vim-easymotion
"