-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
150 lines (121 loc) · 4.19 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
" :PlugList - lists configured plugins
" :PlugInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PlugSearch foo - searches for foo; append `!` to refresh local cache
" :PlugClean - confirms removal of unused plugins; append `!` to auto-approve removal
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
Plug 'dense-analysis/ale'
Plug 'flazz/vim-colorschemes'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'moll/vim-bbye'
Plug 'ryanoasis/vim-devicons'
Plug 'scrooloose/nerdtree'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'xolox/vim-misc'
Plug 'Yggdroot/indentLine'
" initialize plugin system
call plug#end()
set encoding=UTF-8
" map leader to the space key
let mapleader = "\<space>"
" store swap files in fixed location, not current directory.
set swapfile
set dir=~/.vim/swap//,/var/tmp//,/tmp//,.
" store temporary files in a fixed location, not current directory
set backup
set backupdir=~/.vim/backup//,/var/tmp//,/tmp//,.
" set tab size
set tabstop=4 " The width of a TAB is set to 4.
" Still it is a \t. It is just that
" Vim will interpret it to be having
" a width of 4.
set shiftwidth=4 " Indents will have a width of 4
set softtabstop=4 " Sets the number of columns for a TAB
set expandtab " Expand TABs to spaces
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" color scheme
syntax enable
colorscheme badwolf
set relativenumber
set number
set cursorline
set incsearch hlsearch
set scrolloff=4
" Allow changing of buffers even with unsaved changes
set hidden
set confirm
" Toggle paste mode
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
set showmode
" NerdTree mapping
map <C-n> :NERDTreeToggle<CR>
" Allow NerdTree to start without path
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" Close the tab if NERDTree is the only window remaining in it.
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" Use ripgrep over grep
if executable("rg")
set grepprg=rg\ --vimgrep\ --smart-case\ --hidden
set grepformat=%f:%l:%c:%m
endif
" bind K to grep word under cursor
nnoremap <leader>k :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
let g:airline_powerline_fonts = 1
" Automatically displays all buffers when there's only one tab open
let g:airline#extensions#tabline#enabled = 2
" Just show the filename (no path) in the tab
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline_theme='badwolf'
" Switch between windows, maximizing the current window
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" Buffers - next/previous/delete
map gn :bn<cr>
map gp :bp<cr>
map gd :Bdelete<cr>
" PrettyPrint commands
command! PrettyPrintJSON %!python -m json.tool
command! PrettyPrintHTML !tidy -miq -html -wrap 0 %
command! PrettyPrintXML !tidy -miq -xml -wrap 0 %
" fzf mappings
nmap <Leader>b :Buffers<CR>
nmap <Leader>f :Files<CR>
nmap <Leader>h :History<CR>
nmap <Leader>l :Lines<CR>
" indentLine character
let g:indentLine_char = '⦙'
let g:ale_sign_error = '✘'
let g:ale_sign_warning = ''
highlight ALEErrorSign ctermbg=NONE ctermfg=red
highlight ALEWarningSign ctermbg=NONE ctermfg=yellow
let g:ale_linters_explicit = 1
let g:ale_lint_on_text_changed = 'never'
let g:ale_lint_on_enter = 0
let g:ale_lint_on_save = 1
let g:ale_fix_on_save = 1
let g:ale_linters = {
\ 'markdown': ['markdownlint'],
\ 'json': ['jq'],
\ 'xml': ['xmllint'],
\}
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'markdown': ['prettier'],
\ 'json': ['prettier'],
\ 'xml': ['prettier'],
\}
let g:vim_json_conceal=0
let g:markdown_syntax_conceal=0