diff --git a/nvim/coc.vim b/nvim/coc.vim new file mode 100644 index 0000000..173a382 --- /dev/null +++ b/nvim/coc.vim @@ -0,0 +1,41 @@ +" Always show the signcolumn, otherwise it would shift the text each time +" diagnostics appear/become resolved. +if has("nvim-0.5.0") || has("patch-8.1.1564") + " Recently vim can merge signcolumn and number column into one + set signcolumn=number +else + set signcolumn=yes +endif + +" Use tab for trigger completion with characters ahead and navigate. +" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by +" other plugin before putting this into your config. +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() +inoremap pumvisible() ? "\" : "\" + +function! s:check_back_space() 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 + +" GoTo definition +nmap gd (coc-definition) + +" Use for trigger snippet expand. +imap (coc-snippets-expand) + +" Use for jump to next placeholder, it's default of coc.nvim +let g:coc_snippet_next = '' + +" Use for jump to previous placeholder, it's default of coc.nvim +let g:coc_snippet_prev = '' diff --git a/nvim/file-tree.vim b/nvim/file-tree.vim new file mode 100644 index 0000000..b730385 --- /dev/null +++ b/nvim/file-tree.vim @@ -0,0 +1,18 @@ +lua << EOF + require("nvim-tree").setup {} +EOF + +let g:nvim_tree_width = 20 +let g:nvim_tree_ignore = [ '.git' ] +let g:nvim_tree_add_trailing = 1 +let g:nvim_tree_quit_on_open = 1 +let g:nvim_tree_show_icons = { + \ 'git': 0, + \ 'folders': 0, + \ 'files': 0, + \ 'folder_arrows': 0, + \ } + +" Remaps +nnoremap :NvimTreeToggle + diff --git a/nvim/init.vim b/nvim/init.vim index 2051a6b..59d43e4 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -3,8 +3,6 @@ call plug#begin('~/.config/nvim/plugged') " Colorschemes Plug 'ayu-theme/ayu-vim' -Plug 'sainnhe/sonokai' -Plug 'kaicataldo/material.vim' Plug 'tpope/vim-commentary' Plug 'norcalli/nvim-colorizer.lua' @@ -18,11 +16,10 @@ Plug 'evanleck/vim-svelte', {'branch': 'main'} Plug 'kyazdani42/nvim-tree.lua' Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' } Plug 'akinsho/bufferline.nvim' -Plug 'tc50cal/vim-terminal' Plug 'alvan/vim-closetag' -Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'turbio/bracey.vim', { 'do': 'npm install --prefix server' } Plug 'folke/zen-mode.nvim' +Plug 'kyazdani42/nvim-web-devicons' call plug#end() @@ -48,182 +45,28 @@ set shortmess+=c set mouse=nv set termguicolors +set guifont=Fira\ Code:h20 " MY LEADER KEY IS GONNA BE A SPACE let mapleader = " " " Colorscheme let ayucolor = 'mirage' " light/mirage/dark -" let g:sonokai_style = 'andromeda' " default/atlantis/andromeda/shusia/maia/espresso -" let g:material_theme_style = 'ocean' " default/palenight/ocean/lighter/darker - colorscheme ayu " ayu/sonokai/material " Color highlighting lua require'colorizer'.setup() -" let g:clipboard = { -" \ 'name': 'clipboard', -" \ 'copy': { -" \ '+': 'xclip -selection clipboard', -" \ '*': 'xclip -selection clipboard' -" \ }, -" \ 'paste': { -" \ '+': 'xclip -selection clipboard -o', -" \ '*': 'xclip -selection -clipboard -o' -" \ }, -" \ 'cache_enabled': 1, -" \ } + +source $HOME/dotfiles/nvim/file-tree.vim +source $HOME/dotfiles/nvim/remaps.vim +source $HOME/dotfiles/nvim/coc.vim +source $HOME/dotfiles/nvim/tabs.vim - - -" ____ _____ __ __ _ ____ ____ -" | _ \| ____| \/ | / \ | _ \/ ___| -" | |_) | _| | |\/| | / _ \ | |_) \___ \ -" | _ <| |___| | | |/ ___ \| __/ ___) | -" |_| \_\_____|_| |_/_/ \_\_| |____/ -" -" mark: remaps -" These allow me to quickly save and quit vim -nnoremap w :w -nnoremap q :q - -" Remaps to move line under the cursor up and down -nnoremap :m .-2== -nnoremap :m .+1== -vnoremap K :m '<-2gv=gv -vnoremap J :m '>+1gv=gv - - - - -" ____ ___ ____ _ ___ _____ __ __ -" / ___/ _ \ / ___| | \ | \ \ / /_ _| \/ | -" | | | | | | | | \| |\ \ / / | || |\/| | -" | |__| |_| | |___ _| |\ | \ V / | || | | | -" \____\___/ \____(_)_| \_| \_/ |___|_| |_| -" -" -" mark: coc.nvim -" Always show the signcolumn, otherwise it would shift the text each time -" diagnostics appear/become resolved. -if has("nvim-0.5.0") || has("patch-8.1.1564") - " Recently vim can merge signcolumn and number column into one - set signcolumn=number -else - set signcolumn=yes -endif - -" Use tab for trigger completion with characters ahead and navigate. -" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by -" other plugin before putting this into your config. -inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : - \ coc#refresh() -inoremap pumvisible() ? "\" : "\" - -function! s:check_back_space() 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 - -" GoTo definition -nmap gd (coc-definition) - - - -" ____ _ _ ___ ____ ____ _____ _____ ____ -" / ___|| \ | |_ _| _ \| _ \| ____|_ _/ ___| -" \___ \| \| || || |_) | |_) | _| | | \___ \ -" ___) | |\ || || __/| __/| |___ | | ___) | -" |____/|_| \_|___|_| |_| |_____| |_| |____/ -" -" mark: snippets -" Use for trigger snippet expand. -imap (coc-snippets-expand) - -" Use for jump to next placeholder, it's default of coc.nvim -let g:coc_snippet_next = '' - -" Use for jump to previous placeholder, it's default of coc.nvim -let g:coc_snippet_prev = '' - - - -" _____ ___ _ _____ _____ ____ _____ _____ -" | ___|_ _| | | ____| |_ _| _ \| ____| ____| -" | |_ | || | | _| | | | |_) | _| | _| -" | _| | || |___| |___ | | | _ <| |___| |___ -" |_| |___|_____|_____| |_| |_| \_\_____|_____| -" -" -" mark: file tree -let g:nvim_tree_width = 20 -let g:nvim_tree_ignore = [ '.git' ] -let g:nvim_tree_add_trailing = 1 -let g:nvim_tree_show_icons = { - \ 'git': 0, - \ 'folders': 0, - \ 'files': 0, - \ 'folder_arrows': 0, - \ } - -highlight NvimTreeFolderIcon guibg = blue - -" Remaps -nnoremap :NvimTreeToggle - - - -" __ __ _ ____ _ ______ _____ ___ _ -" | \/ | / \ | _ \| |/ / _ \ / _ \ \ / / \ | | -" | |\/| | / _ \ | |_) | ' /| | | | | | \ \ /\ / /| \| | -" | | | |/ ___ \| _ <| . \| |_| | |_| |\ V V / | |\ | -" |_| |_/_/ \_\_| \_\_|\_\____/ \___/ \_/\_/ |_| \_| -" -" mark: markdown +" Filetypes for markdown extension let g:mkdp_filetypes = ['md', 'mdx', 'markdown'] -" Remap to toggle markdown preview -nmap MarkdownPreviewToggle - - - -" _____ _ ____ ____ -" |_ _|/ \ | __ ) ___| -" | | / _ \ | _ \___ \ -" | |/ ___ \| |_) |__) | -" |_/_/ \_\____/____/ -" -" mark: tabs -lua << EOF -require("bufferline").setup{} -EOF - -" These commands will navigate through buffers in order regardless of which mode you are using -" e.g. if you change the order of buffers :bnext and :bprevious will not respect the custom ordering -nnoremap [b :BufferLineCycleNext -nnoremap b] :BufferLineCyclePrev - -nnoremap 1 BufferLineGoToBuffer 1 -nnoremap 2 BufferLineGoToBuffer 2 -nnoremap 3 BufferLineGoToBuffer 3 -nnoremap 4 BufferLineGoToBuffer 4 -nnoremap 5 BufferLineGoToBuffer 5 -nnoremap 6 BufferLineGoToBuffer 6 -nnoremap 7 BufferLineGoToBuffer 7 -nnoremap 8 BufferLineGoToBuffer 8 -nnoremap 9 BufferLineGoToBuffer 9 - diff --git a/nvim/remaps.vim b/nvim/remaps.vim new file mode 100644 index 0000000..626261f --- /dev/null +++ b/nvim/remaps.vim @@ -0,0 +1,12 @@ +" These allow me to quickly save and quit vim +nnoremap w :w +nnoremap q :q + +" Remaps to move line under the cursor up and down +nnoremap :m .-2== +nnoremap :m .+1== +vnoremap K :m '<-2gv=gv +vnoremap J :m '>+1gv=gv + +" Remap to toggle markdown preview +nmap MarkdownPreviewToggle diff --git a/nvim/tabs.vim b/nvim/tabs.vim new file mode 100644 index 0000000..9580d93 --- /dev/null +++ b/nvim/tabs.vim @@ -0,0 +1,17 @@ +lua << EOF +require("bufferline").setup{} +EOF + +nnoremap :BufferLineCyclePrev +nnoremap :BufferLineCycleNext + +nnoremap 1 BufferLineGoToBuffer 1 +nnoremap 2 BufferLineGoToBuffer 2 +nnoremap 3 BufferLineGoToBuffer 3 +nnoremap 4 BufferLineGoToBuffer 4 +nnoremap 5 BufferLineGoToBuffer 5 +nnoremap 6 BufferLineGoToBuffer 6 +nnoremap 7 BufferLineGoToBuffer 7 +nnoremap 8 BufferLineGoToBuffer 8 +nnoremap 9 BufferLineGoToBuffer 9 +