Files
nixos/modules/features/vim/vimrc
2026-11-13 09:22:37 +00:00

69 lines
1.6 KiB
VimL

" Set colorscheme and enable highlighting
colorscheme catppuccin
set termguicolors
syntax on
" Set tab stuff
set tabstop=2
set shiftwidth=2
set expandtab
set softtabstop=2
" Enable line numbers
set number
set relativenumber
set cursorline
" Make cursorlinenum a different color
augroup colorAutoCmds
autocmd!
autocmd ColorScheme * highlight CursorLineNr cterm=bold guifg=#cba6f7
augroup END
" Searching stuff
set ignorecase
set smartcase
set hlsearch
set incsearch
" asyncomplete navigation
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>"
let g:vsnip_integ_debug = 1
let g:asyncomplete_auto_popup = 1
" Snippet expansion
imap <expr> <C-j> vsnip#expandable() ? '<Plug>(vsnip-expand)' : '<C-j>'
smap <expr> <C-j> vsnip#expandable() ? '<Plug>(vsnip-expand)' : '<C-j>'
" Snippet placeholder navigation
imap <expr> <C-l> vsnip#available(1) ? '<Plug>(vsnip-expand-or-jump)' : '<C-l>'
smap <expr> <C-l> vsnip#available(1) ? '<Plug>(vsnip-expand-or-jump)' : '<C-l>'
" Set different cursor shapes depending on mode
let &t_SI = "\e[6 q"
let &t_EI = "\e[2 q"
augroup cursorCmds
au!
autocmd VimEnter * silent !echo -ne "\e[2 q"
augroup END
set omnifunc=lsp#complete
if executable("nixd")
autocmd User lsp_setup call lsp#register_server({
\ 'name': 'nixd',
\ 'cmd': ['nixd'],
\ 'allowlist': ['nix'],
\ })
endif
if executable("lua-language-server")
autocmd User lsp_setup call lsp#register_server({
\ 'name': 'lua_ls',
\ 'cmd': ['lua-language-server'],
\ 'allowlist': ['lua'],
\ })
endif