-
Notifications
You must be signed in to change notification settings - Fork 1
/
vimrc
171 lines (139 loc) · 4.08 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
set langmenu=en_US.UTF-8
set nocompatible " be iMproved, required
set number " shows line numbers
set cursorline " highlight cursor line
set laststatus=2 " this is needed for airline
" let &colorcolumn="100,".join(range(120,256),",")" " column with 100
set wildmenu
set wildmode=list:longest,full " expand and folders/tabs when opening a file
set backspace=2 " makes backspace work as it should work
set mouse=a
set wildignore+=*/public/*,*/tmp/*,*/deps/*
set clipboard=unnamed " copy to clipboard (works on mac)
filetype off " required
let mapleader=","
" Plug setup
call plug#begin()
Plug 'flazz/vim-colorschemes'
Plug 'bling/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'MaxMEllon/vim-jsx-pretty'
Plug 'elixir-editors/vim-elixir'
Plug 'honza/vim-snippets'
Plug 'isRuslan/vim-es6'
Plug 'leshill/vim-json'
Plug 'pangloss/vim-javascript'
Plug 'airblade/vim-gitgutter'
Plug 'DataWraith/auto_mkdir'
Plug 'jiangmiao/auto-pairs'
Plug 'sickill/vim-pasta'
Plug 'ervandew/supertab'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-projectionist'
Plug 'c-brenn/fuzzy-projectionist.vim'
Plug 'caironoleto/vim-projectionist-elixir'
Plug 'vim-autoformat/vim-autoformat'
call plug#end()
" End Plug setup
"
" use 'flazz/vim-colorschemes'
" 'Tomorrow-Night-Bright'
syntax on
filetype on
filetype plugin indent on " required
" Color scheme
" colorscheme molokai
colorscheme Tomorrow-Night-Bright
" set background=dark
hi Normal guibg=NONE ctermbg=NONE
" let g:solarized_contrast="low"
" let g:solarized_menu=0
" let g:tmuxline_theme = 'iceberg'
" Airline config
let g:airline_theme='molokai'
let g:airline_powerline_fonts = 1
let g:airline_section_y = 0
let g:airline#extensions#branch#enabled = 0
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#fileformat#enabled = 0
" tags
" set tags=./.tags;,~/.vimtags
" ctags
map <silent> <Leader>rt :!retag<cr>
" Set indentation
set expandtab
set shiftwidth=2
set softtabstop=2
set tabstop=2
" Set folding
set foldenable
set foldlevelstart=10
set foldnestmax=10
set foldmethod=indent
" Display tabs and trailing spaces visually
set list listchars=tab:\ \ ,trail:·
" Turn Off Swap Files
set noswapfile
set nobackup
set nowb
" scrolling
set scrolloff=8 "Start scrolling when we're 8 lines away from margins
set sidescrolloff=15
set sidescroll=1
" search
set incsearch " Find the next match as we type the search
set hlsearch " Highlight searches by default
set smartcase " ...unless we type a capital
" ==== NERD tree
" " Open the project tree and expose current file in the nerdtree with Ctrl-\
nnoremap <silent> <C-\> :NERDTreeFind<CR>:vertical<CR>
let NERDTreeIgnore = ['build$']
"Move back and forth through previous and next buffers
"with ,z and ,x
nnoremap <silent> ,z :bp<CR>
nnoremap <silent> ,x :bn<CR>
" opens/closes folds
nnoremap <Space> za
" ,q to toggle quickfix window (where you have stuff like Ag)
" ,oq to open it back up (rare)
nmap <silent> ,qc :cclose<CR>
nmap <silent> ,qo :copen<CR>
function! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces()
" shortcuts for changing windows
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" Resize
nnoremap <silent> <Leader>+ :exe "resize " . (winheight(0) * 3/2)<CR>
nnoremap <silent> <Leader>- :exe "resize " . (winheight(0) * 2/3)<CR>
" Javascript config
let g:javascript_plugin_flow = 1
let g:jsx_ext_required = 0
" Snips config
"
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
let g:UltiSnipsEditSplit="vertical"
" Vim move config
"
let g:move_key_modifier = 'C'
" vim-autoformat configs
"
let g:python3_host_prog="~/.asdf/shims/python3"
let g:autoformat_autoindent = 0
let g:autoformat_retab = 0
let g:autoformat_remove_trailing_spaces = 0
au BufWrite * :Autoformat