" Plugins call plug#begin('~/.local/share/nvim/plugged') " General Plug 'preservim/nerdtree' Plug 'scrooloose/nerdcommenter' Plug 'tmhedberg/SimpylFold' Plug 'Maan2003/lsp_lines.nvim' " fuzzy find Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf.vim' " Appearance Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' Plug 'bluz71/vim-nightfly-colors', { 'as': 'nightfly' } Plug 'junegunn/goyo.vim' Plug 'junegunn/limelight.vim' " Web Plug 'othree/html5.vim' Plug 'pangloss/vim-javascript' Plug 'evanleck/vim-svelte', {'branch': 'main'} " wgsl Plug 'DingDean/wgsl.vim' " Rust "Plug 'rust-lang/rust.vim' "Plug 'neoclide/coc.nvim', {'branch': 'release'} call plug#end() :lua require('autumn') " Neovide / Plugin Config if exists("g:neovide") let g:neovide_scale_factor = 1 let g:neovide_opacity = 0.7 let g:neovide_floating_blur_amount_x = 5.0 let g:neovide_floating_blur_amount_y = 5.0 let g:neovide_padding_left = 0 set linespace=1 endif let g:SimpylFold_docstring_preview=1 let g:NERDTreeWinPos = 'right' let g:NERDTreeFileLines = 1 let g:NERDTreeShowHidden = 1 let g:NERDTreeMinimalUI = 1 let g:NERDTreeShowBookmarks = 1 let g:NERDTreeChDirMode = 2 let g:fzf_preview_window = 'right:60%' let g:fzf_action = { \ 'ctrl-h': 'vsplit', \ 'ctrl-v': 'split' \ } augroup fzf autocmd! autocmd! FileType fzf autocmd FileType fzf set laststatus=0 noshowmode noruler \| autocmd BufLeave set laststatus=2 showmode ruler augroup END " General Settings if exists("g:neovide") " ctrl+scroll & control+0 to adjust scale & reset to default nnoremap :let g:neovide_scale_factor *= 0.9 nnoremap :let g:neovide_scale_factor *= 1.11111111 nnoremap :let g:neovide_scale_factor = 1.0 endif " theme / appearance colorscheme nightfly syntax on filetype on filetype plugin on filetype indent on set t_Co=256 set guifont=Source\ Code\ Pro:h10 set termguicolors set number set cursorline set signcolumn=yes " tabbing set shiftwidth=4 set tabstop=4 set softtabstop=4 set smartindent set expandtab " make line breaks traversable set backspace=indent,eol,start set whichwrap+=<,>,h,l " use system clipboard set clipboard=unnamed set clipboard+=unnamedplus " nerd shit / &c set encoding=utf-8 set backupdir=~/.vim/backup set directory=~/.vim/swap set updatetime=200 set history=1000 set backup set ruler " column / row number set showcmd set showmode set showmatch set hlsearch set incsearch set wildmenu set wildmode=list:longest set foldmethod=indent set foldlevel=99 " Highlighting " highlight spaces at end of line (when not in insert mode) :highlight ExtraWhitespace ctermbg=red guibg=red :match ExtraWhitespace /\s\+\%#\@re lbdei " find & replace nnoremap rr :%s/\<\>//g " word count nnoremap wc g " enter insert mode directly from visual mode vnoremap i i " copy from visual mode vnoremap "+y " ctrl+f to find files nnoremap :Files " alt+direction to move lines up/down nnoremap mz:m+`z nnoremap mz:m-2`z " & the same for multiple lines in visual mode " no idea how this works, took it from nori's dotfiles (https://nori.gay) vnoremap :m'>+`mzgv`yo`z vnoremap :m'<-2`>my` mz:m+`z nnoremap mz:m-2`z vnoremap :m'>+`mzgv`yo`z vnoremap :m'<-2`>my` u " +shift for redo nnoremap " undo current insert operation with ctrl-z inoremap ui " & redo with ctrl-shift-z inoremap i " paste in insert mode inoremap :set pastea+:set nopastea " paste in normal mode nnoremap :set pastei+:set nopaste " jj to quickly exit insert inoremap jj l inoremap ;; l " cycle through completion options inoremap inoremap " navigate to errors "nnoremap er :Semshi goto error:Semshi error "nnoremap rr :Semshi error "nnoremap ss :Semshi toggle "nnoremap re :Semshi rename " back to previous place nnoremap . `` " nerdtree - maybe make this a 2-key command instead of 3 nnoremap nt :NERDTreeToggle " some niceties for editing this file nnoremap src :source ~/.config/nvim/init.vim nnoremap erc :e ~/.config/nvim/init.vim nnoremap plug :PlugInstall " launch a terminal at cwd nnoremap tt :!alacritty & " splits nnoremap hh :vsplitl nnoremap vv :split " folding nnoremap za " insert lines above/below without entering insert mode nnoremap o o nnoremap O O " center the cursor when jumping between search results nnoremap n nzz nnoremap N Nzz " search for tab to clear search results nnoremap / :noh " shift+direction to move between splits nnoremap j nnoremap h nnoremap k nnoremap l " ctrl+left/right to hop entire words at a time nnoremap nnoremap " ctrl+shift+right to hop to end of line nnoremap $ nnoremap $ " & similar for hopping to the start nnoremap ^ nnoremap ^ " maybe figure out how to make this terminal-mode only; makes ctrl-c work in " normal mode nnoremap i " exit the terminal the same way as exiting insert mode tnoremap tnoremap jj " quick quit nnoremap q :q " just close the whole damn editor "nnoremap q :qa! " ctrl-s to save, normal & insert modes nnoremap :w inoremap :wli " clean up whitespace function! CleanupWhitespace() " remove trailing whitespace %s/\s\+$//ge " ensure file starts with exactly one blank line 0put ='' " ensure file ends with exactly one blank line $put ='' " remove multiple blank lines at start/end %s/\%^\n\+/\r/ge %s/\n\+\%$/\r/ge endfunction "nnoremap spaces :call CleanupWhitespace() "nnoremap quotes :%s/'\([^']*\)'/"\1"/g "function! QuickFixes() "endfunction " Goyo nnoremap zen :Goyo function! IntoZen() setlocal linebreak :Limelight " navigate by actual position on screen instead of by row/column nnoremap j gj nnoremap k gk nnoremap $ g$ nnoremap ^ g^ " undos break on punctuation inoremap . .u inoremap ! !u inoremap ? ?u inoremap , ,u inoremap ; ;u inoremap : :u endfunction function! ExitZen() setlocal nolinebreak :Limelight! unmap j unmap k unmap $ unmap ^ iunmap . iunmap ! iunmap ? iunmap , iunmap ; iunmap : endfunction autocmd! User GoyoEnter nested call IntoZen() autocmd! User GoyoLeave nested call ExitZen() " CoC "inoremap " \ coc#pum#visible() ? coc#pum#next(1) : " \ CheckBackspace() ? "\" : " \ coc#refresh() "inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" " Make to accept selected completion item or notify coc.nvim to format " u breaks current undo, please make your own choice "inoremap coc#pum#visible() ? coc#pum#confirm() \: "\u\\=coc#on_enter()\" "function! CheckBackspace() abort " let col = col('.') - 1 " return !col || getline('.')[col - 1] =~# '\s' "endfunction " Use to trigger completion "if has('nvim') " inoremap coc#refresh() "else " inoremap coc#refresh() "endif "nmap gd (coc-definition) "nmap gy (coc-type-definition) "nmap gi (coc-implementation) "nmap gr (coc-references) " show docs in preview window "nnoremap k :call ShowDocumentation() "function! ShowDocumentation() " if CocAction('hasProvider', 'hover') " call CocActionAsync('doHover') " else " call feedkeys('K', 'in') " endif "endfunction " Highlight the symbol and its references when holding the cursor "autocmd CursorHold * silent call CocActionAsync('highlight') " Symbol renaming "nmap r (coc-rename) " Without this line, search results get highlighted whenever I source the file :noh