summaryrefslogtreecommitdiff
path: root/vim/.vimrc
diff options
context:
space:
mode:
authorSerguey Parkhomovsky <xindigo@gmail.com>2026-03-26 23:03:36 -0700
committerSerguey Parkhomovsky <xindigo@gmail.com>2026-03-26 23:03:36 -0700
commit24a5be6da36ace8c967394459acf9149467e0297 (patch)
treef941dc321e4ba06b1a9f802477f426e0f0d0cb16 /vim/.vimrc
parent6402ffe78c02fc32b627e3500527a4b027528b44 (diff)
go back to regular old vim
Diffstat (limited to 'vim/.vimrc')
-rw-r--r--vim/.vimrc136
1 files changed, 136 insertions, 0 deletions
diff --git a/vim/.vimrc b/vim/.vimrc
new file mode 100644
index 0000000..8b964e0
--- /dev/null
+++ b/vim/.vimrc
@@ -0,0 +1,136 @@
+" ~/.vimrc — Vim 9 configuration
+" Requires: vim-plug, rust-analyzer in PATH, fzf binary
+
+" ── Bootstrap vim-plug ────────────────────────────────────────────────────────
+let s:plug_path = expand('~/.vim/autoload/plug.vim')
+if !filereadable(s:plug_path)
+ silent execute '!curl -fLo ' .. s:plug_path .. ' --create-dirs '
+ \ .. 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
+ autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
+endif
+
+" ── Plugins ───────────────────────────────────────────────────────────────────
+call plug#begin()
+
+Plug 'yegappan/lsp'
+Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
+Plug 'junegunn/fzf.vim'
+Plug 'ghifarit53/tokyonight-vim'
+Plug 'vim-airline/vim-airline'
+Plug 'vim-airline/vim-airline-themes'
+
+call plug#end()
+
+" ── General settings ──────────────────────────────────────────────────────────
+filetype plugin indent on
+syntax enable
+
+set number
+set signcolumn=yes
+set updatetime=300
+set hidden
+
+set tabstop=4
+set shiftwidth=4
+set expandtab
+
+set ignorecase
+set smartcase
+set incsearch
+set hlsearch
+
+set splitbelow
+set splitright
+set scrolloff=8
+
+set clipboard=unnamedplus
+set mouse=a
+
+" ── File clutter ───────────────────────────────────────────────────────────────
+set nobackup
+set nowritebackup
+let &directory = expand('~/.vim/swap//')
+silent! call mkdir(expand('~/.vim/swap'), 'p', 0700)
+set undofile
+let &undodir = expand('~/.vim/undo//')
+silent! call mkdir(expand('~/.vim/undo'), 'p', 0700)
+
+" ── Colors ────────────────────────────────────────────────────────────────────
+set termguicolors
+let g:tokyonight_style = 'night'
+colorscheme tokyonight
+
+" ── LSP (yegappan/lsp) ────────────────────────────────────────────────────────
+" g:LspOnSetup is called by the User LspSetup autocmd below.
+" Variables must be defined and consumed inside the same function call —
+" they cannot be captured by an inner autocmd in a def function.
+def g:LspOnSetup()
+ var lspServers = [
+ {
+ name: 'rust',
+ filetype: ['rust'],
+ path: 'rust-analyzer',
+ syncInit: true,
+ }
+ ]
+
+ g:LspAddServer(lspServers)
+enddef
+
+autocmd User LspSetup call g:LspOnSetup()
+
+" LSP keymaps (only when LSP is active)
+autocmd FileType rust {
+ nnoremap <buffer> gd <Cmd>LspGotoDefinition<CR>
+ nnoremap <buffer> gD <Cmd>LspGotoDeclaration<CR>
+ nnoremap <buffer> gi <Cmd>LspGotoImpl<CR>
+ nnoremap <buffer> gr <Cmd>LspShowReferences<CR>
+ nnoremap <buffer> gy <Cmd>LspGotoTypeDef<CR>
+ nnoremap <buffer> K <Cmd>LspHover<CR>
+ nnoremap <buffer> <space>r <Cmd>LspRename<CR>
+ nnoremap <buffer> <space>a <Cmd>LspCodeAction<CR>
+ nnoremap <buffer> <space>f <Cmd>LspFormat<CR>
+ nnoremap <buffer> <space>d <Cmd>LspDiagShow<CR>
+ nnoremap <buffer> [d <Cmd>LspDiagPrev<CR>
+ nnoremap <buffer> ]d <Cmd>LspDiagNext<CR>
+ nnoremap <buffer> <space>o <Cmd>LspOutline<CR>
+ nnoremap <buffer> <space>i <Cmd>LspInlayHints toggle<CR>
+}
+
+" ── Search ────────────────────────────────────────────────────────────────────
+nnoremap <Esc> <Cmd>nohlsearch<CR>
+
+" ── Window navigation ──────────────────────────────────────────────────────────
+nnoremap <C-h> <C-w>h
+nnoremap <C-j> <C-w>j
+nnoremap <C-k> <C-w>k
+nnoremap <C-l> <C-w>l
+
+" ── Airline ───────────────────────────────────────────────────────────────────
+let g:airline_theme = 'tokyonight'
+let g:airline_powerline_fonts = 0 " set to 1 if you have a Nerd Font
+let g:airline#extensions#lsp#enabled = 1
+
+" ── FZF ───────────────────────────────────────────────────────────────────────
+" Use ripgrep for :Files if available
+if executable('rg')
+ set grepprg=rg\ --vimgrep\ --smart-case
+ set grepformat=%f:%l:%c:%m
+endif
+
+" Layout
+let g:fzf_layout = { 'down': '40%' }
+let g:fzf_preview_window = ['right:50%:hidden', 'ctrl-/']
+
+" FZF keymaps
+nnoremap <C-p> <Cmd>Files<CR>
+nnoremap <C-b> <Cmd>Buffers<CR>
+nnoremap <leader>rg <Cmd>Rg<CR>
+nnoremap <leader>fg <Cmd>GFiles<CR>
+nnoremap <leader>fl <Cmd>BLines<CR>
+nnoremap <leader>fh <Cmd>History<CR>
+nnoremap <leader>fc <Cmd>Commands<CR>
+nnoremap <leader>fm <Cmd>Maps<CR>
+
+" Word search under cursor
+nnoremap <leader>fw <Cmd>execute 'Rg ' .. expand('<cword>')<CR>