-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
167 lines (124 loc) · 7.83 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
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" ================ Plugins ==========================
call plug#begin('~/.vim/bundle')
" Navigation Plugins
Plug 'justinmk/vim-dirvish' " Directory viewer for Vim
Plug 'moll/vim-bbye' " Close files without messing up your layout
Plug 'tpope/vim-unimpaired' " pairs of handy bracket mappings
Plug '/usr/local/opt/fzf' " A command-line fuzzy finder
Plug 'junegunn/fzf.vim' " A command-line fuzzy finder
" Development Plugins
Plug 'ludovicchabant/vim-gutentags' " manages your tag files
Plug 'dense-analysis/ale' " Asynchronous Lint Engine
Plug 'ervandew/supertab' " use <Tab> for all your insert completion needs
" Git Plugins
Plug 'tpope/vim-fugitive' " Better git integration
Plug 'tpope/vim-rhubarb' " Needed for fugitive Gbrowse
Plug 'airblade/vim-gitgutter' " shows a git diff in the gutter
" Editor Plugins
Plug 'tpope/vim-sleuth' " Heuristically set buffer options
Plug 'editorconfig/editorconfig-vim',{'commit': '7f4e4df'} " EditorConfig plugin for Vim
Plug 'ntpeters/vim-better-whitespace' " Better whitespace highlighting for Vim
Plug 'junegunn/vim-easy-align' " A Vim alignment plugin
Plug 'tpope/vim-commentary' " comment stuff out
" Visual Plugins
Plug 'chriskempson/base16-vim' " An architecture for building themes
Plug 'vim-airline/vim-airline' " lean & mean status/tabline for vim
Plug 'vim-airline/vim-airline-themes' " A collection of themes for vim-airline
" Language Plugins
Plug 'fatih/vim-go' " Go development
call plug#end()
" ================ General Config ===================
set autoread " Reload files changed outside vim
set history=1000 " Store lots of :cmdline history
set hidden " Leave hidden buffers open
set clipboard=unnamed " Allow vim to use the system clipboard
set spelllang=en_us " Set spelling for US English
set nobackup " no backup files
set nowritebackup " no backup file while editing
set noswapfile " no swap files
set wildmenu " Better command-line completion
set wildmode=list:longest " List matches, complete longest common string
set incsearch " Find the next match as we type the search
set hlsearch " Highlight searches by default
set ignorecase " Ignore case when searching...
set smartcase " ...unless we type a capital
set backspace=2 " Allow backspace in insert mode
set scrolloff=8 " Scroll when 8 lines away from edge
set autoindent " Copy indent from current line when starting a new line
set smartindent " Inserts one extra level of indentation in some cases
set expandtab " <TAB> will insert 'softtabstop' amount of spaces
set shiftwidth=2 " Number of auto-indent spaces
set softtabstop=2 " Number of spaces per tab while editing
set tabstop=2 " Number of spaces per tab in a file
" Use rg for grepping
set grepprg=rg\ --smart-case\ --vimgrep\ --no-heading\ --hidden\ --glob\ '!.git'
" ================ Visual Config =====================
set visualbell " Visual alerts, not sounds
set showbreak=↪ " Visually distinguish wrapped lines
set cursorline " Highlight the current line
set showmatch " Highlight matching braces
set colorcolumn=120 " Highlight column width guide
set number " Show line numbers
set splitbelow " Split below for horizontal splits
set splitright " Split right for vertical splits
set showcmd " Show incomplete cmds at the bottom
set ruler " Show column and line at the bottom
set laststatus=2 " Show status line
set noshowmode " Hide current mode at the bottom
if !has("gui_running") " Compatible colors in shell
let base16colorspace=256
endif
syntax enable " Enable syntax coloring
set background=dark " Enable dark background colors
colorscheme base16-gruvbox-dark-medium " Enable colorscheme
set updatetime=250 " Quicker updates
set signcolumn=yes " Always show sign column
set guifont=FiraCodeNF-Ret:h14 " Set Font
if has("gui_macvim") " Enable ligutures in macvim
set macligatures
endif
" ================ Plugins Config ====================
let g:airline#extensions#tabline#enabled = 1 " Show buffers when one tab is open
let g:airline_powerline_fonts = 1 " Use powerline fonts in airline
let g:airline_theme='base16_gruvbox_dark_medium' " Matching airline theme
let g:go_fmt_command = "goimports" " Run goimports on save
autocmd FileType markdown EnableWhitespace " Enable better whitespace on md files
" ================ Custom Config =====================
" Automatically resize splits when resizing window
autocmd VimResized * wincmd =
" Spelling and wrapping for git commits
autocmd Filetype gitcommit setlocal spell textwidth=72
" Spelling for markdown
autocmd Filetype markdown setlocal spell
" Simple completion for markdown
autocmd FileType markdown inoremap <tab> <C-n>
autocmd FileType markdown inoremap <s-tab> <C-p>
" ================ Custom Mappings ===================
" Set leader to space
let mapleader = " "
" vim-go Mappings
autocmd FileType go nmap gr <Plug>(go-rename)
autocmd FileType go nmap gi <Plug>(go-info)
" EasyAlign Mappings
xmap ea <Plug>(EasyAlign)
nmap ea <Plug>(EasyAlign)
" Leader Mappings
nnoremap <leader>f :Files<CR>
nnoremap <leader>b :Buffers<CR>
nnoremap <leader>l :BLines<CR>
nnoremap <leader>t :BTags<CR>
nnoremap <Leader>r :Rg <CR>
nnoremap <leader>x :Bdelete<CR>
nnoremap <leader>X :Bdelete!<CR>
nnoremap <leader>ws :StripWhitespace<CR>
" Remap for easier split navigation
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Remap for easier movement with wrapping
nnoremap j gj
nnoremap k gk