[x,vim,spacemacs] switch back to gotham
[~bandali/configs] / vim / .vimrc
1 "set nocompatible " be iMproved, required
2 "filetype off " required
3
4 call plug#begin('~/.vim/plugged')
5
6 Plug 'kien/rainbow_parentheses.vim'
7 "Plug 'hsanson/vim-android'
8 Plug 'scrooloose/nerdcommenter'
9 Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
10 "Plug 'kien/ctrlp.vim'
11 "Plug 'tacahiroy/ctrlp-funky'
12 Plug 'Raimondi/delimitMate'
13 Plug 'Yggdroot/indentLine'
14 "Plug 'tpope/vim-fugitive'
15 Plug 'airblade/vim-gitgutter'
16 "Plug 'altercation/vim-colors-solarized'
17 Plug 'terryma/vim-multiple-cursors'
18 "Plug 'elzr/vim-json'
19 "Plug 'lervag/vim-latex'
20 Plug 'tpope/vim-surround'
21 Plug 'rust-lang/rust.vim'
22 Plug 'phildawes/racer'
23 Plug 'whatyouhide/vim-gotham'
24
25 call plug#end()
26
27
28 " Use the Solarized Dark theme
29 set background=dark
30 colorscheme gotham
31
32 " Make Vim more useful
33 set nocompatible
34 " Use the OS clipboard by default (on versions compiled with `+clipboard`)
35 set clipboard=unnamed
36 " Enhance command-line completion
37 set wildmenu
38 " Allow cursor keys in insert mode
39 set esckeys
40 " Allow backspace in insert mode
41 set backspace=indent,eol,start
42 " Optimize for fast terminal connections
43 set ttyfast
44 " Add the g flag to search/replace by default
45 set gdefault
46 " Use UTF-8 without BOM
47 set encoding=utf-8 nobomb
48 " Change mapleader
49 let mapleader=","
50 " Don’t add empty newlines at the end of files
51 set binary
52 set noeol
53 " Centralize backups, swapfiles and undo history
54 set backupdir=~/.vim/backups
55 set directory=~/.vim/swaps
56 if exists("&undodir")
57 set undodir=~/.vim/undo
58 endif
59 set undofile
60
61 " Don’t create backups when editing files in certain directories
62 set backupskip=/tmp/*,/private/tmp/*
63
64 " Respect modeline in files
65 set modeline
66 set modelines=4
67 " Enable per-directory .vimrc files and disable unsafe commands in them
68 set exrc
69 set secure
70 " Enable line numbers
71 set number
72 " Enable syntax highlighting
73 syntax on
74 " Highlight current line
75 "set cursorline
76 " Make tabs as wide as two spaces
77 set tabstop=4
78 " Show “invisible” characters
79 set lcs=tab:▸\ ,eol:\ \,nbsp:_
80 " set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_
81 set list
82 " Highlight searches
83 set hlsearch
84 " Ignore case of searches
85 set ignorecase
86 " Highlight dynamically as pattern is typed
87 set incsearch
88 " Always show status line
89 set laststatus=2
90 " Enable mouse in all modes
91 set mouse=a
92 " Disable error bells
93 set noerrorbells
94 " Don’t reset cursor to start of line when moving around.
95 set nostartofline
96 " Show the cursor position
97 set ruler
98 " Don’t show the intro message when starting Vim
99 set shortmess=atI
100 " Show the current mode
101 set showmode
102 " Show the filename in the window titlebar
103 set title
104 " Show the (partial) command as it’s being typed
105 set showcmd
106 " Use relative line numbers
107 if exists("&relativenumber")
108 set relativenumber
109 au BufReadPost * set relativenumber
110 endif
111 " Start scrolling three lines before the horizontal window border
112 set scrolloff=3
113
114 " Strip trailing whitespace (,ss)
115 function! StripWhitespace()
116 let save_cursor = getpos(".")
117 let old_query = getreg('/')
118 :%s/\s\+$//e
119 call setpos('.', save_cursor)
120 call setreg('/', old_query)
121 endfunction
122 noremap <leader>ss :call StripWhitespace()<CR>
123 " Save a file as root (,W)
124 noremap <leader>W :w !sudo tee % > /dev/null<CR>
125
126 " Automatic commands
127 if has("autocmd")
128 " Enable file type detection
129 filetype plugin indent on
130 " Treat .json files as .js
131 autocmd BufNewFile,BufRead *.json setfiletype json syntax=javascript
132 endif
133
134 " Enable pathogen
135 "execute pathogen#infect()
136
137 " swap ; and :
138 nnoremap ; :
139 nnoremap : ;
140 vnoremap ; :
141 vnoremap : ;
142
143 " relative line number stuff
144 function! NumberToggle()
145 if(&relativenumber == 1)
146 set number
147 else
148 set relativenumber
149 endif
150 endfunc
151 nnoremap <leader>n :call NumberToggle()<cr>
152 ":au FocusLost * :set number
153 ":au FocusGained * :set relativenumber
154 autocmd InsertEnter * :set number
155 autocmd InsertEnter * :set norelativenumber
156 autocmd InsertLeave * :set relativenumber
157 "autocmd InsertLeave * :set nonumber
158
159 " Rainbow Parantheses
160 au Syntax * RainbowParenthesesLoadRound
161 au Syntax * RainbowParenthesesLoadSquare
162 au Syntax * RainbowParenthesesLoadBraces
163 noremap <leader>m :RainbowParenthesesToggle<CR>
164
165
166 " ==== <UltiSnips> ====
167 " Trigger configuration. Do not use <tab> if you use
168 " https://github.com/Valloric/YouCompleteMe.
169 let g:UltiSnipsExpandTrigger="<tab>"
170 "let g:UltiSnipsJumpForwardTrigger="<c-b>"
171 let g:UltiSnipsJumpForwardTrigger="<tab>"
172 "let g:UltiSnipsJumpBackwardTrigger="<c-z>"
173 let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
174 " ==== </UltiSnips> ====
175
176 " Spaces FTW
177 set shiftwidth=4
178 set expandtab
179
180 "let g:ctrlp_map = '<space>'
181 let g:ctrlp_map = '<leader>p'
182 set wildignore+=*/build/**
183 let g:android_sdk_path= '/Applications/Android\ Studio.app/sdk/'
184 let g:android_adb_tool= '/Applications/Android\ Studio.app/sdk/platform-tools/adb'
185 let gradle_path= '~/.gradle/'
186 let g:android_build_type= 'gradle'
187
188 let delimitMate_expand_space=1
189 let delimitMate_expand_cr=2
190
191 let g:indentLine_enabled=1
192 "let g:indentLine_color_term = 239
193 "let g:indentLine_color_gui = '#09AA08'
194 "let g:indentLine_char = '│'
195 let g:indentLine_char = '¦'
196
197 " ctrlp {
198 if isdirectory(expand("~/.vim/bundle/ctrlp.vim/"))
199 let g:ctrlp_working_path_mode = 'ra'
200 nnoremap <silent> <D-t> :CtrlP<CR>
201 nnoremap <silent> <D-r> :CtrlPMRU<CR>
202 let g:ctrlp_custom_ignore = {
203 \ 'dir': '\.git$\|\.hg$\|\.svn$',
204 \ 'file': '\.exe$\|\.so$\|\.dll$\|\.pyc$' }
205
206 " On Windows use "dir" as fallback command.
207 if executable('ag')
208 let s:ctrlp_fallback = 'ag %s --nocolor -l -g ""'
209 elseif executable('ack-grep')
210 let s:ctrlp_fallback = 'ack-grep %s --nocolor -f'
211 elseif executable('ack')
212 let s:ctrlp_fallback = 'ack %s --nocolor -f'
213 else
214 let s:ctrlp_fallback = 'find %s -type f'
215 endif
216 let g:ctrlp_user_command = {
217 \ 'types': {
218 \ 1: ['.git', 'cd %s && git ls-files . --cached --exclude-standard --others'],
219 \ 2: ['.hg', 'hg --cwd %s locate -I .'],
220 \ },
221 \ 'fallback': s:ctrlp_fallback
222 \ }
223
224 if isdirectory(expand("~/.vim/bundle/ctrlp-funky/"))
225 " CtrlP extensions
226 let g:ctrlp_extensions = ['funky']
227
228 "funky
229 nnoremap <Leader>fu :CtrlPFunky<Cr>
230 endif
231 endif
232 "}
233 "
234
235 " change cursor shape based on mode
236 let &t_SI = "\<Esc>]50;CursorShape=1\x7"
237 let &t_EI = "\<Esc>]50;CursorShape=0\x7"
238
239 set pastetoggle=<leader>t
240
241 "set conceallevel=0
242 "let g:vim_json_syntax_conceal = 0
243 "let g:indentLine_noConcealCursor=""
244 " latex mode settings
245 let g:Tex_DefaultTargetFormat = "pdf"
246
247 set hidden
248 let g:racer_cmd = "racer"
249 let $RUST_SRC_PATH=expand('~/misc/rs/rust/src/')