"***************************************************************************** """ Vim-Plug core "***************************************************************************** let vimplug_exists=expand('~/.config/nvim/autoload/plug.vim') let curl_exists=expand('curl') if !filereadable(vimplug_exists) if !executable(curl_exists) echoerr "You have to install curl or first install vim-plug yourself!" execute "q!" endif echo "Installing Vim-Plug..." echo "" silent exec "!"curl_exists" -fLo " . shellescape(vimplug_exists) . " --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" let g:not_finish_vimplug = "yes" autocmd VimEnter * PlugInstall endif " Required: call plug#begin(expand('~/.config/nvim/plugged')) Plug 'neovim/nvim-lspconfig' Plug 'hrsh7th/nvim-cmp' Plug 'hrsh7th/cmp-nvim-lsp' Plug 'hrsh7th/cmp-buffer' Plug 'hrsh7th/cmp-path' Plug 'hrsh7th/cmp-cmdline' " For vsnip users. Plug 'hrsh7th/cmp-vsnip' Plug 'hrsh7th/vim-vsnip' Plug 'ray-x/lsp_signature.nvim' Plug 'tomasr/molokai' Plug 'scrooloose/nerdcommenter' Plug 'vim-scripts/DrawIt' Plug 'easymotion/vim-easymotion' Plug 'mattn/emmet-vim' Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } Plug 'pangloss/vim-javascript' " tagbar " golang install go get -u github.com/jstemmer/gotags Plug 'majutsushi/tagbar' Plug 'w0rp/ale' Plug 'godlygeek/tabular' Plug 'plasticboy/vim-markdown' Plug 'ctrlpvim/ctrlp.vim' Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' " defx file explorer " require python package pynvim " install `pip3 install --user pynvim` " Plug 'Shougo/defx.nvim', { 'do': ':UpdateRemotePlugins' } Plug 'kyazdani42/nvim-web-devicons' " for file icons Plug 'kyazdani42/nvim-tree.lua' Plug 'vim-airline/vim-airline' Plug 'kien/tabman.vim' " for git Plug 'tpope/vim-fugitive' Plug 'christoomey/vim-conflicted' " for mark Plug 'inkarkat/vim-ingo-library' Plug 'inkarkat/vim-mark' Plug 'rking/ag.vim' Plug 'terryma/vim-multiple-cursors' Plug 'lukas-reineke/indent-blankline.nvim' Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " temp plugin Plug 'tpope/vim-surround' Plug 'buoto/gotests-vim' Plug 'chr4/nginx.vim' Plug 'cespare/vim-toml' Plug 'zah/nim.vim' Plug 'rust-lang/rust.vim' Plug 'danilo-augusto/vim-afterglow' Plug 'vim-scripts/TaskList.vim' Plug 'google/vim-jsonnet' call plug#end() syntax on set number set tabstop=2 set shiftwidth=2 set expandtab set nofoldenable set pastetoggle= " always show status set laststatus=2 " show cursor position set ruler set cursorline set cursorcolumn set hlsearch " no wrap line set nowrap " enable backspace set backspace=indent,eol,start set encoding=utf-8 set completeopt=menu,menuone,noselect set noswapfile set mouse= " set guifont=Hack\ Nerd\ Font:h11 set background=dark function! AdaptColorscheme() highlight clear CursorLine highlight Normal ctermbg=none highlight LineNr ctermbg=none highlight Folded ctermbg=none highlight NonText ctermbg=none highlight SpecialKey ctermbg=none highlight VertSplit ctermbg=none highlight SignColumn ctermbg=none endfunction autocmd ColorScheme * call AdaptColorscheme() " colorscheme turtles colorscheme afterglow " define leader key let mapleader=";" filetype indent on " 開啟檔案類型偵測 filetype on " 根據檔案類型載入plugin filetype plugin on " split window nmap sw nmap sww k nmap sws j nmap swa h nmap swd l nnoremap fl :Lines nnoremap fb :BLines nnoremap ff :Files nnoremap fg :GFiles nnoremap f? :GFiles? nnoremap ft :Tags nnoremap fa :Ag nnoremap fc :Commits nmap aa gT nmap dd gt nnoremap me :NvimTreeToggle nnoremap :NvimTreeToggle function! TabCloseRight(bang) let cur=tabpagenr() while cur < tabpagenr('$') exe 'tabclose' . a:bang . ' ' . (cur + 1) endwhile endfunction function! TabCloseLeft(bang) while tabpagenr() > 1 exe 'tabclose' . a:bang . ' 1' endwhile endfunction command! -bang Tabcloseright call TabCloseRight('') command! -bang Tabcloseleft call TabCloseLeft('') " tagbar nmap :TagbarToggle nmap :%!jq . " NeoComplete let g:neocomplete#enable_at_startup = 1 let g:airline_powerline_fonts = 1 " f{char} to move to {char} map f (easymotion-bd-f) nmap f (easymotion-overwin-f) " s{char}{char} to move to {char}{char} nmap s (easymotion-overwin-f2) " Move to line map L (easymotion-bd-jk) nmap L (easymotion-overwin-line) " Move to word map w (easymotion-bd-w) nmap w (easymotion-overwin-w) " lint let g:ale_linters = { \ 'javascript': [{{js_linter}}], \ 'go': ['gopls'], \ 'rust': ['analyzer'], \} let g:ale_fixers = {'javascript': [{{js_fixer}}]} let g:ale_linters_explicit = 1 let g:ale_lint_on_save = 1 let g:ale_fix_on_save = 1 nmap = (ale_fix) " NERDCommenter let g:NERDSpaceDelims=1 let g:NERDDefaultAlign='left' let g:tagbar_type_go = { \ 'ctagstype' : 'go', \ 'kinds' : [ \ 'p:package', \ 'i:imports:1', \ 'c:constants', \ 'v:variables', \ 't:types', \ 'n:interfaces', \ 'w:fields', \ 'e:embedded', \ 'm:methods', \ 'r:constructor', \ 'f:functions' \ ], \ 'sro' : '.', \ 'kind2scope' : { \ 't' : 'ctype', \ 'n' : 'ntype' \ }, \ 'scope2kind' : { \ 'ctype' : 't', \ 'ntype' : 'n' \ }, \ 'ctagsbin' : 'gotags', \ 'ctagsargs' : '-sort -silent' \ } " copilot setup imap