-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
161 lines (132 loc) · 4.05 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
" Pathogen
execute pathogen#infect()
" Store temporary files in a central spot
set backupdir=~/.vim-tmp,/tmp
set directory=~/.vim-tmp,/tmp
" mappings
let mapleader="\\"
set nocompatible " choose no compatibility with legacy vi
set encoding=utf-8
set showcmd " display incomplete commands
filetype plugin indent on " load file type plugins + indentation
set number
set t_Co=256
set background=dark
" whitespace
set nowrap " don't wrap lines
set tabstop=2
set shiftwidth=2 " a tab is two spaces (or set this to 4)
set expandtab " use spaces, not tabs (optional)
set backspace=indent,eol,start " backspace through everything in insert mode
set cindent " smart indent
set autoindent
" searching
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
" theme
syntax enable
" set cursorline " highlight current line
set cursorcolumn
set list " turn on invisible characters
set listchars=tab:▸\ ,trail:• " which characters to highlight
nmap <leader>l :call ToggleList()<cr>
function! ToggleList()
if &list
setlocal nolist
echo "Whitespace highlight off"
else
setlocal list
echo "Whitespace highlight on"
endif
endfunction
"" set theme based on time
"let colorflag = system("cat /tmp/terminalcolor")
"if colorflag == 1
" set background=light
"else " Set to dark from 7pm to 7am
" set background=dark
"endif
" vim-airline
let g:airline_powerline_fonts = 1
" window
set laststatus=2 " always show status line
set showtabline=2 " always show tab bar
set winwidth=84 "
set colorcolumn=80 " highlight at 80 characters
set mouse=a
set noea
" tabs
nmap <leader>[ :tabp<cr>
nmap <leader>] :tabn<cr>
nmap T :tabnew<cr>
" toggle spaces vs tabs
nmap <leader>t :call ToggleTabsVsSpaces()<cr>
function! ToggleTabsVsSpaces()
if &expandtab
setlocal noet ci pi sts=0 sw=4 ts=4
echo "No expand tabs"
else
setlocal et ci pi sts=0 sw=2 ts=2
echo "Expand tabs"
endif
endfunction
" navigate buffers
nmap <C-n> :bnext<CR>
nmap <C-b> :bprev<CR>
nmap <leader>q :BW<CR>
" remove whitespace
map <leader>s :%s/\s\+$//<CR>
" clear the search buffer
nnoremap <CR> :nohlsearch<cr>
" retain indent when pasting code
nnoremap <leader>pt :set invpaste paste?<CR>
set pastetoggle=<leader>pt
set showmode
" NERDTree
" autocmd StdinReadPre * let s:std_in=1
map <leader>N :NERDTreeToggle<CR>
let g:Tlist_WinWidth=60
" replace quotes
map <leader>rq :%s/\"\([^"]*\)\"/'\1'/g<CR>
" tab autocomplete
set wildmenu
set wildmode=longest,list
" highlight colors
hi NoneText ctermbg=NONE cterm=NONE ctermfg=6
hi SpecialKey ctermbg=NONE cterm=NONE ctermfg=6
" puppet plugin options
let g:puppet_align_hashes = 1
" increment next/previous number
nnoremap + <C-a>
nnoremap - <C-x>
" run buffer in python
nnoremap <buffer> <leader>r :exec '!clear;python3' shellescape(@%, 1)<cr>
" some useful Ruby filetype settings
augroup RubyShenanigans
au!
autocmd BufRead,BufNewFile Gemfile,Rakefile,Capfile,Vagrantfile
\ set filetype=ruby
" disable swapfile
set noswapfile
" sections (a, b, c, x, y, z, warn) are optional
"let g:promptline_preset = {
" \'b' : [ promptline#slices#user() ],
" \'c' : [ promptline#slices#cwd() ],
" \'y' : [ promptline#slices#vcs_branch(), promptline#slices#git_status() ],
" \'warn' : [ promptline#slices#last_exit_code() ]}
"
" let g:solarized_termcolors= 256
" let g:solarized_termtrans = 1
" let g:solarized_degrade = 1
let g:solarized_bold = 1
let g:solarized_underline = 1
let g:solarized_italic = 1
let g:solarized_contrast = "high"
let g:solarized_visibility= "high"
" let g:jedi#rename_command = "<leader>rn"
colorscheme solarized
let g:indentLine_char = '│'
set ruler
let g:python_pep8_indent_hang_closing = 1