-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
157 lines (148 loc) · 4.31 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
" Plugins {{{
filetype off " required
call plug#begin('~/.vim/plugged')
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'junegunn/vim-easy-align'
Plug 'yegappan/lsp'
Plug 'majutsushi/tagbar'
Plug 'bling/vim-airline'
Plug 'chrisbra/csv.vim', { 'for': 'csv' }
Plug 'mhinz/vim-signify'
Plug 'tpope/vim-fugitive'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-unimpaired'
Plug 'thinca/dockerfile-vim'
Plug 'Keithbsmiley/rspec.vim', { 'for': 'ruby' }
Plug 'kien/ctrlp.vim'
Plug 'maralla/completor.vim'
Plug 'hashivim/vim-terraform'
Plug 'hashivim/vim-consul'
Plug 'hashivim/vim-packer'
Plug 'hashivim/vim-vagrant'
Plug 'cespare/vim-toml'
Plug 'junegunn/vim-emoji'
Plug 'w0rp/ale'
Plug 'leafgarland/typescript-vim'
call plug#end()
" }}}
" Whitespace {{{
set tabstop=4 " number of visual spaces per tab
set softtabstop=4 " number of spaces in tab when editing
set shiftwidth=4 " number of spaces to move with <</>>
" set textwidth=80
set expandtab " tabs are spaces
set smarttab " make <tab> insert indents correctly based on vim settings
set list lcs=tab:\|\
" }}}
" Colours {{{
set background=dark
colorscheme jellybeans
" }}}
" UI {{{
set nocompatible " Use Vim defaults instead of 100% vi compatibility
set history=50 " keep 50 lines of command line history
set number " show line numbers
set cursorline " highlight current line
set showmatch " Show matching brackets.
set ruler " show the cursor position all the time
filetype plugin indent on
" lower priority extensions for tab completion
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
" }}}
" Syntax {{{
syntax on
filetype plugin indent on
" Recognize exact file names as file types
au BufRead,BufNewFile {Gemfile,Vagrantfile,Berksfile} set ft=ruby
au BufRead,BufNewFile *.sls set ft=yaml
" }}}
" Searching {{{
set incsearch " search as characters are entered
set hlsearch " highlight searches
set ignorecase " Do case insensitive matching
set smartcase " Do smart case matching
" }}}
" Folding {{{
set foldenable " enable folding
set foldlevelstart=10 " open most folds by default
set foldnestmax=10 " 10 nexted folds max
nnoremap <space> za
set foldmethod=indent " default to indent folding
" should bind zr and zm to something. if only it was toggleable
" }}}
" Misc {{{
set modelines=1 " allow per-file vim configs
set lazyredraw " redraw when needed. speeds up macros
set backspace=indent,eol,start " more powerful backspacing
set swapfile
set dir=~/.local/tmp
"autocmd BufWritePre * :%s/\s\+$//e " auto-remove trailing whitespace
" jump to last position in file
if has('autocmd')
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" Disable mouse selection
set mouse-=a
" Make vim work on a mac
nmap <Esc>b <S-Left>
nmap <Esc>f <S-Right>
" Add ctrl+a/ctrl+e like in bash for 10keyless
nmap <C-a> <Home>
nmap <C-e> <End>
" Add W command to save as root
command W :execute ':silent w !sudo tee % > /dev/null' <bar> :edit!
" }}}
" Per-plugin configs
" NERDTree {{{
nmap <F8> :NERDTreeToggle<CR>
nmap <s-F8> :NERDTreeFind<CR>
" }}}
" vim-pyenv {{{
let g:pyenv#auto_activate = 1
" }}}
" Airline {{{
let g:airline#extensions#branch#enabled = 1
let g:airline_powerline_fonts = 1
set laststatus=2
" }}}
" Tagbar {{{
let g:tagbar_autoclose = 1
let g:tagbar_type_puppet = {
\ 'ctagstype': 'puppet',
\ 'kinds': [
\'c:class',
\'s:site',
\'n:node',
\'d:definition'
\]
\}
" Tab control keys
nmap <F9> :TagbarToggle<CR>
" }}}
" signify {{{
let g:signify_vcs_list = ['git'] " Ignore other VCS; improves load speed on non-VCS files being edited
" }}}
" LSP {{{
let g:lspServers = [
\ {
\ 'name': 'pylsp',
\ 'filetype': ['python'],
\ 'path': '/usr/bin/pylsp',
\ 'args': []
\ },
\ {
\ 'name': 'tsserver',
\ 'filetype': ['javascript', 'typescript'],
\ 'path': '/usr/local/bin/typescript-language-server',
\ 'args': ['stdio']
\ },
\ {
\ 'name': 'bashls',
\ 'filetype': 'sh',
\ 'path': '/usr/local/bin/bash-language-server',
\ 'args': ['start']
\ }
\]
autocmd! BufReadPre * g:LspAddServer(g:lspServers)
" vim:foldmethod=marker:foldlevel=0