diff --git a/nvim/init.vim b/nvim/init.vim index 998e9bb..a39c95b 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -5,6 +5,18 @@ Plug 'ayu-theme/ayu-vim' Plug 'tpope/vim-commentary' Plug 'norcalli/nvim-colorizer.lua' Plug 'jiangmiao/auto-pairs' +Plug 'neoclide/coc.nvim', {'branch': 'release'} +Plug 'prettier/vim-prettier', {'do': 'yarn install'} +Plug 'fatih/vim-go' +Plug 'pangloss/vim-javascript' +Plug 'leafgarland/typescript-vim' +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() } } call plug#end() @@ -21,6 +33,11 @@ set expandtab set wrap set noswapfile set encoding=utf-8 +set hidden +set nowritebackup +set cmdheight=2 +set updatetime=300 +set shortmess+=c set termguicolors @@ -34,6 +51,14 @@ colorscheme ayu " Color highlighting lua require'colorizer'.setup() + + +" ____ _____ __ __ _ ____ ____ +" | _ \| ____| \/ | / \ | _ \/ ___| +" | |_) | _| | |\/| | / _ \ | |_) \___ \ +" | _ <| |___| | | |/ ___ \| __/ ___) | +" |_| \_\_____|_| |_/_/ \_\_| |____/ +" " mark: remaps " These allow me to quickly save and quit vim nnoremap w :w @@ -44,3 +69,171 @@ 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 +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 + + + + +" ______ _______ _ _____ _____ +" / ___\ \ / / ____| | |_ _| ____| +" \___ \\ \ / /| _| | | | | | _| +" ___) |\ V / | |___| |___| | | |___ +" |____/ \_/ |_____|_____|_| |_____| +" +" mark: svelte +let g:svelte_preprocessors = ['typescript', 'scss'] + + + +" _ _ _____ __ __ _ +" | | | |_ _| \/ | | +" | |_| | | | | |\/| | | +" | _ | | | | | | | |___ +" |_| |_| |_| |_| |_|_____| +" +" mark: html +let g:closetag_filenames = '*.html,*.svelte,*.jsx,*.tsx' +let g:closetag_regions = { + \ 'typescript.tsx': 'jsxRegion,tsxRegion', + \ 'javascript.jsx': 'jsxRegion', + \ 'typescriptreact': 'jsxRegion,tsxRegion', + \ 'javascriptreact': 'jsxRegion', + \ } + + + +" _____ _ _ ____________ __ _____ ___ _ _ ____ _____ ____ +" | ___| | | |__ /__ /\ \ / / | ___|_ _| \ | | _ \| ____| _ \ +" | |_ | | | | / / / / \ V / | |_ | || \| | | | | _| | |_) | +" | _| | |_| |/ /_ / /_ | | | _| | || |\ | |_| | |___| _ < +" |_| \___//____/____| |_| |_| |___|_| \_|____/|_____|_| \_\ +" +" mark: fuzzy finder +nnoremap f :FZF