diff options
author | Matthew Lemon <y@yulqen.org> | 2024-02-15 10:22:00 +0000 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-02-15 10:22:00 +0000 |
commit | 47eefb2fc5bde0fadb21c6e1e3f8c7f7fba3de0b (patch) | |
tree | f7982564124908c5c2075d53454fbc5d8b467905 /vim/vimrc | |
parent | 8debc9ec9caed3bad157a258583f20cafaaa8ac7 (diff) |
Updates vim config to match Arch config
Diffstat (limited to 'vim/vimrc')
-rw-r--r-- | vim/vimrc | 94 |
1 files changed, 80 insertions, 14 deletions
@@ -1,11 +1,13 @@ -filetype plugin on +" Setup {{{ +set nocompatible filetype indent on -syntax on +filetype plugin on +" syntax on runtime macros/matchit.vim "allows jumping between brackets with % in normal mode " }}} " Leaders {{{ let maplocalleader = "\\" -let mapleader = "," +let mapleader = " " nnoremap <leader>q :call TaskWarriorAddCurrentLine()<CR> " pandoc command to generate weekly plan page in Firefox (or not, if we just " wish to refresh) @@ -34,7 +36,7 @@ nnoremap <leader>ni :e $NOTES_DIR/index.md<CR>:cd $NOTES_DIR<CR> " clear search highlights nnoremap <leader><space> :noh<cr>:call clearmatches()<cr> nnoremap <leader><C-p> :<C-u>FZF!<CR> -nnoremap <leader>t :Files<CR> +nnoremap <C-p>p :Files<CR> nnoremap <leader>o :Tags<CR> nnoremap <leader>h :History<CR> nnoremap <silent> <leader>0 :Files<CR> @@ -82,8 +84,8 @@ set autoindent set expandtab set hidden set path+=** -set relativenumber -set number +" set relativenumber +" set number set more set signcolumn=number set colorcolumn=0 @@ -115,6 +117,7 @@ endif let g:vim_markdown_folding_disabled = 1 " }}} " Remaps {{{ +let @x = 'o- [ ] ' noremap <silent> J 10j noremap <silent> K 10k " macro to go to end of sentence and add a line break (for @@ -122,17 +125,22 @@ noremap <silent> K 10k let @s = ")i\<BS>\<CR>\<Esc>" " remap :W to :w - :W was previous Windows in fzf command! W w +" Open Fern with Ctrl-N +nnoremap <C-n> :Fern -drawer .<CR> <C-w>l " }}} " Plugins {{{ call plug#begin() "Plug 'vim-scripts/AutoComplPop' +Plug 'lambdalisue/fern.vim', +Plug 'tpope/vim-rails', +Plug 'vim-ruby/vim-ruby', Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf.vim' Plug 'ayu-theme/ayu-vim' Plug 'airblade/vim-tailwind' +Plug 'vim-perl/vim-perl', { 'for': 'perl', 'do': 'make clean carp dancer highlight-all-pragmas moose test-more try-tiny' } Plug 'morhetz/gruvbox' Plug 'eemed/sitruuna.vim' -Plug 'junegunn/goyo.vim' " Plug 'sheerun/vim-polyglot' Plug 'preservim/vim-markdown' Plug 'mhinz/vim-signify' @@ -147,7 +155,6 @@ Plug 'tpope/vim-fugitive' Plug 'SirVer/UltiSnips' Plug 'honza/vim-snippets' Plug 'dense-analysis/ale' -Plug 'tomasiser/vim-code-dark' call plug#end() " }}} " vim-tailwind {{{ @@ -163,11 +170,12 @@ autocmd BufEnter *.html,*.slim if s:is_tailwind() | \ endif " }}} " ALE {{{ -let g:ale_enabled = 1 +let g:ale_enabled = 0 +let g:ale_set_balloons = 0 let g:ale_echo_msg_format = '[%linter%] %s [%severity%]' let g:ale_sign_error = '!' let g:ale_sign_warning = '?' -let g:ale_lint_on_text_changed = 0 +let g:ale_lint_on_text_changed = 1 let g:ale_hover_cursor = 0 let g:ale_virtualtext_cursor = 'disabled' let g:ale_sign_column_always = 1 @@ -192,7 +200,7 @@ let g:ale_linters = {'python': ['pyright', 'flake8', 'mypy'], let g:ale_fixers = { \ 'python': ['autoimport', 'isort', 'yapf', 'black'], \ 'javascript': ['eslint'], -\ 'go': ['gofmt'], +\ 'go': ['gofmt', 'goimports', 'gopls'], \ 'cpp': ['clang-format'], \ 'c': ['clang-format'], \ 'rust': ['rustfmt'] @@ -203,6 +211,7 @@ let g:ale_python_mypy_options = '--config-file mypy.ini' " let g:ale_sign_error = '>>' let g:ale_fix_on_save = 1 let g:ale_linters_explicit = 0 +let g:ale_completion_enabled = 0 set omnifunc=ale#completion#OmniFunc " }}} " :grep use ripgrep {{{ @@ -308,7 +317,64 @@ let g:gruvbox_italicize_strings = 1 let g:gruvbox_improved_strings = 1 let g:gruvbox_improved_warnings = 1 let g:gruvbox_invert_indent_guides = 1 -let g:gruvbox_invert_signs = 0 -" colorscheme ayu -colorscheme sitruuna +let g:gruvbox_invert_signs = 1 +"colorscheme evening +"colorscheme sitruuna +colorscheme ayu +"colorscheme gruvbox +" }}} +" GPG files {{{ +" from https://vim.fandom.com/wiki/Edit_gpg_encrypted_files +" Don't save backups of *.gpg files +set backupskip+=*.gpg +" To avoid that parts of the file is saved to .viminfo when yanking or +" deleting, empty the 'viminfo' option. +set viminfo= + +augroup encrypted + au! + " Disable swap files, and set binary file format before reading the file + autocmd BufReadPre,FileReadPre *.gpg + \ setlocal noswapfile bin + " Decrypt the contents after reading the file, reset binary file format + " and run any BufReadPost autocmds matching the file name without the .gpg + " extension + autocmd BufReadPost,FileReadPost *.gpg + \ execute "'[,']!gpg --decrypt --default-recipient-self" | + \ setlocal nobin | + \ execute "doautocmd BufReadPost " . expand("%:r") + " Set binary file format and encrypt the contents before writing the file + autocmd BufWritePre,FileWritePre *.gpg + \ setlocal bin | + \ '[,']!gpg --encrypt --default-recipient-self + " After writing the file, do an :undo to revert the encryption in the + " buffer, and reset binary file format + autocmd BufWritePost,FileWritePost *.gpg + \ silent u | + \ setlocal nobin +augroup END +" }}} +" GitFZF {{{ +" from https://git.sr.ht/~sircmpwn/dotfiles/tree/master/item/.vimrc +function! GitFZF() + let path = trim(system('cd '.shellescape(expand('%:p:h')).' && git rev-parse --show-toplevel')) + exe 'FZF ' . path +endfunction +command! GitFZF call GitFZF() +nnoremap <leader><C-f> :GitFZF<CR> +" }}} +" Switching off colours {{{ +"syntax off +" hi Visual term=reverse ctermbg=7 ctermfg=black guifg=black guibg=LightPink +" hi SpellBad term=reverse ctermbg=224 gui=undercurl guisp=Red guibg=Red +" hi SpellCap term=reverse ctermbg=224 gui=undercurl guisp=Red guibg=Red +" hi SpellRare term=reverse ctermbg=224 gui=undercurl guisp=Red guibg=Blue +" hi Search term=reverse ctermbg=11 guifg=black guibg=Green +"}}} +" Turn spelling on for text files {{{ +" from - https://dmerej.info/blog/post/syntax-highlighting-is-useless/ +" augroup textfiles +" autocmd! +" autocmd filetype markdown :setlocal spell spelllang=en | syntax clear +" augroup end " }}} |