-
replace .vimrc
-
install vim-plug
-
Open vim, at command mode, run
:PlugInstall
Last active
May 30, 2023 18:35
-
-
Save zzhuolun/be177dacdf2e201b4929550e5febe570 to your computer and use it in GitHub Desktop.
My vim conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " Comments in Vimscript start with a `"`. | |
| " | |
| " If you open this file in Vim, it'll be syntax highlighted for you. | |
| " Vim is based on Vi. Setting `nocompatible` switches from the default | |
| " Vi-compatibility mode and enables useful Vim functionality. This | |
| " configuration option turns out not to be necessary for the file named | |
| " '~/.vimrc', because Vim automatically enters nocompatible mode if that file | |
| " is present. But we're including it here just in case this config file is | |
| " loaded some other way (e.g. saved as `foo`, and then Vim started with | |
| " `vim -u foo`). | |
| set nocompatible | |
| " Turn on syntax highlighting. | |
| syntax on | |
| " Disable the default Vim startup message. | |
| set shortmess+=I | |
| " Show line numbers. | |
| set number | |
| " This enables relative line numbering mode. With both number and | |
| " relativenumber enabled, the current line shows the true line number, while | |
| " all other lines (above and below) are numbered relative to the current line. | |
| " This is useful because you can tell, at a glance, what count is needed to | |
| " jump up or down to a particular line, by {count}k to go up or {count}j to go | |
| " down. | |
| set relativenumber | |
| " Always show the status line at the bottom, even if you only have one window open. | |
| " set laststatus=2 | |
| " The backspace key has slightly unintuitive behavior by default. For example, | |
| " by default, you can't backspace before the insertion point set with 'i'. | |
| " This configuration makes backspace behave more reasonably, in that you can | |
| " backspace over anything. | |
| set backspace=indent,eol,start | |
| " By default, Vim doesn't let you hide a buffer (i.e. have a buffer that isn't | |
| " shown in any window) that has unsaved changes. This is to prevent you from " | |
| " forgetting about unsaved changes and then quitting e.g. via `:qa!`. We find | |
| " hidden buffers helpful enough to disable this protection. See `:help hidden` | |
| " for more information on this. | |
| set hidden | |
| " This setting makes search case-insensitive when all characters in the string | |
| " being searched are lowercase. However, the search becomes case-sensitive if | |
| " it contains any capital letters. This makes searching more convenient. | |
| set ignorecase | |
| set smartcase | |
| " Enable searching as you type, rather than waiting till you press enter. | |
| set incsearch | |
| set cc=88 | |
| " Unbind some useless/annoying default key bindings. | |
| nmap Q <Nop> " 'Q' in normal mode enters Ex mode. You almost never want this. | |
| " Disable audible bell because it's annoying. | |
| set noerrorbells visualbell t_vb= | |
| " Enable mouse support. You should avoid relying on this too much, but it can | |
| " sometimes be convenient. | |
| set mouse+=a | |
| " Try to prevent bad habits like using the arrow keys for movement. This is | |
| " not the only possible bad habit. For example, holding down the h/j/k/l keys | |
| " for movement, rather than using more efficient movement commands, is also a | |
| " bad habit. The former is enforceable through a .vimrc, while we don't know | |
| " how to prevent the latter. | |
| " Do this in normal mode... | |
| " nnoremap <Left> :echoe "Use h"<CR> | |
| " nnoremap <Right> :echoe "Use l"<CR> | |
| " nnoremap <Up> :echoe "Use k"<CR> | |
| " nnoremap <Down> :echoe "Use j"<CR> | |
| " " ...and in insert mode | |
| " inoremap <Left> <ESC>:echoe "Use h"<CR> | |
| " inoremap <Right> <ESC>:echoe "Use l"<CR> | |
| " inoremap <Up> <ESC>:echoe "Use k"<CR> | |
| " inoremap <Down> <ESC>:echoe "Use j"<CR> | |
| " | |
| " filetype plugin indent on | |
| " show existing tab with 4 spaces width | |
| set tabstop=4 | |
| " when indenting with '>', use 4 spaces width | |
| set shiftwidth=4 | |
| " On pressing tab, insert 4 spaces | |
| set expandtab | |
| nnoremap q <c-v> | |
| set nocompatible " required | |
| filetype off " required | |
| "" set the runtime path to include Vundle and initialize | |
| "set rtp+=~/.vim/bundle/Vundle.vim | |
| "call vundle#begin() | |
| "" alternatively, pass a path where Vundle should install plugins | |
| ""call vundle#begin('~/some/path/here') | |
| "" let Vundle manage Vundle, required | |
| "Plugin 'gmarik/Vundle.vim' | |
| "" add all your plugins here (note older versions of Vundle | |
| "" used Bundle instead of Plugin) | |
| "" Plugin 'ycm-core/YouCompleteMe' | |
| "" Plugin 'nvie/vim-flake8' | |
| "Plugin 'dense-analysis/ale' | |
| "Plugin 'sheerun/vim-polyglot' | |
| "Plugin 'tpope/vim-commentary' | |
| "" ... | |
| "" All of your Plugins must be added before the following line | |
| "call vundle#end() " required | |
| call plug#begin() | |
| Plug 'tpope/vim-commentary' | |
| " Plug 'arcticicestudio/nord-vim' | |
| " Plug 'tomasiser/vim-code-dark' | |
| Plug 'NLKNguyen/papercolor-theme' | |
| Plug 'Yggdroot/indentLine' | |
| Plug 'dense-analysis/ale' | |
| Plug 'vim-airline/vim-airline' | |
| Plug 'vim-airline/vim-airline-themes' | |
| " Plug 'neovim/nvim-lspconfig' | |
| " Plug 'ycm-core/YouCompleteMe' | |
| " Plug 'hrsh7th/nvim-cmp' | |
| "" main one | |
| "Plug 'ms-jpq/coq_nvim', {'branch': 'coq'} | |
| "" 9000+ Snippets | |
| "Plug 'ms-jpq/coq.artifacts', {'branch': 'artifacts'} | |
| "" lua & third party sources -- See https://github.com/ms-jpq/coq.thirdparty | |
| "" Need to **configure separately** | |
| "Plug 'ms-jpq/coq.thirdparty', {'branch': '3p'} | |
| "" - shell repl | |
| "" - nvim lua api | |
| "" - scientific calculator | |
| "" - comment banner | |
| "" - etc | |
| "" | |
| " Plug 'hrsh7th/cmp-nvim-lsp' | |
| " Plug 'hrsh7th/cmp-buffer' | |
| " Plug 'hrsh7th/cmp-path' | |
| " Plug 'hrsh7th/cmp-cmdline' | |
| " Plug 'hrsh7th/nvim-cmp' | |
| " For vsnip users. | |
| " Plug 'hrsh7th/cmp-vsnip' | |
| " Plug 'hrsh7th/vim-vsnip' | |
| " Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} | |
| call plug#end() | |
| filetype plugin indent on " required | |
| "split navigations | |
| nnoremap <C-J> <C-W><C-J> | |
| nnoremap <C-K> <C-W><C-K> | |
| nnoremap <C-L> <C-W><C-L> | |
| nnoremap <C-H> <C-W><C-H> | |
| " Enable folding | |
| set foldmethod=indent | |
| set foldlevel=99 | |
| " Enable folding with the spacebar | |
| nnoremap <space> za | |
| "au BufNewFile,BufRead *.py | |
| " \ set tabstop=4 | |
| " \ set softtabstop=4 | |
| " \ set shiftwidth=4 | |
| " \ set textwidth=79 | |
| " \ set expandtab | |
| " \ set autoindent | |
| " \ set fileformat=unix | |
| set encoding=utf-8 | |
| let python_highlight_all=1 | |
| set pastetoggle=<F3> | |
| " color scheme | |
| " let g:codedark_italics=1 | |
| " let g:codedark_transparent=1 | |
| " let g:airline_theme = 'codedark' | |
| " colorscheme codedark | |
| set background=dark | |
| let g:PaperColor_Theme_Options = { | |
| \ 'theme': { | |
| \ 'default': { | |
| \ 'transparent_background': 1 | |
| \ } | |
| \ } | |
| \ } | |
| colorscheme PaperColor | |
| " highlight the current cursor line | |
| set cursorline | |
| " let g:ale_echo_msg_error_str = 'E' | |
| " let g:ale_echo_msg_warning_str = 'W' | |
| " let g:ale_echo_msg_format = '[%linter%] %s [%severity%]' | |
| " let g:ale_python_flake8_options = '--max-line-length=100' | |
| " let g:ale_fixers = { | |
| " \ 'python': ['black'], | |
| " \} | |
| " let g:ale_fix_on_save = 1 | |
| let g:ale_completion_enabled = 1 | |
| let g:ale_linters = { | |
| \ 'python': ['flake8', 'pylint', 'pylsp'], | |
| \} | |
| let g:ale_set_balloons = 1 | |
| " nmap <silent> <C-k> <Plug>(ale_previous_wrap) | |
| " nmap <silent> <C-j> <Plug>(ale_next_wrap) | |
| " nmap <def> <Plug>(ale_go_to_definition) | |
| " Key bindings | |
| let mapleader="," | |
| nnoremap <leader>d :ALEGoToDefinition<CR> | |
| nnoremap <leader>r :ALEFindReferences<CR> | |
| set completeopt=menu,menuone,noselect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment