-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
157 lines (138 loc) · 4.59 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
" Allows us to split and reuse configs with `runtime filename.vim`
scriptencoding utf-8
" :so ~/_vimrc " reloads vimrc, use in vim, not here, or quit and use `vis` if
" you have sessions setup
" Use `vim -u None file.txt` if big
" Use `gq` to format comments at textwidth
" Find and replace: use :%s/regex/replacement/g (or
" :%s#regex/path#replacement#g)
" For practice you may want to run on the current line with :s/ and then run
" g& afterwards when you're sure it's right
" g; to go to last change in the change list, g, to go to a newer
" gf opens file under cursor
" :X - Use encryption with current file
" :cq - quit mergetool with failure
" Test colours: :source $VIMRUNTIME/syntax/colortest.vim
"
" Gcd helps with the filenames issues if they use full rather than short paths
"
" https://github.com/junegunn/fzf.vim/issues/528#issuecomment-368260699
" cfdo and cdo
" Rg thing
" cdo s/thing/newthing/g | :w
"
" Thoughts on how to do interactive shell:
" 1. yank current selection to 'interactive' buffer
" 2. run current selection in interactive shell: https://stackoverflow.com/questions/40289706/execute-selection-from-script-in-vim
" - :'<,'>w !python
" 3. Do a setup in a project vimrc
" 4. Run buffer in interactive shell
"
" Normal mode in command line:
" https://stackoverflow.com/questions/7186880/using-normal-mode-motions-in-command-line-mode-in-vim
" C-f to open (set cedit=C-f)
" Enter to run the command and C-c will go back to standard cmd line
" <Tab> or C-X C-V will open auto complete
" :help c_ctrl-f
" ----------------------------------------------------------- Personal Help
runtime vim-help.vim
runtime vim-config.vim
" REPL + code execution
runtime vim-repl.vim
" Checkbox helper for markdown
runtime vim-checkbox.vim
" My own links plugin
" Should eventually superseed: knsh14/vim-github-link
runtime vim-links.vim
" project specific configs
runtime vim-projects.vim
"" --------------------------plugin settings
if has('nvim')
autocmd BufReadPost * if getfsize(@%) > 10000 | execute('NoMatchParen') | endif
else
runtime macros/matchit.vim
endif
if !exists('$VIM_VERY_FAST')
if !exists('$VIM_FAST')
" Specify a directory for plugins (for Neovim: ~/.local/share/nvim/plugged)
if filereadable(expand('~/.vim/autoload/plug.vim'))
call plug#begin()
runtime! vim-plugins.vim
call plug#end()
runtime! vim-plugins-after.vim
endif
else
" Copy paste of what's in vim-plugins.vim
call plug#begin()
if has('nvim')
Plug 'ishan9299/nvim-solarized-lua'
else
" For termguicolors
if !has('gui_running') && &term =~ '^\%(screen\|tmux\)'
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif
Plug 'altercation/vim-colors-solarized'
endif
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
let g:airline_extensions = []
let g:airline#extensions#branch#enabled=1
let g:airline#extensions#branch#empty_message='no repo'
let g:airline_theme='solarized'
" https://github.com/vim-airline/vim-airline-themes/issues/180#issue-471090136
let s:saved_theme = []
let g:airline_theme_patch_func = 'AirlineThemePatch'
function! AirlineThemePatch(palette)
for colors in values(a:palette)
if has_key(colors, 'airline_c') && len(s:saved_theme) ==# 0
let s:saved_theme = colors.airline_c
endif
if has_key(colors, 'airline_term')
let colors.airline_term = s:saved_theme
endif
endfor
endfunction
" end
call plug#end()
endif
else
set nocursorline
endif
" --------------- Finally colour scheme
if has('nvim')
if exists('g:started_by_firenvim')
set background=dark
silent! colorscheme tokyonight
else
if has("termguicolors")
set termguicolors
endif
set background=light
silent! colorscheme solarized
" we want vim to follow terminal background
hi Normal guibg=NONE
endif
else
syntax enable
" Set color scheme
set background=light
silent! colorscheme solarized
endif
" we want vim to follow terminal background
hi Normal ctermbg=NONE
if !has('nvim')
" https://github.com/airblade/vim-gitgutter/issues/696
hi! link SignColumn LineNr
endif
" overwrite colour scheme for folds
highlight Folded ctermfg=brown
" for MacVim, env vars
if $BAT_THEME == ""
" Normally use "GitHub" theme but since it doesn't support markdown, and
" macvim's primary purpose is to review markdown, use a different theme:
" https://github.com/sharkdp/bat/issues/1153
let $BAT_THEME = 'Monokai Extended Light'
endif
" Disable unsafe commands in project specific vimrc's
set secure