Last active
December 19, 2022 21:07
-
-
Save LplusKira/f68437c2b7e4af2b9686043093320f56 to your computer and use it in GitHub Desktop.
.vimrc
This file contains 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
scriptencoding utf-8 | |
" | |
" ██╗ ██╗ ██╗ ███╗ ███╗ ██████╗ ██████╗ | |
" ██║ ██║ ██║ ████╗ ████║ ██╔══██╗ ██╔════╝ | |
" ██║ ██║ ██║ ██╔████╔██║ ██████╔╝ ██║ | |
" ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║ ██╔══██╗ ██║ | |
" ██╗╚████╔╝ ██║ ██║ ╚═╝ ██║ ██║ ██║ ╚██████╗ | |
" ╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ | |
" | |
" Index | |
" - <Plugins> | |
" - <Plugins>-addVimPlugins | |
" - <Non-Plugins> | |
" - <Aliases> | |
" - <Brief-help> | |
" - <Rmk> | |
" <Plugins> Use Vundle (acronym for Vim bundle), a Vim plugin manager | |
" ref: https://github.com/VundleVim/Vundle.vim | |
set nocompatible " Do NOT make vim compatible with vi | |
set clipboard=unnamed " Need this on mac | |
" Ref: https://stackoverflow.com/a/680271 | |
filetype off " required -- Vundle | |
set rtp+=~/.vim/bundle/Vundle.vim " set the runtime path (rtp) to include Vundle and initialize | |
call vundle#begin() " accompanied w\ vundle#end() | |
" vvv <Plugins>-addVimPlugins | |
Plugin 'leafgarland/typescript-vim' " typescript | |
Plugin 'gmarik/Vundle.vim' " only vundle conquers vundle | |
Plugin 'tmhedberg/SimpylFold' " for python's class/function folding | |
"Plugin 'scrooloose/syntastic' " make syntax checking (at least it works on Node.js, Python) | |
Plugin 'scrooloose/nerdtree' " awesome file sys explorer | |
autocmd vimenter * NERDTree " open NERDTree automatically when vim starts up | |
let NERDTreeShowHidden=1 | |
Plugin 'jistr/vim-nerdtree-tabs' " no need to quit twice in NERDTree, note that it's not maintained | |
Plugin 'tpope/vim-fugitive' " Git wrapper in vim (works well in Gstatus, Gcommit, Gdiff...) | |
Plugin 'derekwyatt/vim-scala' " bundle for scala | |
Plugin 'vim-syntastic/syntastic' " install flake8 to lint python codes | |
" ref: http://flake8.pycqa.org/en/latest/index.html#quickstart | |
Plugin 'mattn/emmet-vim' " html autocomplete | |
let g:user_emmet_mode='a' | |
let g:user_emmet_install_global = 0 | |
autocmd FileType html,css EmmetInstall | |
" vvv integration with eslint | |
set statusline+=%#warningmsg# | |
set statusline+=%{SyntasticStatuslineFlag()} | |
set statusline+=%* | |
let g:syntastic_always_populate_loc_list = 1 | |
let g:syntastic_auto_loc_list = 1 | |
let g:syntastic_check_on_open = 1 | |
let g:syntastic_check_on_wq = 0 | |
let g:syntastic_javascript_checkers = ['eslint'] | |
let g:syntastic_javascript_eslint_exe = '$(npm bin)/eslint --ignore-path .eslintignore .' | |
let g:syntastic_error_symbol = '🀄' | |
let g:syntastic_style_error_symbol = '⁉️' | |
let g:syntastic_warning_symbol = '🔞' | |
let g:syntastic_style_warning_symbol = '⚠️' | |
" ^^^ integration with eslint | |
" let g:syntastic_mode_map = { | |
" \ "mode": "active", | |
" \ "passive_filetypes": ["xml"] } | |
"Plugin 'ycm-core/YouCompleteMe' "auto-completion | |
" need to follow (long trip): https://github.com/Valloric/YouCompleteMe | |
Plugin 'easymotion/vim-easymotion' | |
Plugin 'Chiel92/vim-autoformat' | |
Plugin 'artur-shaik/vim-javacomplete2' | |
autocmd FileType java setlocal omnifunc=javacomplete#Complete | |
" java auto-completion | |
Plugin 'pangloss/vim-javascript' " syntax highlighting and improved indentation | |
Plugin 'maxmellon/vim-jsx-pretty' | |
Plugin 'joegesualdo/jsdoc.vim' " never use this: https://github.com/heavenshell/vim-jsdoc/issues/73 | |
" it cant coexist with .vimrc | |
Plugin 'ludovicchabant/vim-gutentags' " ctags required | |
" https://medium.com/@kuiro5/best-way-to-set-up-ctags-with-neovim-37be99c1bd11 | |
" https://github.com/universal-ctags/ctags/blob/master/docs/autotools.rst | |
Plugin 'scrooloose/vim-slumlord' | |
Plugin 'fatih/vim-go' " go autocomplete etc. | |
" ^^^ <Plugins>-addVimPlugins | |
call vundle#end() " accompanied w\ vundle#begin() | |
filetype plugin indent on " required -- Vundle | |
" <Non-Plugins> | |
let mapleader = "rr" " our Leader is rr | |
let g:user_emmet_leader_key='rr' " for emmet plugin only | |
syntax on | |
" vvv some indispensible numbers | |
set number | |
set relativenumber | |
" ^^^ numbers u need ... | |
" vvv where indent should take place | |
set smartindent | |
set smarttab | |
set cindent | |
set tabstop=4 | |
set shiftwidth=2 | |
set expandtab | |
"inoremap {<cr> {<cr>}<c-o><s-o> | |
"inoremap [<cr> {<cr>]<c-o><s-o> | |
"inoremap (<cr> {<cr>)<c-o><s-o> | |
" ^^^ where indent should take place | |
set backspace=2 " dealing w\ backspace problem | |
" ref: http://vim.wikia.com/wiki/Backspace_and_delete_problems | |
" vvv https://blog.sourcerer.io/making-vim-great-again-cdfbc281428b | |
set history=100 " Keep X commands in history | |
if has('gui_running') | |
set guifont=Consolas:h16 | |
endif | |
" ^^^ https://blog.sourcerer.io/making-vim-great-again-cdfbc281428b | |
" vvv use 'built-in' folding method from vim | |
set foldmethod=syntax | |
set foldlevelstart=1 | |
set foldnestmax=2 " For, at least, python's methods in Class | |
let javaScript_fold=1 " JavaScript | |
let sh_fold_enabled=1 " sh | |
" ^^^ use 'built-in' folding method from vim | |
" vvv ignore some flake8 Errors | |
" E501 line too long -- sometimes life's not a bed of roses | |
" E402 module import not at top level -- no import from parent dirs? | |
" F812 list comprehension redefines sth -- so far np with this | |
let g:syntastic_python_flake8_args='--ignore=E501,E402,F812,E722' | |
" ^^^ ignore some flake8 Errors | |
" vvv Add persistent undo | |
if has('persistent_undo') "check if your vim version supports it | |
set undofile "turn on the feature | |
set undodir=$HOME/.vim/undo "directory where the undo files will be stored | |
endif | |
" ^^^ Add persistent undo | |
set autoread " reload files changed outside vim | |
" vvv utf-8 encoding | |
set encoding=utf-8 | |
set fileencoding=utf-8 | |
" ^^^ utf-8 encoding | |
" vvv make a mark on column 80, with lightblue color | |
set colorcolumn=80 | |
highlight ColorColumn ctermbg=lightblue guibg=lightblue | |
highlight Normal ctermbg=Black | |
syntax enable | |
" ^^^ make a mark on column 80, with lightblue color | |
" " vvv for easymotion/vim-easymotion | |
" " <Leader>f{char} to move to {char} | |
" map <Leader>f <Plug>(easymotion-bd-f) | |
" nmap <Leader>f <Plug>(easymotion-overwin-f) | |
" | |
" " s{char}{char} to move to {char}{char} | |
" nmap s <Plug>(easymotion-overwin-f2) | |
" | |
" " Move to line | |
" map <Leader>L <Plug>(easymotion-bd-jk) | |
" nmap <Leader>L <Plug>(easymotion-overwin-line) | |
" | |
" " Move to word | |
" map <Leader>w <Plug>(easymotion-bd-w) | |
" nmap <Leader>w <Plug>(easymotion-overwin-w) | |
" " ^^^ for easymotion/vim-easymotion | |
" vvv <Leader>cw search the current pattern in the next window | |
nnoremap <Leader>cw :let @/=expand("<cword>")<Bar>wincmd w<Bar>normal n<CR> | |
" ^^^ <Leader>cw search the current pattern in the next window | |
" vvv For java | |
nmap <leader>cc :!javac %<Return> | |
" ^^^ For java | |
augroup quickfix | |
autocmd! | |
autocmd QuickFixCmdPost [^l]* cwindow | |
autocmd QuickFixCmdPost l* lwindow | |
augroup END | |
" vvv For javascript | |
" ref: https://vimawesome.com/plugin/vim-javascript | |
let g:javascript_plugin_jsdoc = 1 " syntax highlighting 4 jsdocs | |
augroup javascript_folding " vvv code folding based on vim-javascript's syntax file | |
au! | |
au FileType javascript setlocal foldmethod=syntax | |
augroup END " ^^^ code folding based on vim-javascript's syntax file | |
let g:javascript_conceal_function = "ƒ" | |
let g:javascript_conceal_null = "ø" | |
let g:javascript_conceal_this = "@" | |
let g:javascript_conceal_return = "⇚" | |
let g:javascript_conceal_undefined = "¿" | |
let g:javascript_conceal_NaN = "ℕ" | |
let g:javascript_conceal_prototype = "¶" | |
let g:javascript_conceal_static = "•" | |
let g:javascript_conceal_super = "Ω" | |
let g:javascript_conceal_arrow_function = "⇒" | |
let g:javascript_conceal_noarg_arrow_function = "🞅" | |
let g:javascript_conceal_underscore_arrow_function = "🞅" | |
map <leader>l :exec &conceallevel ? "set conceallevel=0" : "set conceallevel=1"<CR> | |
" toggle concealing | |
" ^^^ For javascript | |
" XXX vvv buggy | |
" " vvv For folding | |
" autocmd BufWinLeave *.* mkview | |
" autocmd BufWinEnter *.* silent loadview | |
" " ^^^ For folding | |
" XXX ^^^ buggy | |
" vvv Bind ;; to 'access' clipboard | |
" these two work when using vim 'locally' | |
" nnoremap ;;y "+y | |
" vnoremap ;;y "+y | |
nnoremap ;;y :w !xclip -in -sel clip <CR><CR> | |
vnoremap ;;y :w !xclip -in -sel clip <CR><CR> | |
" ^^^ | |
" Avoid ins-completion-menu messages | |
" https://stackoverflow.com/a/25102964 | |
set shortmess+=c | |
set hlsearch " To highlight all search matches across windows | |
" <Aliases> | |
" vvv Leave a 'clean' interface for tmux's copy | |
command! QQR set nonu! norelativenumber! | |
command! GGR set nonu! norelativenumber! | NERDTreeToggle | |
" ^^^ Leave a 'clean' interface for tmux's copy | |
command! Hi set nohlsearch! " toggle search highlight through :Hi | |
" vv set hilight color | |
hi Search cterm=NONE ctermbg=White | |
hi Normal guibg=NONE ctermbg=NONE | |
" ^^ set hilight color | |
" vv highligt tabs | |
"hi TabLineFill ctermfg=LightGreen ctermbg=DarkGreen | |
hi TabLine ctermfg=Black ctermbg=Yellow | |
hi TabLineSel ctermfg=DarkRed ctermbg=Yellow | |
hi Title ctermfg=LightGreen ctermbg=Magenta | |
" ^^ highligt tabs | |
command! Pa set nopaste! " toggle paste/nopaste | |
" vv make html tidy | |
command! TT :%!tidy -q -i --show-errors 0 | |
" Prerequisite -- https://github.com/htacg/tidy-html5/blob/next/README/BUILD.md | |
" ^^ make html tidy | |
" vv spelling | |
command! SS :setlocal spell spelllang=en_us | |
" ^^ spelling | |
" <Brief-help> | |
" :PluginList - lists configured plugins | |
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate | |
" :PluginSearch foo - searches for foo; append `!` to refresh local cache | |
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal | |
" see :h vundle for more details or wiki for FAQ | |
" <Rmk> | |
" - For plugins, each one's README is in ~/.vim/bundle/theAwesomePluginName |
update js-related config; employ ctags ; )
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
vim-javascript for js syntax checking, folding, etc.