-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathvimrc
137 lines (121 loc) · 4.91 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
"------------------------------------------------------------------------------
" Basic Recommended Settings
"------------------------------------------------------------------------------
if v:version >= 800
set nocompatible
syntax on
filetype plugin indent on
endif
"------------------------------------------------------------------------------
" Fallback for older Vim (comment out if unnecessary)
"------------------------------------------------------------------------------
" set nocompatible
" syntax enable
" filetype plugin on
" filetype indent on
"------------------------------------------------------------------------------
" Helper Function for Conditional Sourcing
"------------------------------------------------------------------------------
if has('vim9script')
def SourceIfExists(file: string)
if filereadable(expand(file))
execute 'source ' .. fnameescape(file)
endif
enddef
else
function! SourceIfExists(file) abort
if filereadable(expand(a:file))
execute 'source ' . fnameescape(a:file)
endif
endfunction
endif
"------------------------------------------------------------------------------
" Session / Directory Locations
"------------------------------------------------------------------------------
let g:SESSION_DIR = expand('$HOME/.cache/vim/sessions')
"------------------------------------------------------------------------------
" ALE Configuration
"------------------------------------------------------------------------------
let g:ale_set_loclist = 0
let g:ale_set_quickfix = 1
let g:ale_list_window_size = 5
let g:ale_lint_on_enter = 0
"------------------------------------------------------------------------------
" Buffer & File Handling
"------------------------------------------------------------------------------
" Allow switching away from unsaved buffers
set hidden
" Fix backspace behavior
set backspace=2
" Disable swap/backup files
set nobackup
set nowritebackup
set noswapfile
" Disable matchparen plugin (avoid glitchy behavior)
let g:loaded_matchparen = 1 " or use `:NoMatchParen`
" Automatically cd to directory of opened file
set autochdir
"------------------------------------------------------------------------------
" Clipboard Behavior
"------------------------------------------------------------------------------
if has('unnamedplus')
set clipboard=unnamedplus
else
set clipboard=unnamed
endif
"------------------------------------------------------------------------------
" Netrw Tweak
"------------------------------------------------------------------------------
augroup MyNetrwFix
autocmd!
" Fix netrw so that its buffer is hidden on exit
autocmd FileType netrw setlocal bufhidden=delete
augroup END
"------------------------------------------------------------------------------
" Truecolor Support (especially under tmux)
"------------------------------------------------------------------------------
if exists('+termguicolors')
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
endif
"------------------------------------------------------------------------------
" Source Additional Files (Plugins, Settings, etc.)
"------------------------------------------------------------------------------
call SourceIfExists('$HOME/.vim/plugin_loader.vim')
call plugin_loader#PlugInit()
call settings#LoadSettings()
call SourceIfExists('$HOME/.vim/settings/highlight.vim')
"------------------------------------------------------------------------------
" Color Schemes - Fallback Logic
"------------------------------------------------------------------------------
" Using an assumed function lib#ColorSchemeExists() to check if a scheme is present
if has('nvim') && exists('*lib#ColorSchemeExists') && lib#ColorSchemeExists('tokyonight-moon')
colorscheme tokyonight-moon
elseif exists('*lib#ColorSchemeExists') && lib#ColorSchemeExists('tokyonight')
colorscheme tokyonight
elseif exists('*lib#ColorSchemeExists') && lib#ColorSchemeExists('catppuccin_mocha')
colorscheme catppuccin_mocha
elseif exists('*lib#ColorSchemeExists') && lib#ColorSchemeExists('gruvbox')
colorscheme gruvbox
elseif exists('*lib#ColorSchemeExists') && lib#ColorSchemeExists('gruvbox-material')
let g:gruvbox_material_disable_italic_comment = 1
colorscheme gruvbox-material
elseif exists('*lib#ColorSchemeExists') && lib#ColorSchemeExists('everforest')
if has('termguicolors')
set termguicolors
endif
set background=dark
let g:everforest_background = 'hard'
let g:everforest_transparent_background = 2
let g:everforest_disable_italic_comment = 1
colorscheme everforest
elseif exists('*lib#ColorSchemeExists') && lib#ColorSchemeExists('desert-warm-256')
colorscheme desert-warm-256
else
colorscheme desert
endif
"------------------------------------------------------------------------------
" Local Customizations
"------------------------------------------------------------------------------
call SourceIfExists('$HOME/.vimrc.local')