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