diff --git a/nvim/config.vim b/nvim/config.vim new file mode 100644 index 0000000..c211376 --- /dev/null +++ b/nvim/config.vim @@ -0,0 +1,34 @@ +" - Config - +"" Encoding +set encoding=utf8 +"" Disable modeline +set nomodeline +"" System undo levels +set undofile +set undolevels=100 +"" Indenting +set tabstop=2 +set softtabstop=2 +set shiftwidth=2 +set expandtab +"" Disable error sounds +set noerrorbells +"" Stop word wrapping +set nowrap +"" Show invisible characters +set conceallevel=1 +"" Enable search highlighting +set hlsearch +"" Line Numbers +set number relativenumber +"" Top/Bottom scroll padding +set scrolloff=3 +set sidescrolloff=5 +"" Enable autoread if file changes +set autoread +"" Hide Buffers +set hidden +"" Statusline +set laststatus=0 +"" termguicolors +set termguicolors diff --git a/nvim/init.vim b/nvim/init.vim index 987c841..987ec0c 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -1,183 +1,3 @@ -" - Config - -"" Encoding -set encoding=utf8 -"" Disable modeline -set nomodeline -"" System undo levels -set undofile -set undolevels=100 -"" Indenting -set tabstop=2 -set softtabstop=2 -set shiftwidth=2 -set expandtab -"" Disable error sounds -set noerrorbells -"" Stop word wrapping -set nowrap -"" Show invisible characters -set conceallevel=1 -"" Enable search highlighting -set hlsearch -"" Line Numbers -set number relativenumber -"" Top/Bottom scroll padding -set scrolloff=3 -set sidescrolloff=5 -"" Enable autoread if file changes -set autoread -"" Hide Buffers -set hidden -"" Statusline -set laststatus=0 -"" termguicolors -set termguicolors - -" - Mappings - -"" Map Leader to spacebar -let mapleader=" " -"" Open Custom Help -nnoremap ? :e $XDG_CONFIG_HOME/nvim/help.md -nnoremap / :e $XDG_CONFIG_HOME/nvim/help.md -"" Shortcut to save -nnoremap w :w -"" Moving current lines up/down -nnoremap k :execute 'move -1-'. v:count1 -nnoremap j :execute 'move +'. v:count1 -"" Buffers Next/Previous -nnoremap :bnext -nnoremap :bprev - "" Shortcut to close buffer - nnoremap :bd - "" Shortcut to reopen closed buffer - nmap - -" auto-install vim-plug -if empty(glob('~/.config/nvim/autoload/plug.vim')) - silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs - \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - "autocmd VimEnter * PlugInstall - "autocmd VimEnter * PlugInstall | source $MYVIMRC -endif - -" ale before -let g:ale_completion_enabled = 1 -let g:ale_completion_autoimport = 1 - -call plug#begin('~/.config/nvim/autoload/plugged') - Plug 'mhinz/vim-startify' - Plug 'dracula/vim' - Plug 'cossonleo/neo-smooth-scroll.nvim' - Plug 'kyazdani42/nvim-web-devicons' - - Plug 'romgrk/barbar.nvim' - - Plug 'ojroques/vim-oscyank' - Plug 'sjl/vitality.vim' - - Plug 'dense-analysis/ale' - Plug 'tpope/vim-commentary' - Plug 'prettier/vim-prettier', { 'do': 'yarn install' } - Plug 'lifepillar/vim-mucomplete' - - Plug 'wellle/context.vim' - Plug 'Yggdroot/indentLine' - - Plug 'lambdalisue/fern.vim' - - Plug 'nvim-lua/popup.nvim' - Plug 'nvim-lua/plenary.nvim' - Plug 'mhinz/vim-grepper', { 'on': ['Grepper', '(GrepperOperator)'] } - Plug 'nvim-telescope/telescope.nvim' - Plug 'BurntSushi/ripgrep' - - Plug 'nvim-lua/plenary.nvim' - Plug 'lewis6991/gitsigns.nvim' - - if executable('ctags') - Plug 'ludovicchabant/vim-gutentags' - endif - - Plug 'pangloss/vim-javascript' - Plug 'vim-ruby/vim-ruby' -call plug#end() - -" dracula colorscheme -let g:dracula_colorterm = 0 " Set background as transparent -colorscheme dracula - -" ale -let b:ale_fixers = ['prettier', 'eslint'] -let g:ale_fix_on_save = 1 - -" prettier -let g:prettier#autoformat_config_present = 1 - -" javascript -let g:javascript_plugin_jsdoc = 1 -let g:javascript_conceal_function = "ƒ" - -" mucomplete -set completeopt+=menuone -set completeopt+=noselect -set shortmess+=c " Shut off completion messages - -" indentLine -let g:indentLine_char_list = ['|', '¦', '┆', '┊'] - -" fern -nnoremap ` :Fern . -reveal=% - -" oscyank -autocmd TextYankPost * if v:event.operator is 'y' && v:event.regname is '+' | OSCYankReg + | endif - -" Find files using Telescope command-line sugar. -nnoremap ff Telescope git_files -nnoremap fr Telescope registers -nnoremap fb Telescope buffers -nnoremap fgb Telescope git_branches -nnoremap fgc Telescope git_commits -nnoremap fgt Telescope tags - -" gitsigns -lua << EOF - require('gitsigns').setup { - keymaps = { - noremap = true, - buffer = true, - - ['n hn'] = { expr = true, "&diff ? ']c' : 'lua require\"gitsigns\".next_hunk()'"}, - ['n hp'] = { expr = true, "&diff ? '[c' : 'lua require\"gitsigns\".prev_hunk()'"}, - - ['n hs'] = 'lua require"gitsigns".stage_hunk()', - ['n hu'] = 'lua require"gitsigns".undo_stage_hunk()', - ['n hr'] = 'lua require"gitsigns".reset_hunk()', - ['n hR'] = 'lua require"gitsigns".reset_buffer()', - ['n hd'] = 'lua require"gitsigns".preview_hunk()', - ['n gb'] = 'lua require"gitsigns".blame_line()', - } - } -EOF -set statusline+=%{get(b:,'gitsigns_status','')} - -"" vim-startify -let g:startify_custom_header = [ - \ 'Gaiety | 2021', - \ ' .:::: .:: .:: .:: ', - \ ' .: .:: .:: .:: .:: .:: .:: ', - \ '.:: .:: .:: .:::: .:.: .: .:: .:: .::: .:: .:: .:: .:.: .:', - \ '.:: .: .: .:: .:: .:: .:: .:: .:: .:: .:: .: .:: .: .:: .:: ', - \ '.:: .::::.:: .::.:: .:: .::: .:: .:: .:: .:: .:: .: .::.::::: .:: .:: ', - \ ' .:: .: .: .:: .:: .:: .:: .:: .:: .:: .:: .:: .:: .: .::.: .:: ', - \ ' .::::: .:: .:: .:: .:: .:: .:: .:::: .:: .::: .: .:: .:::: .:: ', - \ '', - \ 'MAPPING ACTION', - \ '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━', - \ ' Leader', - \ '? List Bindings', - \ '', -\ ] -let g:startify_change_to_dir = 0 - -"" grepper -nnoremap gg Grepper +source $XDG_CONFIG_HOME/nvim/config.vim +source $XDG_CONFIG_HOME/nvim/plugins.vim +source $XDG_CONFIG_HOME/nvim/keybindings.vim diff --git a/nvim/keybindings.vim b/nvim/keybindings.vim new file mode 100644 index 0000000..18a2ec3 --- /dev/null +++ b/nvim/keybindings.vim @@ -0,0 +1,32 @@ +" - Core Key Bindings - +"" Map Leader to spacebar +let mapleader=" " +"" Open Custom Help +nnoremap ? :e $XDG_CONFIG_HOME/nvim/help.md +nnoremap / :e $XDG_CONFIG_HOME/nvim/help.md +"" Shortcut to save +nnoremap w :w +"" Moving current lines up/down +nnoremap k :execute 'move -1-'. v:count1 +nnoremap j :execute 'move +'. v:count1 +"" Buffers Next/Previous +nnoremap :bnext +nnoremap :bprev + "" Shortcut to close buffer + nnoremap :bd + "" Shortcut to reopen closed buffer + nmap + +" - Plugin Key Bindings - +"" grepper +nnoremap gg Grepper +" Find files using Telescope command-line sugar. +nnoremap ff Telescope git_files +nnoremap fr Telescope registers +nnoremap fb Telescope buffers +nnoremap fgb Telescope git_branches +nnoremap fgc Telescope git_commits +nnoremap fgt Telescope tags +" fern +nnoremap ` :Fern . -reveal=% + diff --git a/nvim/plugins.vim b/nvim/plugins.vim new file mode 100644 index 0000000..e08829d --- /dev/null +++ b/nvim/plugins.vim @@ -0,0 +1,115 @@ +" auto-install vim-plug +if empty(glob('~/.config/nvim/autoload/plug.vim')) + silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + "autocmd VimEnter * PlugInstall + "autocmd VimEnter * PlugInstall | source $MYVIMRC +endif + +" ale before +let g:ale_completion_enabled = 1 +let g:ale_completion_autoimport = 1 + +call plug#begin('~/.config/nvim/autoload/plugged') + Plug 'mhinz/vim-startify' + Plug 'dracula/vim' + Plug 'cossonleo/neo-smooth-scroll.nvim' + Plug 'kyazdani42/nvim-web-devicons' + + Plug 'romgrk/barbar.nvim' + + Plug 'ojroques/vim-oscyank' + Plug 'sjl/vitality.vim' + + Plug 'dense-analysis/ale' + Plug 'tpope/vim-commentary' + Plug 'prettier/vim-prettier', { 'do': 'yarn install' } + Plug 'lifepillar/vim-mucomplete' + + Plug 'wellle/context.vim' + Plug 'Yggdroot/indentLine' + + Plug 'lambdalisue/fern.vim' + + Plug 'nvim-lua/popup.nvim' + Plug 'nvim-lua/plenary.nvim' + Plug 'mhinz/vim-grepper', { 'on': ['Grepper', '(GrepperOperator)'] } + Plug 'nvim-telescope/telescope.nvim' + Plug 'BurntSushi/ripgrep' + + Plug 'nvim-lua/plenary.nvim' + Plug 'lewis6991/gitsigns.nvim' + + if executable('ctags') + Plug 'ludovicchabant/vim-gutentags' + endif + + Plug 'pangloss/vim-javascript' + Plug 'vim-ruby/vim-ruby' +call plug#end() + +" dracula colorscheme +let g:dracula_colorterm = 0 " Set background as transparent +colorscheme dracula + +" ale +let b:ale_fixers = ['prettier', 'eslint'] +let g:ale_fix_on_save = 1 + +" prettier +let g:prettier#autoformat_config_present = 1 + +" javascript +let g:javascript_plugin_jsdoc = 1 +let g:javascript_conceal_function = "ƒ" + +" mucomplete +set completeopt+=menuone +set completeopt+=noselect +set shortmess+=c " Shut off completion messages + +" indentLine +let g:indentLine_char_list = ['|', '¦', '┆', '┊'] + +" oscyank +autocmd TextYankPost * if v:event.operator is 'y' && v:event.regname is '+' | OSCYankReg + | endif + +" gitsigns +lua << EOF + require('gitsigns').setup { + keymaps = { + noremap = true, + buffer = true, + + ['n hn'] = { expr = true, "&diff ? ']c' : 'lua require\"gitsigns\".next_hunk()'"}, + ['n hp'] = { expr = true, "&diff ? '[c' : 'lua require\"gitsigns\".prev_hunk()'"}, + + ['n hs'] = 'lua require"gitsigns".stage_hunk()', + ['n hu'] = 'lua require"gitsigns".undo_stage_hunk()', + ['n hr'] = 'lua require"gitsigns".reset_hunk()', + ['n hR'] = 'lua require"gitsigns".reset_buffer()', + ['n hd'] = 'lua require"gitsigns".preview_hunk()', + ['n gb'] = 'lua require"gitsigns".blame_line()', + } + } +EOF +set statusline+=%{get(b:,'gitsigns_status','')} + +"" vim-startify +let g:startify_custom_header = [ + \ 'Gaiety | 2021', + \ ' .:::: .:: .:: .:: ', + \ ' .: .:: .:: .:: .:: .:: .:: ', + \ '.:: .:: .:: .:::: .:.: .: .:: .:: .::: .:: .:: .:: .:.: .:', + \ '.:: .: .: .:: .:: .:: .:: .:: .:: .:: .:: .: .:: .: .:: .:: ', + \ '.:: .::::.:: .::.:: .:: .::: .:: .:: .:: .:: .:: .: .::.::::: .:: .:: ', + \ ' .:: .: .: .:: .:: .:: .:: .:: .:: .:: .:: .:: .:: .: .::.: .:: ', + \ ' .::::: .:: .:: .:: .:: .:: .:: .:::: .:: .::: .: .:: .:::: .:: ', + \ '', + \ 'MAPPING ACTION', + \ '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━', + \ ' Leader', + \ '? List Bindings', + \ '', +\ ] +let g:startify_change_to_dir = 0