From db99647186c7df6eec0012f5d275566878f71dae Mon Sep 17 00:00:00 2001 From: claw0ry Date: Thu, 2 Jan 2025 14:13:09 +0100 Subject: vim: reorganize and add ultisnips --- .vimrc | 51 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/.vimrc b/.vimrc index 7eb4ff5..41d85ae 100644 --- a/.vimrc +++ b/.vimrc @@ -2,6 +2,25 @@ set encoding=utf8 scriptencoding utf8 lang en_US.UTF-8 +" ---------------------- +" --- PLUGINS +" ---------------------- + +call plug#begin() +Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } +Plug 'junegunn/fzf.vim' +Plug 'jremmen/vim-ripgrep' +Plug 'tpope/vim-commentary' +Plug 'tpope/vim-surround' +Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } +Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']} +Plug 'SirVer/ultisnips' +call plug#end() + +" ---------------------- +" --- GENERAL +" ---------------------- + " use space as key let mapleader=" " @@ -12,6 +31,10 @@ set relativenumber syntax on filetype plugin indent on +" vertical bar in insert mode, block in normal mode +let &t_SI = "\e[6 q" +let &t_EI = "\e[2 q" + set backspace=indent,eol,start " indentation @@ -76,18 +99,18 @@ set completeopt="noinsert,menuone,noselect" " show whitespace characters set list lcs=tab:>\ ,trail:~,precedes:<,space:\ ,nbsp:× +" --------------------------------- +" --- AUTOCOMMANDS +" -------------------------------- + " set correct filetype for terraform files autocmd BufRead,BufNewFile *.tf,*.tfvars set filetype=terraform " set correct comment string for powershell files autocmd FileType ps1 setlocal commentstring=#\ %s -" vertical bar in insert mode, block in normal mode -let &t_SI = "\e[6 q" -let &t_EI = "\e[2 q" - -" reset the cursor on start (for older versions of vim, usually not required) -autocmd VimEnter * silent !echo -ne "\e[2 q" +" reload file if changes from outside +autocmd FocusGained,BufEnter * :checktime " --------------------------------- " --- KEYBINDINGS @@ -130,9 +153,6 @@ nnoremap fg :Ag nnoremap ffg :Rg nnoremap b :Buffers -" reload file if changes from outside -autocmd FocusGained,BufEnter * :checktime - " avoid human error cabbr W w cabbr Wq wq @@ -140,19 +160,10 @@ cabbr Q q cabbr E e " ---------------------- -" --- PLUGINS +" --- SNIPPETS " ---------------------- -call plug#begin() -Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } -Plug 'junegunn/fzf.vim' -Plug 'jremmen/vim-ripgrep' -Plug 'tpope/vim-commentary' -Plug 'tpope/vim-surround' -Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } -Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']} -call plug#end() - +let g:UltiSnipsSnippetDirectories=[$HOME.'/.local/snippets'] " ---------------------- " --- THEME -- cgit v1.2.3