" vim: set foldmethod=marker foldmarker=[[[,]]] foldlevel=0 nomodeline : " [[[ General Settings set exrc set hidden set modeline set modelines=2 set nomodelineexpr set secure set encoding=utf-8 set expandtab set shiftwidth=0 set tabstop=2 set incsearch set ignorecase set smartcase set wildmenu set nostartofline set splitbelow set splitright if exists('&splitkeep') set splitkeep=screen endif set updatetime=1000 set clipboard=unnamed set mouse=a set undofile " and let mapleader = "\" let maplocalleader = "\\" " General Settings ]]] " [[[ General Keymaps " beginning/end of line nnoremap B ^ nnoremap E $ onoremap B ^ onoremap E $ xnoremap B ^ xnoremap E $ " disable Ctrl-a on screen/tmux if $TERM =~ 'screen\|tmux' nnoremap nnoremap endif " save nnoremap s :update nnoremap js :noautocmd update " move lines inoremap :move .+1==gi inoremap :move .-2==gi nnoremap :move .+1== nnoremap :move .-2== vnoremap :move '>+1gv=gv vnoremap :move '<-2gv=gv " yank from the cursor position to the end of the line nnoremap Y y$ " yank/paste with system clipboard nnoremap y "+y vnoremap y "+y nnoremap Y "+y$ vnoremap Y "+y$ nnoremap p "+p vnoremap p "+p nnoremap P "+P vnoremap P "+P " paste in visual mode keeping the yank xnoremap _p "_dP " make new split nnoremap - :rightbelow new nnoremap _ :botright new nnoremap \ :rightbelow vnew nnoremap \| :botright vnew " centered search navigation (`zv` mimics `foldopen=search`) nnoremap n nzzzv nnoremap N Nzzzv " General Keymaps ]]] " [[[ FileType Specific Settings "" [[[ FileType: help augroup help_custom_setting autocmd! autocmd FileType help nnoremap gq :quit autocmd FileType help nnoremap K :execute 'h ' . expand('') augroup END "" FileType: help ]]] "" [[[ FileType: json autocmd BufNewFile,BufRead tsconfig*.json setlocal filetype=jsonc autocmd FileType jsonc syntax match Comment +\/\/.\+$+ "" FileType: json ]]] "" [[[ FileType: tmux autocmd FileType tmux nnoremap K :call tmux#man() "" FileType: tmux ]]] "" [[[ FileType: vim autocmd FileType vim nnoremap K :execute 'h ' . expand('') "" FileType: vim ]]] " FileType Specific Settings ]]] " [[[ Plugin Initialization "" [[[ Plugin: fzf let g:fzf_action = { \ 'ctrl-t': 'tab split', \ 'ctrl-s': 'split', \ 'ctrl-v': 'vsplit' \ } let g:fzf_command_prefix = 'Z' if has('nvim') || has('popupwin') " fzf in popup window let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6, 'highlight': 'BoxChar' } } endif "" Plugin: fzf ]]] "" [[[ Plugin: git-messenger let g:git_messenger_no_default_mappings = v:true let g:git_messenger_always_into_popup = v:true "" Plugin: git-messenger ]]] "" [[[ Plugin: hexokinase let g:Hexokinase_highlighters = ['foreground'] "" Plugin: hexokinase ]]] "" [[[ Plugin: matchup " disable built-in matchit.vim let g:loaded_matchit = 1 let g:matchup_matchparen_deferred = 1 let g:matchup_matchparen_offscreen = {} let g:matchup_mouse_enabled = 0 let g:matchup_text_obj_enabled = 0 ""Plugin: matchup ]]] "" [[[ Plugin: maximizer let g:maximizer_default_mapping_key = '' "" Plugin: maximizer ]]] "" [[[ Plugin: tmux-navigator let g:tmux_navigator_disable_when_zoomed = 1 let g:tmux_navigator_no_mappings = 1 "" Plugin: tmux-navigator ]]] "" [[[ Plugin: tmux-resizer let g:tmux_resizer_no_mappings = 1 let g:tmux_resizer_resize_count = 5 let g:tmux_resizer_vertical_resize_count = 10 "" Plugin: tmux-resizer ]]] " Plugin Initialization ]]] if has('nvim') lua require('config') else let vim_specific_config_file = fnamemodify(expand(''), ':h') . '/vim.vim' if filereadable(vim_specific_config_file) execute "source " . vim_specific_config_file endif endif " [[[ Plugin Settings "" [[[ Plugin: camelcasemotion map CamelCaseMotion_w map CamelCaseMotion_b map CamelCaseMotion_e map g CamelCaseMotion_ge sunmap sunmap sunmap sunmap g imap CamelCaseMotion_b imap CamelCaseMotion_w "" Plugin: camelcasemotion ]]] "" [[[ Plugin: carbon-now-sh let g:carbon_now_sh_options = { \ 'bg': '#8f3f71', \ 'ln': 'true', \ 'fm': 'JetBrains Mono', \ 'wc': 'false', \ 't': 'monokai' } "" Plugin: carbon-now-sh ]]] "" [[[ Plugin: fzf " hide statusline while fzf-ing if has('nvim') && !exists('g:fzf_layout') autocmd! FileType fzf autocmd FileType fzf set laststatus=0 nonumber noshowmode noruler \| autocmd BufLeave set laststatus=2 number showmode ruler endif " better ripgrep command: ZRG command! -nargs=* -bang ZRG call RipgrepFzf(, 0) function! RipgrepFzf(query, fullscreen) let command_fmt = '[ -n %s ] && rg --column --line-number --no-heading --color=always --smart-case -- %s || true' let initial_command = printf(command_fmt, shellescape(a:query), shellescape(a:query)) let reload_command = printf(command_fmt, '{q}', '{q}') let spec = {'options': ['--disabled', '--prompt', 'Search > ', '--query', a:query, '--bind', 'change:reload:'.reload_command]} let spec = fzf#vim#with_preview(spec, 'right', 'ctrl-/') call fzf#vim#grep(initial_command, 1, spec, a:fullscreen) endfunction " keymaps: fzf nmap :ZFiles nmap / :ZLines nmap ? :ZRG nmap b :ZBuffers nmap w :ZWindows "" Plugin: fzf ]]] "" [[[ Plugin: easy-align " keymaps: easy-align "" Start interactive EasyAlign in visual mode (e.g. vipga) xmap ga (EasyAlign) "" Start interactive EasyAlign for a motion/text object (e.g. gaip) nmap ga (EasyAlign) "" Plugin: easy-align ]]] "" [[[ Plugin: fugitive " keymaps: fugitive nmap gs :G "" Plugin: fugitive ]]] "" [[[ Plugin: git-messenger " keymaps: git-messenger nmap og (git-messenger) function! s:setup_git_messenger_popup() abort nmap (git-messenger-close) endfunction autocmd FileType gitmessengerpopup call setup_git_messenger_popup() "" Plugin: git-messenger ]]] "" [[[ Plugin: tmux-navigator nnoremap h :TmuxNavigateLeft nnoremap :TmuxNavigateLeft nnoremap j :TmuxNavigateDown nnoremap :TmuxNavigateDown nnoremap k :TmuxNavigateUp nnoremap :TmuxNavigateUp nnoremap l :TmuxNavigateRight nnoremap :TmuxNavigateRight nnoremap p :TmuxNavigatePrevious nnoremap :TmuxNavigatePrevious "" Plugin: tmux-navigator ]]] "" [[[ Plugin: tmux-resizer nnoremap :TmuxResizeLeft nnoremap :TmuxResizeDown nnoremap :TmuxResizeUp nnoremap :TmuxResizeRight "" Plugin: tmux-resizer ]]] " Plugin Settings ]]] " [[[ Appearance Settings set cursorline set number relativenumber set nowrap set scrolloff=5 " always show the signcolumn, otherwise it would shift the text each time diagnostics appear/become resolved. set signcolumn=yes " fold settings set foldlevelstart=15 set foldminlines=3 syntax enable augroup override_highlight autocmd! autocmd ColorScheme gruvbox highlight link BoxChar GruvboxGray \ | highlight link CocExplorerIndentLine BoxChar augroup END " theme set background=dark let g:gruvbox_inverse=0 let g:gruvbox_italic=1 let g:gruvbox_contrast_dark='hard' let g:gruvbox_contrast_light='hard' let g:gruvbox_invert_selection='0' colorscheme gruvbox " automatically toggle relative line number augroup auto_relativenumber_toggle autocmd! autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &l:nu | setl rnu | endif autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &l:nu | setl nornu | endif augroup END " Appearance Settings ]]] " Everything that can happen, happens. It has to end well and it has to end badly. It has to end every way it can.