"" " Help: " ----------- | Navigation " | Show/hide tree view " g, | - Open init.vim (this file) " g' | - Open manfest file (language dependent) " gd | - Go to declaration " gl | - Jump to line " gL | - Jump to line (any pane) " | - Jump to search (1 character) " \w | - Jump to word (down) " | - Jump to word " | - Open an embedded terminal " | - Fuzzy finder open file " | - Change windows " | - Move fast " ----------- | Spelling " f | - Fix " s | - Toggle " g | - Mark as ok " ----------- | Intellisense " H | - Hover " | - Autocomplete " | - Refactor (Rename) " ----------- | Git " gs | - git status " ga | - git add -A " gc | - git commit " gp | - git push " + | - git add % " - | - git reset % " ----------- | Windows " | Split pane " left | - to the left " right | - to the right " ----------- | Formatting " w | Trim whitespace " a | Easy align " ip= | - align in paragraph on = " cs | Change surroundings " '" | - from ' to " " [] | - from [ ([] with spaces) to ] ([] with no spaces) " ys | Add surroundings " iw' | - ' around word " ds | Remove surroundings " ' | - ' around " | Enter Unicode as Latex " ----------- | Sessions " ss | - Save session " sa | - Save session as " sl | - Load session " so | - Open default session "" set shell=bash "Install the plugin thing if it isn't installed yet "note that it only auto-installs the first time. Later modifications must be "run manually with :PlugInstall if empty(glob('~/.local/share/nvim/site/autoload/plug.vim')) silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim autocmd VimEnter * PlugInstall --sync | source $MYVIMRC endif "Install the plugins call plug#begin('~/.vim/plugged') Plug 'joshdick/onedark.vim' " colour scheme Plug 'sheerun/vim-polyglot' " language packs Plug 'scrooloose/nerdtree' " tree view Plug 'scrooloose/nerdcommenter' " ctrl-slash for comment Plug 'vim-airline/vim-airline' " bottom bar Plug 'vim-airline/vim-airline-themes' " bottom bar colours Plug 'ctrlpvim/ctrlp.vim' " CtrlP fuzzy finder Plug 'junegunn/fzf' " idk more fuzzy finder or something Plug 'junegunn/vim-easy-align' " auto align stuff Plug 'junegunn/goyo.vim' " distraction free writing Plug 'junegunn/limelight.vim' " spotlighting Plug 'jparise/vim-graphql' " GraphQL syntax highlighting Plug 'airblade/vim-gitgutter' " git addition/deletions in the left bar Plug 'easymotion/vim-easymotion' " jumping around Plug 'vim-scripts/sessionman.vim' " sessions Plug 'lrvick/Conque-Shell' " terminal inside Vim Plug 'tpope/vim-fugitive' " control git from inside Vim Plug 'tpope/vim-surround' " surround things in quotes, etc. Plug 'kshenoy/vim-signature' " handles and displays the marks Plug 'terryma/vim-multiple-cursors' " multiple cursor support Plug 'projectfluent/fluent.vim' " fluent syntax highlighting Plug 'murarth/ketos', { 'rtp': 'etc/vim' } " ketos syntax highlighting Plug 'luochen1990/rainbow' " rainbow parentheses Plug 'arthurxavierx/vim-unicoder' " unicode input Plug 'SidOfc/mkdx' " markdown improvements Plug 'LukeSmithxyz/vimling' " some other accents/IPA input Plug 'francoiscabrol/ranger.vim' " integration with ranger Plug 'rbgrouleff/bclose.vim' " required for ranger integration Plug 'evanleck/vim-svelte' " svelte syntax highlighting Plug 'jceb/vim-orgmode' " emacs org-mode for vim Plug 'tpope/vim-speeddating' " better date support for increment Plug 'idanarye/breeze.vim' " easymotion for HTML Plug 'neoclide/coc.nvim', {'branch': 'release'} " coc language client call plug#end() " fix the bugs? set nocompatible " fixes for weird keybindings set nobackup set nowritebackup set backupcopy=yes " fixes for file watchers set cmdheight=2 set updatetime=300 set shortmess+=c set signcolumn=yes " some ergonomics things let mapleader = " " inoremap noremap 10h noremap 10j noremap 10k noremap 10l noremap zz :w inoremap h inoremap j inoremap k inoremap l nnoremap h nnoremap j nnoremap k nnoremap l let g:multi_cursor_use_default_mapping=0 " Default mapping let g:multi_cursor_start_word_key = 'n' let g:multi_cursor_select_all_word_key = 'N' let g:multi_cursor_start_key = 'gn' let g:multi_cursor_select_all_key = 'gN' let g:multi_cursor_next_key = '' let g:multi_cursor_prev_key = '' let g:multi_cursor_skip_key = '' let g:multi_cursor_quit_key = '' " auto indents filetype plugin indent on set backspace=2 set expandtab set tabstop=2 set softtabstop=2 set shiftwidth=2 set autoindent nnoremap :set expandtab! " allow mouse controls... set mouse=a " show line numbers set number " show invisibles set list set listchars=tab:»\ ,eol:¬,space:· " something something idk set cursorline " enable colour scheme set termguicolors syntax on set encoding=utf-8 colorscheme onedark " markdown let g:polyglot_disabled = ['markdown'] let g:mkdx#settings = { 'highlight': { 'enable': 1 }, \ 'map': { 'prefix': '', 'enable': 1 }, \ 'tokens': { 'bold': '__', 'italic': '*', 'strike': '~', 'list': '*', 'fence': '`', 'header': '#' }, \ 'links': { 'external': { 'enable': 1 } }, \ 'toc': { 'text': 'Table of Contents', 'update_on_write': 1 } } nnoremap mi :call ToggleIPA() " rainbow let g:rainbow_active = 0 nnoremap mp :RainbowToggle " goyo nnoremap mr :Goyo 100 " spelling set spell spelllang=en_ca nnoremap f 1z= nnoremap s :set spell! nnoremap g zg set nospell nnoremap zg zz "Save with sudo cmap w!! w !sudo tee > /dev/null % "Splitting, atom style (ctrl-k [direction]) " insert mode imap :abo vsp % imap :abo vsp % imap :bel vsp % imap l :bel vsp % imap :abo sp % imap k :abo sp % imap :bel sp % imap j :bel sp % " normal mode nmap :abo vsp % nmap nmap :bel vsp % nmap l :bel vsp % nmap :abo sp % nmap k :abo sp % nmap :bel sp % nmap j :bel sp % " tabs navigation nnoremap t :tabnew nnoremap :tabp nnoremap :tabn " buffers navigation nnoremap gb :ls:b "Open this file (g ,) nmap g, :n ~/.config/nvim/init.vim "Open this file (g ,) nmap g, :n ~/.config/nvim/init.vim "Trim whitespace from end of lines nnoremap w :let _s=@/:%s/\s\+$//e:let @/=_s "Git " `git status` (g s) nmap gs :Gstatus " `git commit` (g c) nmap gc :Gcommit " `git push` (g p) nmap gp :Gpush " `git add -A` (g a) nmap ga :silent !git add -A " `git add` this file (+) nmap + :silent !git add % " `git reset` this file (-) nmap - :silent !git reset % " Set the base for gutter markings let g:gitgutter_diff_base = 'HEAD' "Easy motion let g:EasyMotion_smartcase = 1 "Jump somewhere (Enter) nmap (easymotion-bd-w) "Go to line (g l) nmap gl (easymotion-bd-jk) "Go to line in any window (g L) nmap g (easymotion-overwin-line) "Go to char in any window (Ctrl-s) nmap (easymotion-overwin-f) imap (easymotion-overwin-f) " EasyAlign xmap a (EasyAlign) nmap a (EasyAlign) "Session management. "Kind of difficult to get right always, but sometimes it is quick and handy let v:this_session = 'default' let sessionman_save_on_exit = 1 "Save current open windows (s s) nmap ss :SessionSave "Save current session with name (s a) nmap sa :SessionSaveAs "Open some recent session, good for resuming after closing (s o) nmap so :SessionOpen default "Open a specific named session (s l) nmap sl :SessionList "Language server integration set hidden "Tree view (Ctrl-\) map :NERDTreeToggle "Commenting "Toggle comment line/selection (Ctrl-/) nmap ci vmap ci imap ci "Airline "Make sure you install a Powerline version of a font. I suggest Fira Code let g:airline#extensions#tabline#enabled = 1 let g:airline_powerline_fonts = 1 "Pick a nice colour let g:airline_theme = 'bubblegum' "CtrlP Fuzzy finder "Some directories and stuff to skip. Makes it faster if you skip a lot let g:ctrlp_custom_ignore = { \ 'dir': '\v[\/](\.(git|hg|svn|build)|node_modules|Pods|elm-stuff|target|dist|vendor)$', \ 'file': '\v\.(exe|so|dll|DS_store|swp)$', \ } nnoremap :CtrlPClearAllCaches "Conque-Shell "Open a terminal inside of vim (F9) " nmap :ConqueTermVSplit bash nmap (coc-terminal-toggle) "Ranger let g:ranger_map_keys = 0 let g:ranger_replace_netrw = 1 nnoremap \ :Ranger nnoremap :RangerWorkingDirectory function! InvertMeaning () normal! "iyiw echom @i let mappings = { \ "true": "false", \ "false": "true", \ "1": "0", \ "0": "1", \ "max": "min", \ "min": "max", \ "<": ">", \ ">": "<", \ ">=": "<=", \ "<=": ">=", \ "!=": "==", \ "==": "!=", \ } if has_key(mappings, @i) execute "normal! ciw" . mappings[@i] endif endfunction nnoremap i :call InvertMeaning() "coc " Use tab for trigger completion with characters ahead and navigate. " Use command ':verbose imap ' to make sure tab is not mapped by other plugin. inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction " Use to trigger completion. inoremap coc#refresh() " Use to confirm completion, `u` means break undo chain at current position. " Coc only does snippet and additional edit on confirm. inoremap pumvisible() ? "\" : "\u\" " Remap keys for gotos nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap r (coc-references) " Use K to show documentation in preview window nnoremap K :call show_documentation() function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('') else call CocAction('doHover') endif endfunction set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}