-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
174 lines (148 loc) · 4.77 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
" Set the nocompatible options just in case
set nocompatible
" Load in vundle for some plugins
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim' " Plugin manager
Plugin 'lervag/vimtex' " LaTeX editor
Plugin 'JuliaEditorSupport/julia-vim' " Julia editor
Plugin 'ervandew/supertab' " Tab improvements
Plugin 'funorpain/vim-cpplint' " C++ linter
Plugin 'cespare/vim-toml' " TOML editor
Plugin 'dpelle/vim-LanguageTool' " Grammar checker
Plugin 'embear/vim-localvimrc' " Look for .lvimrc first
Plugin 'vim-python/python-syntax' " Python syntax
Plugin 'NLKNguyen/c-syntax.vim' " C syntax
Plugin 'NLKNguyen/papercolor-theme' " PaperColor theme
Plugin 'nvie/vim-flake8' " Flake8 formatter
Plugin 'ambv/black' " Black formatter
Plugin 'vim-airline/vim-airline' " Airline
if exists('copilot')
Plugin 'github/copilot.vim' " Copilot
endif
call vundle#end()
" Set the colorscheme
set t_Co=256
set background=dark
colorscheme PaperColor
"hi Normal ctermbg=black
let g:PaperColor_Theme_Options = {
\ 'language': {
\ 'python': {
\ 'highlight_all': 1,
\ 'highlight_builtins': 1
\ },
\ 'cpp': {
\ 'highlight_standard_library': 1
\ },
\ 'c': {
\ 'highlight_builtins': 1
\ }
\ }
\ }
" Turn on syntax highlighting
filetype off
filetype plugin indent on
syntax on
let g:python_highlight_all = 1
hi pythonBuiltinFunc ctermfg=37 cterm=bold
" Turn on highlight searching, and remove highlights using ctrl+c
set hlsearch
hi Search ctermbg=red
nnoremap <C-c> :noh<CR>
nnoremap <C-Tab> <Tab>
" Fix some fortran stuff
let fortran_have_tabs=1
let g:go_version_warning=0
" Turn on line numbers
set number
" Prevent wrapping of lines
set nowrap
" Turn wrapping back on for .md and .tex files
au BufRead,BufNewFile *.md set wrap
au BufRead,BufNewFile *.tex set wrap
" The only correct tab options
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set autoindent
set cindent
" Always have 10 lines below the cursor
set scrolloff=10
" Increase the timeout (this seems to help crashing when idle in an ssh)
set ttimeoutlen=100
" Set the mouse to be enabled (use shift for copy/pasting outside of vim)
set mouse=a
" Show current commands in bottom bar
set showcmd
" Make line status look better
set laststatus=2
set statusline=%F%m%r%h%w\ (%{&ff}){%Y}\ [%l,%v][%p%%]
" Stop all the whining
set noerrorbells
set visualbell t_vb=
" Turn spellcheck on for .tex and .md files (set to British English)
au BufRead,BufNewFile *.tex set spell spelllang=en_gb
au BufRead,BufNewFile *.md set spell spelllang=en_gb
au BufRead,BufNewFile *.tex set wrap
au BufRead,BufNewFile *.md set wrap
" Fix the syntax highlighting for .jl (julia) files
au BufRead,BufNewFile *.jl :set filetype=julia
" Restore cursor position (this seems to work by default on some platforms and
" not others)
augroup JumpCursorOnEdit
au!
autocmd BufReadPost *
\ if expand("<afile>:p:h") !=? $TEMP |
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ let JumpCursorOnEdit_foo = line("'\"") |
\ let b:doopenfold = 1 |
\ if (foldlevel(JumpCursorOnEdit_foo) > foldlevel(JumpCursorOnEdit_foo - 1)) |
\ let JumpCursorOnEdit_foo = JumpCursorOnEdit_foo - 1 |
\ let b:doopenfold = 2 |
\ endif |
\ exe JumpCursorOnEdit_foo |
\ endif |
\ endif
" Need to postpone using "zv" until after reading the modelines.
autocmd BufWinEnter *
\ if exists("b:doopenfold") |
\ exe "normal zv" |
\ if(b:doopenfold > 1) |
\ exe "+".1 |
\ endif |
\ unlet b:doopenfold |
\ endif
augroup END
" Remember some info between vim sessions
set viminfo='10,\"1000,:20,%,n~/.viminfo
" Turn on command menu
set wildmenu
set wildmode=list:longest
" Make sure backspace has desired behaviour
set backspace=indent,eol,start
" Enable unicode keymapping for all filetypes
"let g:latex_to_unicode_keymap = 1
let g:latex_to_unicode_file_types = ".*"
" Make w and q commands case-insensitive
:command WQA wqa
:command WQa wqa
:command Wqa wqa
:command WQ wq
:command Wq wq
:command W w
:command Q q
" Set autocorrect for my common types:
iab anf and
iab improt import
" Copilot options
imap <silent><script><expr> <C-j> copilot#Accept("\<CR>")
let g:copilot_no_tab_map = v:true
let g:copilot_node_command = "/usr/local/bin/node"
" Help with tmux getting the correct colours
"if exists("+termguicolors")
" let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
" let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
" set termguicolors
"endif