-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.vimrc
More file actions
357 lines (296 loc) · 7.88 KB
/
.vimrc
File metadata and controls
357 lines (296 loc) · 7.88 KB
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
" =====================================
" Basic config
" =====================================
set nocompatible
" Set scroll in all modes
set mouse=a
set modelines=0
" 256 colours
set termguicolors
hi LineNr ctermbg=NONE guibg=NONE
" Disable warning message on swp files
set shortmess+=A
" Disable visual bell
set belloff=all
set backspace=indent,eol,start
" Toggle line numbers
set invnumber
" Highlight search matches
set hlsearch
" Start searching immediately
set incsearch
" Case sensitive searches
set ignorecase
set smartcase
" Highlight matching braces
set showmatch
" Hidden buffers
set hidden
" Vim fast rendering
set ttyfast
" Display command output
set showcmd
" Indentation rules
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
syntax enable
let g:status_hidden = 2
set noruler
set laststatus=2
autocmd FileType typescript setlocal ts=2 sts=2 sw=2
au BufNewFile,BufRead *.go setlocal tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab
" =====================================
" Key mappings
" =====================================
" Remap leader to ,
let mapleader=","
" Remap ESC to kj
inoremap kj <Esc>
" Remap W to w
command! W w
" Remap Noh to noh
command! Noh noh
" Remap keys for vim-test
nmap <silent> <leader>t :TestNearest<CR>
nmap <silent> <leader>T :TestFile<CR>
nmap <silent> <leader>l :TestLast<CR>
" ,L to toggle line numbers
nmap <leader>L :set invnumber<CR>
" Increase vim pane resizing size, as the default is quite low.
nmap <C-w>+ :resize +15<CR>
nmap <C-w>- :resize -15<CR>
nmap <C-w>> :vertical resize +15<CR>
nmap <C-w>< :vertical resize -15<CR>
" Fzf-lua remappings
nnoremap <leader>f :lua require("fzf-lua").files()<CR>
nnoremap <leader>g :lua require("fzf-lua").grep_project()<CR>
command! Buffers :lua require("fzf-lua").buffers()<CR>
" Remap gS to toggle split/join
nnoremap gS :TSJToggle<CR>
" Remap gq to gw (LSP overrides formatexpr, breaking gq for text wrapping)
nnoremap gq gw
xnoremap gq gw
" Disable status bar by default, as it's rarely useful.
nnoremap <leader>S :call ToggleStatusBar()<CR>
" Custom strategy for vim-test to allow jest to recognize `debugger`.
command! TestDebug :call ExecuteTestDebug()
" Dirvish aliases
let g:loaded_netrwPlugin = 1
command Explore execute "normal \<Plug>(dirvish_up)"
command Exp execute "normal \<Plug>(dirvish_up)"
command Ex execute "normal \<Plug>(dirvish_up)"
" =====================================
" Custom funcs
" =====================================
function! ToggleStatusBar()
if g:status_hidden
let g:status_hidden = 0
set laststatus=0
else
let g:status_hidden = 1
set laststatus=2
endif
endfunction
" =====================================
" Plugin mgmt
" =====================================
lua <<EOF
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--branch=stable", -- latest stable release
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{ 'junegunn/fzf', build = './install --all' },
'ibhagwan/fzf-lua',
'tpope/vim-commentary',
'janko-m/vim-test',
'benmills/vimux',
'christoomey/vim-tmux-navigator',
'aud/strip-trailing-whitespace.vim',
'justinmk/vim-dirvish',
{ 'roginfarrer/vim-dirvish-dovish', branch = 'main' },
{ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' },
{ 'nvim-treesitter/nvim-treesitter-textobjects', branch = 'main' },
'RRethy/nvim-treesitter-endwise',
'Wansmer/treesj',
'ibhagwan/smartyank.nvim',
-- {
-- "ellisonleao/gruvbox.nvim",
-- priority = 1000,
-- config = true,
-- opts = ...,
-- },
{
'sainnhe/gruvbox-material',
lazy = false,
priority = 1000,
config = function()
-- Optionally configure and load the colorscheme
-- directly inside the plugin declaration.
vim.g.gruvbox_material_enable_italic = true
vim.g.gruvbox_material_background = 'hard'
vim.cmd.colorscheme('gruvbox-material')
end
},
{
"github/copilot.vim"
}
})
EOF
" MITM debug
" let g:copilot_proxy = 'http://localhost:8080'
" let g:copilot_proxy_strict_ssl = v:false
" let g:copilot_settings = #{ selectedCompletionModel: 'gpt-4o-copilot' }
" let g:copilot_integration_id = 'vscode-chat'
" =====================================
" Theme
" =====================================
" lua <<EOF
" require("gruvbox").setup({
" terminal_colors = true, -- add neovim terminal colors
" undercurl = true,
" underline = true,
" bold = true,
" italic = {
" strings = true,
" emphasis = true,
" comments = true,
" operators = false,
" folds = true,
" },
" strikethrough = true,
" invert_selection = false,
" invert_signs = false,
" invert_tabline = false,
" invert_intend_guides = false,
" inverse = true, -- invert background for search, diffs, statuslines and errors
" contrast = "", -- can be "hard", "soft" or empty string
" palette_overrides = {},
" overrides = {},
" dim_inactive = false,
" transparent_mode = false,
" })
" vim.o.background = "dark"
" vim.cmd("colorscheme gruvbox")
" EOF
" lua <<EOF
" vim.cmd("colorscheme nightfox")
" EOF
" Change dashed seperator to line. This needs to run after the colorscheme is
" set, otherwise it will be clobbered.
set fillchars+=vert:│
" =====================================
" Plugin configuration
" =====================================
" git-messenger:
"
" https://github.com/rhysd/git-messenger.vim#ggit_messenger_always_into_popup-default-vfalse
let g:git_messenger_always_into_popup = v:true
" vim-test:
"
" Output to vimux
let test#strategy = 'vimux'
" =====================================
" Lsp
" =====================================
lua <<EOF
vim.lsp.config('ruby-lsp', {
cmd = {'/Users/elliot/.gem/ruby/3.4.3/bin/ruby-lsp'},
filetypes = {'ruby', 'eruby'},
})
vim.lsp.enable('ruby-lsp')
vim.lsp.config('copilot', {
cmd = { 'bun', 'run', 'copilot-language-server', '--stdio' },
})
vim.lsp.enable('copilot')
vim.diagnostic.config({
virtual_text = true, -- Show errors inline
signs = true, -- Show signs in gutter (the red E)
underline = true, -- Underline errors
update_in_insert = false,
severity_sort = true,
float = {
border = 'rounded',
source = 'always',
},
})
EOF
" =====================================
" Treesitter config
" =====================================
lua <<EOF
require('nvim-treesitter.configs').setup {
ensure_installed = "all",
ignore_install = { "norg" },
sync_install = false,
auto_install = true,
highlight = {
enable = true,
},
endwise = {
enable = true,
},
}
EOF
lua <<EOF
-- =====================================
-- Smartyank
-- =====================================
-- https://github.com/ibhagwan/smartyank.nvim
require('smartyank').setup({
highlight = {
enabled = false,
},
})
EOF
lua <<EOF
-- =====================================
-- Treesitter [splitjoin]
-- =====================================
require('treesj').setup({
max_join_length = 500,
})
EOF
lua <<EOF
-- =====================================
-- Fzf lua
-- =====================================
require("fzf-lua").setup({
fzf_bin = "fzf-tmux",
-- Docs: `fzf-tmux --help`
fzf_tmux_opts = {
-- We need to reset `-p`, as the default from the fzf-lua plugin conflicts
-- when the `-d` option is set. See
-- https://github.com/ibhagwan/fzf-lua/issues/865
["-p"] = false,
["-d"] = "20%",
},
winopts = {
preview = {
hidden = "hidden"
}
},
-- https://github.com/ibhagwan/fzf-lua/wiki#how-do-i-get-maximum-performance-out-of-fzf-lua
files = {
git_icons = false,
file_icons = false,
}
})
EOF
lua <<EOF
-- Ensure we reset the cursor to blinking line on exit. Otherwise we get into
-- a weird case where the bar seems to clobber the $TERM (ghostty) bar.
vim.api.nvim_create_autocmd("VimLeave", {
command = "set guicursor=a:ver25-blinkon1"
})
EOF