-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
187 lines (161 loc) · 6.22 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
"------------------------------------------------------------------------------
" File: $HOME/.vimrc
" Author: Chaz Lever <https://github.com/chazlever>
"------------------------------------------------------------------------------
"------------------------------------------------------------------------------
" STANDARD STUFF
"------------------------------------------------------------------------------
set nocompatible " Disable vi compatibility
set showcmd " Display incomplete commands.
set showmode " Display the mode you're in.
set backspace=indent,eol,start " Intuitive backspacing.
set hidden " Handle multiple buffers better.
set wildmenu " Enhanced command line completion.
set wildmode=list:longest " Complete files like a shell.
set ignorecase " Case-insensitive searching.
set smartcase " But case-sensitive if expression contains a capital letter.
set number " Show line numbers.
set ruler " Show cursor position.
set incsearch " Highlight matches as you type.
set hlsearch " Highlight matches.
set wrap " Turn on line wrapping.
set scrolloff=3 " Show 3 lines of context around the cursor.
set title " Set the terminal's title
set visualbell " No beeping.
set nobackup " Don't make a backup before overwriting a file.
set nowritebackup " And again.
set directory=$HOME/.vim/tmp//,. " Keep swap files in one location
set tabstop=3 " Global tab width.
set shiftwidth=3 " And again, related.
set expandtab " Use spaces instead of tabs
set smarttab " Insert tabs according to tabstop, shiftwidth, and expandtab
set autoindent " Copy indentation from previous line
set laststatus=2 " Show the status line all the time
filetype plugin indent on " Turn on file type detection.
syntax enable " Turn on syntax highlighting.
" Define the characters to use for hidden characters
set nolist listchars=tab:>-,trail:.,nbsp:%,eol:$
" Enable mouse support if support available
if has('mouse')
set mouse=a
endif
"------------------------------------------------------------------------------
" CUSTOM FILETYPES
"------------------------------------------------------------------------------
au! BufRead,BufNewFile *.tex setfiletype tex
"------------------------------------------------------------------------------
" PLUGIN INSTALLATION
"------------------------------------------------------------------------------
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://github.com/raw/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin()
Plug 'sk1418/QFGrep'
Plug 'dense-analysis/ale'
Plug 'Shougo/deoplete.nvim'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-fugitive'
Plug 'preservim/vim-markdown'
Plug 'mzlogin/vim-markdown-toc'
Plug 'preservim/nerdtree'
Plug 'sheerun/vim-polyglot'
Plug 'derekwyatt/vim-scala'
Plug 'tpope/vim-sensible'
Plug 'esamattis/slimux'
Plug 'tpope/vim-surround'
Plug 'yegappan/taglist'
Plug 'christoomey/vim-tmux-navigator'
Plug 'tpope/vim-unimpaired'
Plug 'lervag/vimtex'
Plug 'dracula/vim', { 'as': 'dracula' }
call plug#end()
"------------------------------------------------------------------------------
" CONFIGURE COLOR SCHEME
"------------------------------------------------------------------------------
colorscheme dracula
let g:dracula_colorterm = 0
let g:dracula_italic = 0
set background=dark
"------------------------------------------------------------------------------
" CONFIGURE PLUGIN OPTIONS
"------------------------------------------------------------------------------
" Configure ALE
let g:ale_linters = {'tex': []}
" Configure vimtex plugin for use with Skim
let g:vimtex_view_method ='skim'
let g:vimtex_view_general_options = '@line @pdf @tex'
let g:vimtex_view_general_options_latexmk = '@line'
let g:vimtex_quickfix_open_on_warning = 0
let g:vimtex_quickfix_method = 'pplatex'
let g:tex_flavor = 'latex'
"------------------------------------------------------------------------------
" SET KEY MAPPINGS
"------------------------------------------------------------------------------
" Tab mappings.
map <leader>tt :tabnew<cr>
map <leader>te :tabedit
map <leader>tc :tabclose<cr>
map <leader>to :tabonly<cr>
map <leader>tn :tabnext<cr>
map <leader>tp :tabprevious<cr>
map <leader>tf :tabfirst<cr>
map <leader>tl :tablast<cr>
map <leader>tm :tabmove
" NERDTree Mappings
map <C-n><C-n> <Esc>:NERDTreeToggle<CR>
" Toggle search highlighting
map <Leader>h <Esc>:set hls!<CR>:echo "toggle search highlighting"<CR>
" Add mappings to remove trailing whitespace
map <Leader>s <Esc>:% s/\s\+$//g<CR>:noh<CR>:echo "removed trailing whitespace"<CR>
" Slimux Mappings
nnoremap <Leader>sl :SlimuxREPLSendLine<CR>
vnoremap <Leader>ss :SlimuxREPLSendSelection<CR>
nnoremap <leader>sb :SlimuxREPLSendBuffer<CR>
" Toggle taglist plugin
map <silent> <Leader>c <Esc>:TlistToggle<CR>
let Tlist_WinWidth=50
" Toggle paste option
function TogglePaste()
if &paste
set nopaste
else
set paste
endif
set paste ?
endfunction
map <Leader>p <Esc>:call TogglePaste()<CR>
" Toggle hidden characters
function ToggleHiddenChars()
if &list
set nolist
else
set list
endif
endfunction
map <silent> <Leader>l <Esc>:call ToggleHiddenChars()<CR>
" Toggle line number
function ToggleLineNumber()
if &number
set nonumber
else
set number
endif
endfunction
map <silent> <Leader>n <Esc>:call ToggleLineNumber()<CR>
" Toggle word wrap
function ToggleWordWrap()
if &wrap
set nowrap
else
set wrap
endif
endfunction
map <silent> <Leader>w <Esc>:call ToggleWordWrap()<CR>
" Quicker window movement
" url: https://github.com/thoughtbot/dotfiles/blob/master/vimrc
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l