-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
140 lines (122 loc) · 4.72 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
filetype off " required by Vundle
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin('~/.vim/bundle') " Calls vundle to use plugins
Plugin 'gmarik/Vundle.vim' " let Vundle manage Vundle, required
Plugin 'morhetz/gruvbox' " Colorscheme
Plugin 'haya14busa/incsearch.vim' " Better searching
Plugin 'christoomey/vim-tmux-navigator' " tmux window pane navigation
Plugin 'airblade/vim-gitgutter' " Shows changes from master on vim sidebar
Plugin 'vim-airline/vim-airline' " Airline setup
Plugin 'vim-airline/vim-airline-themes'
Plugin 'ctrlpvim/ctrlp.vim' " File manager
Plugin 'tpope/vim-surround' " Modifying quotes/brackets, etc
Plugin 'tpope/vim-commentary' " Commenting lines
Plugin 'w0rp/ale' "Linter
Plugin 'powerman/vim-plugin-viewdoc' " Documentation viewer
Plugin 'ludovicchabant/vim-gutentags' " Tags plugin
" Code completion
Plugin 'roxma/nvim-completion-manager'
if !has('nvim')
Plugin 'roxma/vim-hug-neovim-rpc'
endif
" All of your Plugins must be added before the following line
call vundle#end() " end of vundle plugins
filetype plugin indent on " enables filetype detection, plugin, and indentation scripts
" Setting the leader key
let mapleader ="\<space>"
" NOTE: 'noremap' makes the mapping nonrecursive (which is good to avoid
" conflicts and mapping infinite loops. 'n' or 'i' specifies the mode
" Maps 'ev' to open vimrc for edit
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
" Maps 'sv' to reload vimrc
nnoremap <leader>sv :source $MYVIMRC<cr>
" Maps '-' to delete the current line and paste it directly below
noremap <leader>- ddp
" Maps '_' to delete the current line and paste it directly after
noremap <leader>_ ddkP
" Maps " to surround a word with double quotes
nnoremap <leader>" viw<esc>a"<esc>bi"<esc>lel
" Maps ' to surround a word with single quotes
nnoremap <leader>' viw<esc>a'<esc>bi'<esc>lel
" Maps the window navigation commands such that you do not need to press <C-W>
" to use them
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-H> <C-W><C-H>
" Mappings to ensure tab selects completion option
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" Mapping for ALE to fix with F8
nmap <F8> <Plug>(ale_fix)
" System settings
augroup formatting
autocmd!
autocmd BufEnter * setlocal
\ formatoptions=t,c,q,j
\ formatoptions-=cro
" t = wrap text using textwidth
" c = wrap comments using textwidth
" q = allow formatting of comments with 'gq'
" j = remove comment character when joining comment lines
augroup END
set timeoutlen=1000 " Used to increase vim responsiveness
set ttimeoutlen=0
set backspace=indent,eol,start " Proper backspace behavior.
set ignorecase " Case insensitive searching
set smartcase " but become case sensitive if you type uppercase characters
" General file settings
set autoindent " Carry the indent to the next line
set textwidth=79 " How many characters per line
set expandtab " Turns tabs to spaces
set tabstop=4 " A tab counts for 4 spaces
set softtabstop=4 " Not sure but set it anyways
set shiftwidth=4 " Sets '>>' and '<<' to indent 4 spaces
" Visual stuff
set number " Line numbers
set background=dark " Use colors that look good on a dark background
syntax enable " Turns on syntax highlighting
set laststatus=2 " Always display statusline
set incsearch " search as characters are entered
set showmatch " shows matching bracket
" Colorscheme
colorscheme gruvbox
" Tmux cursor compatability settings
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_SR = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=2\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_SR = "\<Esc>]50;CursorShape=2\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
" Plugin specific settings
" Enable incsearch
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
" Airline Settings
let g:airline_powerline_fonts = 1
let g:airline#extensions#branch#enabled=1 " Shows git branch
let g:airline#extensions#ale#enabled = 1 " Shows ale warnings
" Ale settings
let g:ale_sign_column_always = 1 " Keeps gutter on
" Makes error signs more pleasant
let g:ale_sign_warning='●'
hi ALEErrorSign ctermfg=red ctermbg=none
let g:ale_sign_error='●'
hi ALEWarningSign ctermfg=yellow ctermbg=none
" Custom linting/fixing settings
let g:ale_fixers = {
\ 'python': [
\ 'remove_trailing_lines',
\ 'trim_whitespace',
\ 'yapf'
\ ],
\ 'javascript': [
\ 'remove_trailing_lines',
\ 'trim_whitespace',
\ 'eslint'
\ ]
\}