-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
155 lines (138 loc) · 5.68 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
" GGGGGGGGGGGGG AAA
" GGG::::::::::::G A:::A
" GG:::::::::::::::G A:::::A
" G:::::GGGGGGGG::::G A:::::::A
" G:::::G GGGGGG A:::::::::A
" G:::::G A:::::A:::::A
" G:::::G A:::::A A:::::A
" G:::::G GGGGGGGGGG A:::::A A:::::A
" G:::::G G::::::::G A:::::A A:::::A
" G:::::G GGGGG::::G A:::::AAAAAAAAA:::::A
" G:::::G G::::G A:::::::::::::::::::::A
" G:::::G G::::G A:::::AAAAAAAAAAAAA:::::A
" G:::::GGGGGGGG::::G A:::::A A:::::A
" GG:::::::::::::::G A:::::A A:::::A
" GGG::::::GGG:::G A:::::A A:::::A
" GGGGGG GGGGAAAAAAA AAAAAAA
" GitHub: https://github.com/Giammy2094
"******************** General Settings *********************
set nocompatible " Vim defaults rather than vi ones. Keep at top.
filetype plugin indent on " Enable filetype-specific settings.
syntax on " Enable syntax highlighting.
set backspace=2 " Make the backspace behave as most applications.
set noerrorbells vb t_vb= " Disable error sounds
set autoindent " Use current indent for new lines.
set display=lastline " Show as much of the line as will fit.
set wildmenu " Better tab completion in the commandline.
set wildmode=list:longest " List all matches and complete to the longest match.
set showcmd " Show (partial) command in bottom-right.
set smarttab " Backspace removes 'shiftwidth' worth of spaces.
set number " Show line numbers.
set wrap " Wrap long lines.
set laststatus=2 " Always show the statusline.
set ruler " Show the ruler in the statusline.
set nrformats-=octal " Remove octal support from 'nrformats'.
set tabstop=4 " Size of a Tab character.
set shiftwidth=0 " Use same value as 'tabstop'.
set softtabstop=-1 " Use same value as 'shiftwidth'.
set clipboard=unnamed " Use system clipboard
set splitbelow " Open the new split below
set splitright " Open the new split below
set nobackup " Don't use backup
set nowritebackup " Don't write backup
set hidden " Avoid issues with TextEdit
set cmdheight=2 " Give more space for displaying messages
set updatetime=300 " Longer updatetime (default is 4000 ms) leads to delays
set shortmess+=c " Don't pass messages to ins-completion-menu
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
" Recently vim can merge signcolumn and number column into one
set signcolumn=number
" Enable folding
set foldmethod=indent
set foldlevel=99
let g:SimpylFold_docstring_preview=1
" Store temporary files in ~/vimfiles/tmp
set viminfo+=n~/vimfiles/tmp/viminfo
" set backupdir=$HOME/vimfiles/tmp/backup
set dir=$HOME/vimfiles/tmp/swap
set viewdir=$HOME/vimfiles/tmp/view
" if !isdirectory(&backupdir) | call mkdir(&backupdir, 'p', 0700) | endif
if !isdirectory(&dir) | call mkdir(&dir, 'p', 0700) | endif
if !isdirectory(&viewdir) | call mkdir(&viewdir, 'p', 0700) | endif
"******************** Python integration *******************************
set pythonthreedll=python39.dll " Specify python dll
set encoding=utf-8
let python_highlight_all=1
"******************** Vim-Plug *****************************************
" Install Vim-Plug
if empty(glob('~/vimfiles/autoload/plug.vim'))
silent !curl -fLo ~/vimfiles/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Vim-Plug plugins
call plug#begin('~/vimfiles/plugged')
" Colorscheme
Plug 'sainnhe/sonokai'
" NERDtree file browser
Plug 'scrooloose/nerdtree'
" Airline
Plug 'vim-airline/vim-airline'
" Folding plugin
Plug 'tmhedberg/SimpylFold'
" Linting
Plug 'dense-analysis/ale'
" Add closing brackets
Plug 'jiangmiao/auto-pairs'
" Git support
Plug 'tpope/vim-fugitive'
" Add fuzzy search
Plug 'junegunn/fzf.vim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
" LaTex support
Plug 'lervag/vimtex'
" Vim Wiki
Plug 'vimwiki/vimwiki'
call plug#end()
"******************** Package settings ************************************
"Colorschemes
if has('termguicolors')
set termguicolors
endif
let g:sonokai_style = 'maia'
let g:sonokai_better_performance = 1
let g:airline_theme = 'sonokai'
colorscheme sonokai
" ALE settings
let g:ale_linters = {
\ 'python': ['flake8', 'pylint'],
\}
" Airline uses Powerline
let g:airline_powerline_fonts = 1
set noshowmode
"******************** Remapped key-bindings *******************************
" Easy switching between splits using ctrl in normal mode
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>
" Easy switching between splits using ctrl in terminal
tmap <C-J> <C-W><C-J>
tmap <C-K> <C-W><C-K>
tmap <C-L> <C-W><C-L>
tmap <C-H> <C-W><C-H>
" Easier resizing
nnoremap <leader>- :resize -10<CR>
nnoremap <leader>+ :resize +10<CR>
" Folding with spacebar
nnoremap <space> za
" Fugitive remap
nmap <leader>gh :diffget //3<CR>
nmap <leader>gu :diffget //2<CR>
nmap <leader>gs :G<CR>
" NERDTree remap
nnoremap <C-n> :NERDTreeToggle<CR>
" Python run F9
autocmd FileType python map <buffer> <F9> :w<CR>:exec '!py' shellescape(@%, 1)<CR>
autocmd FileType python imap <buffer> <F9> <esc>:w<CR>:exec '!py' shellescape(@%, 1)<CR>