From 6f62e54e6fbf04dd9df2d7a3b72ae2df426d837f Mon Sep 17 00:00:00 2001 From: Garrit Franke Date: Tue, 6 Jul 2021 09:03:29 +0200 Subject: [PATCH] feat(nvim): split up config --- .config/nvim/init.vim | 79 +++++++++---------------------------------- .config/nvim/plug.vim | 32 ++++++++++++++++++ .config/nvim/sets.vim | 30 ++++++++++++++++ 3 files changed, 78 insertions(+), 63 deletions(-) create mode 100644 .config/nvim/plug.vim create mode 100644 .config/nvim/sets.vim diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 9035737..56e7d80 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -1,3 +1,5 @@ +" Fundamentals "{{{ +" --------------------------------------------------------------------- set nocompatible " be iMproved, required filetype off " required @@ -8,75 +10,19 @@ if empty(glob('~/.vim/autoload/plug.vim')) autocmd VimEnter * PlugInstall --sync | source $MYVIMRC endif -call plug#begin() -Plug 'gruvbox-community/gruvbox' -Plug 'itchyny/lightline.vim' -Plug 'scrooloose/nerdtree' -Plug 'prettier/vim-prettier' -Plug 'tpope/vim-fugitive' -Plug 'airblade/vim-gitgutter' -Plug 'pangloss/vim-javascript' -Plug 'mxw/vim-jsx' -Plug 'luochen1990/rainbow' -Plug 'preservim/nerdcommenter' -Plug 'kshenoy/vim-signature' - -" FZF -Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } -Plug 'junegunn/fzf.vim' - -" Telescope -Plug 'nvim-lua/popup.nvim' -Plug 'nvim-lua/plenary.nvim' -Plug 'nvim-telescope/telescope.nvim' - -" Defines the sneak motion -Plug 'justinmk/vim-sneak' - -" HTML auto completion -Plug 'alvan/vim-closetag' -Plug 'neoclide/coc.nvim', {'branch': 'release'} - -" Antimony syntax highlighting -Plug 'antimony-lang/antimony.vim' -call plug#end() +"}}} filetype plugin indent on " required +" Load plugins +runtime ./plug.vim + colorscheme gruvbox let mapleader=" " " Set leader key -syntax on " Enable syntax highlighting -call matchadd('ColorColumn', '\%81v', 100) " Show a column after 80 chars - -set number relativenumber " Show line numbers in relative manner -set mouse=a " Enable mouse -set updatetime=300 " Quicker update time means snappier feedback -set mousemodel=popup_setpos -set tabstop=4 softtabstop=4 -set shiftwidth=4 -set smartindent -set expandtab -set backspace=indent,eol,start -set showmatch -set noswapfile -set nobackup -set nowritebackup -set shortmess+=c " Don't pass messages to |ins-completion-menu|. -set cmdheight=2 " Give more space for displaying messages. -set ignorecase -set scrolloff=8 -set hidden -set linebreak -set laststatus=2 -set noshowmode -set nohlsearch - -" Reload changes from disk whenever the file changed -" https://stackoverflow.com/a/41012424/9046809 -set autoread -autocmd FocusGained * checktime +" Set variables +runtime ./sets.vim " Fix for smart indent edge-case " https://vi.stackexchange.com/a/22924 @@ -100,6 +46,7 @@ let g:prettier#autoformat = 0 set completeopt+=menuone set completeopt+=noselect set completeopt+=noinsert +set completeopt+=preview set shortmess+=c " Shut off completion messages set belloff+=ctrlg " If Vim beeps during completion let g:mucomplete#enable_auto_at_startup = 1 @@ -297,7 +244,13 @@ nnoremap :tabn nnoremap :tabn nnoremap :tabp nnoremap :tabp -nnoremap b :Telescope git_branches + +" Git shortcuts +nnoremap gb :Telescope git_branches +nnoremap gs :Git +nnoremap gc :Git commit +nnoremap ga :Git add . +nnoremap gp :Git push nnoremap k gk nnoremap j gj diff --git a/.config/nvim/plug.vim b/.config/nvim/plug.vim new file mode 100644 index 0000000..bbcf665 --- /dev/null +++ b/.config/nvim/plug.vim @@ -0,0 +1,32 @@ +call plug#begin() +Plug 'gruvbox-community/gruvbox' +Plug 'itchyny/lightline.vim' +Plug 'scrooloose/nerdtree' +Plug 'prettier/vim-prettier' +Plug 'tpope/vim-fugitive' +Plug 'airblade/vim-gitgutter' +Plug 'pangloss/vim-javascript' +Plug 'mxw/vim-jsx' +Plug 'luochen1990/rainbow' +Plug 'preservim/nerdcommenter' +Plug 'kshenoy/vim-signature' + +" FZF +Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } +Plug 'junegunn/fzf.vim' + +" Telescope +Plug 'nvim-lua/popup.nvim' +Plug 'nvim-lua/plenary.nvim' +Plug 'nvim-telescope/telescope.nvim' + +" Defines the sneak motion +Plug 'justinmk/vim-sneak' + +" HTML auto completion +Plug 'alvan/vim-closetag' +Plug 'neoclide/coc.nvim', {'branch': 'release'} + +" Antimony syntax highlighting +Plug 'antimony-lang/antimony.vim' +call plug#end() diff --git a/.config/nvim/sets.vim b/.config/nvim/sets.vim new file mode 100644 index 0000000..8835e73 --- /dev/null +++ b/.config/nvim/sets.vim @@ -0,0 +1,30 @@ +syntax on " Enable syntax highlighting +call matchadd('ColorColumn', '\%81v', 100) " Show a column after 80 chars + +set number relativenumber " Show line numbers in relative manner +set mouse=a " Enable mouse +set updatetime=300 " Quicker update time means snappier feedback +set mousemodel=popup_setpos +set tabstop=4 softtabstop=4 +set shiftwidth=4 +set smartindent +set expandtab +set backspace=indent,eol,start +set showmatch +set noswapfile +set nobackup +set nowritebackup +set shortmess+=c " Don't pass messages to |ins-completion-menu|. +set cmdheight=2 " Give more space for displaying messages. +set ignorecase +set scrolloff=8 +set hidden +set linebreak +set laststatus=2 +set noshowmode +set nohlsearch + +" Reload changes from disk whenever the file changed +" https://stackoverflow.com/a/41012424/9046809 +set autoread +autocmd FocusGained * checktime