From ed4daf7429bf2580118aad87b8f3e2011efed7ec Mon Sep 17 00:00:00 2001 From: Jacob McDonnell Date: Thu, 14 Jul 2022 19:09:06 -0400 Subject: Initial commit --- .config/nvim/init.vim | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 .config/nvim/init.vim (limited to '.config/nvim/init.vim') diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim new file mode 100644 index 0000000..e9498bf --- /dev/null +++ b/.config/nvim/init.vim @@ -0,0 +1,95 @@ +" Basic setup stuff +let mapleader=" " +set number relativenumber +filetype plugin on +syntax on +set wildmode=longest,list,full +set mouse=a +set colorcolumn=80 + +" Spell check +map o :setlocal spell! spelllang=en_us + +" Open a terminal +map t :vsplit term://zsh + +" Change Line break to 120 +map l :set colorcolumn=120 +" Change Line break to 80 +map L :set colorcolumn=80 + +" Removes spaces at the end of lines when saving +autocmd BufWritePre * %s/\s\+$//e + +" Center Cursor when entering insert mode +autocmd InsertEnter * norm zz + +" Fixing indenting visual block +vmap < >gv + +" Makes splitting default to the right and to the bottom +set splitbelow splitright + +" Remaps moving keys for splitting +map h +map j +map k +map l + +" Plugins +call plug#begin('~/.local/share/nvim/plugged') +Plug 'junegunn/goyo.vim' " Nice for reading Documents +Plug 'neoclide/coc.nvim', {'branch': 'release'} " Code Completion +Plug 'tpope/vim-commentary' " Makes commenting multiple lines easier +Plug 'vimwiki/vimwiki' +Plug 'NLKNguyen/papercolor-theme' +call plug#end() + +" Goyo plugin makes text more readable when writing prose: +map f :Goyo \| set bg=dark \| set linebreak + +" Commentary plugin +map c :Commentary \| set linebreak + +" use for trigger completion and navigate to the next complete item +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~ '\s' +endfunction + +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() +let g:coc_global_extensions = [ + \ 'coc-html', + \ 'coc-java', + \ 'coc-tsserver', + \ 'coc-css', + \ 'coc-clangd', + \ 'coc-go', + \ 'coc-pairs' + \ ] + +" runs gofmt when closing a go file. +autocmd VimLeave *.go !gofmt -w % + +set t_Co=256 + +" ChangeBackground changes the background mode based on macOS's `Appearance` +" setting. We also refresh the statusline colors to reflect the new mode. +function! ChangeBackground() + if system("defaults read -g AppleInterfaceStyle") =~ '^Dark' + set background=dark " for the dark version of the theme + else + set background=light " for the light version of the theme + endif +endfunction + +" initialize the colorscheme for the first run +call ChangeBackground() + +map b :call ChangeBackground() + +colorscheme PaperColor -- cgit v1.2.3