aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--vim/vimrc179
1 files changed, 82 insertions, 97 deletions
diff --git a/vim/vimrc b/vim/vimrc
index 1926a21..81a8c10 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -1,20 +1,66 @@
+" Setup {{{
+set nocompatible
filetype plugin on
filetype indent on
syntax on
-
-" leader
+runtime macros/matchit.vim "allows jumping between brackets with % in normal mode
+" }}}
+" Leaders {{{
let maplocalleader = "\\"
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)
+nnoremap <leader>w :!pandoc /home/lemon/Documents/Notes/MOD/Projects/weekly_planning.md --css /home/lemon/.local/share/pandoc/templates/mystyles.css -s -o /tmp/toss.html; firefox /tmp/toss.html &<cr>
+nnoremap <leader>W :!pandoc /home/lemon/Documents/Notes/MOD/Projects/weekly_planning.md --css /home/lemon/.local/share/pandoc/templates/mystyles.css -s -o /tmp/toss.html<cr>
+" Open vimrc
+nnoremap <leader>ev <C-w>s<C-w>j<C-w>L:e $HOME/.vim/vimrc<cr>
+" Place timestamps, be it date (YYYY-MM-DD) or time (HH:MM:SS).
+if (exists("*strftime"))
+ noremap <silent> <leader>date "=strftime("%F")<CR>p9h
+ noremap <silent> <leader>time "=strftime("%X")<CR>p7h
+endif
-
+" Place timestamps, be it date (YYYY-MM-DD) or time (HH:MM:SS).
+if (exists("*strftime"))
+ noremap <silent> <leader>date "=strftime("%F")<CR>p9h
+ noremap <silent> <leader>time "=strftime("%X")<CR>p7h
+endif
+" Generate ctags for current working directory
+nnoremap <leader>tt :silent !ctags -R . <CR>:redraw!<CR>
+" notes stuff - from https://www.edwinwenink.xyz/posts/43-notes_tagging/
+" Go to index of notes and set working directory to my notes
+nnoremap <leader>ni :e $NOTES_DIR/index.md<CR>:cd $NOTES_DIR<CR>
" related to https://oleksii.shmalko.com/2014/using-vim-as-c-cpp-ide/
" to enable putting a config file in the proejct directory
+" 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 <leader>o :Tags<CR>
+nnoremap <leader>h :History<CR>
+nnoremap <silent> <leader>0 :Files<CR>
+nnoremap <silent> <leader>; :BLines<CR>
+nnoremap <silent> <leader>l :Lines<CR>
+nnoremap <silent> <leader>o :BTags<CR>
+nnoremap <silent> <leader>b :Buffers<CR>
+nnoremap <silent> <leader>? :History:<CR>
+nnoremap <silent> <leader>/ :execute 'Ag ' . input('Ag/')<CR>
+nnoremap <silent> <leader>ft :Filetypes<CR>
+nnoremap <silent> <leader>CC :Commands<CR>
+" Open quickfix list in a right vertical split (good for Ngrep results)
+command! Vlist botright vertical copen | vertical resize 50
+nnoremap <leader>v : Vlist<CR>
+" }}}
+" Options {{{
+set autoread
set exrc
set secure
-
-set nocompatible
set scrolloff=1
set history=799
+set encoding=utf-8
+set wrap
+set wrapmargin=0
set wildignore=**/__pycache*/**
set wildoptions=pum
set wildmenu
@@ -51,9 +97,8 @@ set shortmess+=c
set tags+=./tags
set background=dark
set completeopt=menuone,longest
-
-
-" Function to allow adding a line of text to taskwarrior
+" }}}
+" Function to allow adding a line of text to taskwarrior {{{
function! TaskWarriorAddCurrentLine()
let current_line = getline('.')
silent execute ":!task add " . shellescape(current_line)
@@ -61,58 +106,34 @@ function! TaskWarriorAddCurrentLine()
echo "Task added: " . current_line
delete
endfunction
-
-nnoremap <leader>q :call TaskWarriorAddCurrentLine()<CR>
-
-" pandoc command to generate weekly plan page in Firefox (or not, if we just
-" wish to refresh)
-nnoremap <leader>w :!pandoc /home/lemon/Documents/Notes/MOD/Projects/weekly_planning.md --css /home/lemon/.local/share/pandoc/templates/mystyles.css -s -o /tmp/toss.html; firefox /tmp/toss.html &<cr>
-nnoremap <leader>W :!pandoc /home/lemon/Documents/Notes/MOD/Projects/weekly_planning.md --css /home/lemon/.local/share/pandoc/templates/mystyles.css -s -o /tmp/toss.html<cr>
-
-
-" macro to go to end of sentence and add a line break (for
-" one-line-per-sentence vimming...)
-let @s = ")i\<BS>\<CR>\<Esc>"
-
-" i don't bother with folding, but it's here if i need it.
+" }}}
+" Folding {{{
if has('folding')
set foldmethod=marker
- set foldmarker=#\ {{{,#\ }}}
+" set foldmarker=#\ {{{,#\ }}}
set viewoptions=folds,options,cursor,unix,slash
endif
-
" disable folding by default with vim-markdown
let g:vim_markdown_folding_disabled = 1
-
-" Open vimrc
-nnoremap <leader>ev <C-w>s<C-w>j<C-w>L:e $HOME/.vim/vimrc<cr>
-
-" Jump up or down by 10 lines.
+" }}}
+" Remaps {{{
noremap <silent> J 10j
noremap <silent> K 10k
-
-" Place timestamps, be it date (YYYY-MM-DD) or time (HH:MM:SS).
-if (exists("*strftime"))
- noremap <silent> <leader>date "=strftime("%F")<CR>p9h
- noremap <silent> <leader>time "=strftime("%X")<CR>p7h
-endif
-
-" Place timestamps, be it date (YYYY-MM-DD) or time (HH:MM:SS).
-if (exists("*strftime"))
- noremap <silent> <leader>date "=strftime("%F")<CR>p9h
- noremap <silent> <leader>time "=strftime("%X")<CR>p7h
-endif
-
+" macro to go to end of sentence and add a line break (for
+" one-line-per-sentence vimming...)
+let @s = ")i\<BS>\<CR>\<Esc>"
"keymap for Fern
nnoremap ;f :Fern . -drawer<cr>
-
+" remap :W to :w - :W was previous Windows in fzf
+command! W w
+" }}}
+" Plugins {{{
call plug#begin()
"Plug 'vim-scripts/AutoComplPop'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'catppuccin/nvim', { 'as': 'catppuccin' }
Plug 'ayu-theme/ayu-vim'
-Plug 'szw/vim-maximizer'
Plug 'ycm-core/YouCompleteMe'
Plug 'airblade/vim-tailwind'
Plug 'morhetz/gruvbox'
@@ -134,11 +155,8 @@ Plug 'honza/vim-snippets'
Plug 'dense-analysis/ale'
Plug 'tomasiser/vim-code-dark'
call plug#end()
-
-" maximize current split or return to previous
-noremap <C-w>m :MaximizerToggle<CR>
-
-" vim-tailwind
+" }}}
+" vim-tailwind {{{
function! s:is_tailwind()
return !empty(findfile('tailwind.config.js', '.;')) ||
\ !empty(findfile('theme/static_src/tailwind.config.js', '.;'))
@@ -149,8 +167,8 @@ nmap <silent> <buffer> gk <Plug>(tailwind-lookup)
autocmd BufEnter *.html,*.slim if s:is_tailwind() |
\ setlocal omnifunc=tailwind#Complete |
\ endif
-
-" YCM
+" }}}
+" YCM {{{
" *** STARTING AND ENABLING ***
" Don't start on start - or use show_diagnostics below
"let g:loaded_youcompleteme = 1
@@ -180,10 +198,9 @@ let g:ycm_extra_conf_vim_data = [
nnoremap <leader>jd :YcmCompleter GoTo<CR>
imap <silent> <C-l> <Plug>(YCMToggleSignatureHelp)'.
-
let g:ycm_enable_inlay_hints = 0
-
-" ALE ale config
+" }}}
+" ALE {{{
let g:ale_enabled = 1
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
let g:ale_sign_error = '✘'
@@ -225,8 +242,8 @@ let g:ale_python_mypy_options = '--config-file mypy.ini'
let g:ale_fix_on_save = 1
let g:ale_linters_explicit = 0
set omnifunc=ale#completion#OmniFunc
-
-" Make :grep use ripgrep
+" }}}
+" :grep use ripgrep {{{
if executable('rg')
set grepprg=rg\ --color=never\ --vimgrep
endif
@@ -240,27 +257,16 @@ command! -bang -nargs=* Rg
\ <bang>0)
nnoremap <C-p>a :Rg
-
-" Generate ctags for current working directory
-nnoremap <leader>tt :silent !ctags -R . <CR>:redraw!<CR>
-
-" notes stuff - from https://www.edwinwenink.xyz/posts/43-notes_tagging/
-" Go to index of notes and set working directory to my notes
-nnoremap <leader>ni :e $NOTES_DIR/index.md<CR>:cd $NOTES_DIR<CR>
-
-" 'Notes Grep' with ripgrep (see grepprg)
+" }}}
+" 'Notes Grep' with ripgrep (see grepprg) {{{
" -i case insensitive
" -g glob pattern
" ! to not immediately open first search result
"command! -nargs=1 Ngrep :silent grep! "<args>" -i -g '*.md' $NOTES_DIR | execute ':redraw!'
command! -nargs=1 Ngrep vimgrep "<args>" $NOTES_DIR/**/*.md
nnoremap <leader>nn :Ngrep
-
-" Open quickfix list in a right vertical split (good for Ngrep results)
-command! Vlist botright vertical copen | vertical resize 50
-nnoremap <leader>v : Vlist<CR>
-
-" vim-test
+" }}}
+" vim-test {{{
nmap <silent> tn :TestNearest<CR>
nmap <silent> tf :TestFile<CR>
nmap <silent> ts :TestSuite<CR>
@@ -270,16 +276,8 @@ let test#strategy = "basic"
let test#python#pytest#options = '-q -s'
let test#python#runner = 'pytest'
let test#vimterminal#term_position = "belowright"
-
-" clear search highlights
-nnoremap <leader><space> :noh<cr>:call clearmatches()<cr>
-
-runtime macros/matchit.vim "allows jumping between brackets with % in normal mode
-
-" remap :W to :w - :W was previous Windows in fzf
-command! W w
-
-" FZF
+" }}}
+" FZF {{{
" This is the default extra key bindings
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
@@ -308,23 +306,10 @@ let g:fzf_colors =
let g:fzf_nvim_statusline = 0 " disable statusline overwriting
nnoremap <C-s> :GFiles!<CR>
- nnoremap <leader><C-p> :<C-u>FZF!<CR>
- nnoremap <leader>t :Files<CR>
- nnoremap <leader>o :Tags<CR>
- nnoremap <leader>h :History<CR>
- nnoremap <silent> <leader>0 :Files<CR>
- nnoremap <silent> <leader>; :BLines<CR>
- nnoremap <silent> <leader>l :Lines<CR>
- nnoremap <silent> <leader>o :BTags<CR>
- nnoremap <silent> <leader>b :Buffers<CR>
- nnoremap <silent> <leader>? :History:<CR>
- nnoremap <silent> <leader>/ :execute 'Ag ' . input('Ag/')<CR>
- nnoremap <silent> <leader>ft :Filetypes<CR>
- nnoremap <silent> <leader>CC :Commands<CR>
imap <C-x><C-f> <plug>(fzf-complete-file-ag)
imap <C-x><C-l> <plug>(fzf-complete-line)
-
-" COLORSCHEME BITS -
+" }}}
+" Colorscheme {{{
" This is imported from the old ephemera.vim file which has now been removed
"
" I got the following from gruvbox docs
@@ -355,4 +340,4 @@ let g:gruvbox_improved_warnings = 1
let g:gruvbox_invert_indent_guides = 1
let g:gruvbox_invert_signs = 0
colorscheme ayu
-" END OF COLORSCHEME BITS -
+" }}}