Last active
June 18, 2020 10:30
-
-
Save jackz3/d9f138302c015a0502d039bfcad4ea7a 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
" when no add-apt, sudo apt-get install software-properties-common | |
" sudo add-apt-repository ppa:jonathonf/vim | |
" sudo apt update && sudo apt install vim | |
" git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim | |
" install https://github.com/Valloric/YouCompleteMe#installation | |
" apt-get install silversearcher-ag | |
set nocompatible | |
set encoding=utf-8 | |
set tabstop=2 | |
set shiftwidth=2 | |
set autoindent " Copy indent from current line when starting a new line | |
" (typing <CR> in Insert mode or when using the "o" or "O" | |
" command). | |
au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 textwidth=79 | |
\ expandtab autoindent fileformat=unix | |
highlight BadWhitespace ctermbg=red guibg=darkred | |
au BufRead,BufNewFile *.js,*.css,*.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/ | |
syntax on | |
set number | |
set cursorline | |
set ruler " Show the line and column number of the cursor position, | |
" separated by a comma. | |
set mouse=a " Enable the use of the mouse. | |
set clipboard=unnamed | |
set hlsearch | |
set backspace=2 | |
set showcmd " Show (partial) command in status line. | |
set showmatch " When a bracket is inserted, briefly jump to the matching | |
" one. The jump is only done if the match can be seen on the | |
" screen. The time to show the match can be set with | |
" 'matchtime'. | |
set incsearch " instance search" | |
set ignorecase " Ignore case in search patterns. | |
set smartcase " Override the 'ignorecase' option if the search pattern | |
" contains upper case characters. | |
"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=syntax | |
"set foldnestmax=6 | |
set foldlevel=6 | |
" Enable folding with the spacebar | |
nnoremap <space> za | |
nnoremap <space> zR | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
":PluginInstall | |
":PluginUpdate | |
":PlugginClean | |
call vundle#begin() | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'tmhedberg/SimpylFold' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'vim-airline/vim-airline' | |
Plugin 'kien/ctrlp.vim' | |
Plugin 'jiangmiao/auto-pairs' | |
Plugin 'scrooloose/nerdcommenter' | |
Plugin 'valloric/MatchTagAlways' "py | |
Plugin 'Chiel92/vim-autoformat' | |
Plugin 'scrooloose/syntastic' | |
Plugin 'mileszs/ack.vim' | |
"Plugin 'Valloric/YouCompleteMe' "py | |
Plugin 'tomasiser/vim-code-dark' | |
"Plugin 'tomasr/molokai' | |
"Plugin 'altercation/vim-colors-solarized' | |
Plugin 'hail2u/vim-css3-syntax' | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'marijnh/tern_for_vim' "py | |
Plugin 'leafgarland/typescript-vim' | |
Plugin 'Quramy/tsuquyomi' | |
Plugin 'vim-scripts/indentpython.vim' | |
Plugin 'nvie/vim-flake8' | |
call vundle#end() " required | |
filetype plugin indent on " required | |
"nerdtree Ctrl+E 打开/关闭 | |
map <S-e> :NERDTreeToggle<CR> | |
" 当不带参数打开Vim时自动加载项目树 | |
"autocmd StdinReadPre * let s:std_in=1 | |
"autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
" 当所有文件关闭时关闭项目树窗格 | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif | |
" 不显示这些文件 | |
let NERDTreeIgnore=['\.pyc$', '\~$', 'node_modules'] "ignore files in NERDTree | |
" 不显示项目树上额外的信息,例如帮助、提示什么的 | |
"let NERDTreeMinimalUI=1 | |
"SimpyFold | |
let g:SimpylFold_docstring_preview=1 | |
"ctrlp | |
let g:ctrlp_working_path_mode = 'ra' | |
set wildignore+=*/tmp/*,*/node_modules/*,*.so,*.swp,*.zip | |
let g:ctrlp_custom_ignore = {'dir': '\v[\/]\.(git|hg|svn)$', 'file': '\v\.(exe|so|dll)$'} | |
"ack full text search | |
let g:ackprg = 'ag --nogroup --nocolor --column' | |
map <c-q> :Ack<space> | |
"YCM | |
let g:ycm_semantic_triggers = { | |
\ 'css': [ 're!^\s{4}', 're!:\s+'], | |
\ 'html': [ '</' ], | |
\ } | |
let g:ycm_autoclose_preview_window_after_completion=1 | |
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR> | |
if !exists("g:ycm_semantic_triggers") | |
let g:ycm_semantic_triggers = {} | |
endif | |
let g:ycm_semantic_triggers['typescript'] = ['.'] | |
"vim-js | |
let javascript_enable_domhtmlcss = 1 | |
"scheme | |
set background=dark | |
set t_Co=256 | |
colorscheme codedark | |
"auto format | |
noremap <F3> :Autoformat<CR> | |
"syntastic' | |
let g:syntastic_javascript_checkers = ['eslint'] | |
"cd ~/.vim/bundle/tern_for_vim | |
"npm install | |
"touch .tern_project | |
"{ | |
" "libs": [ | |
" "browser", | |
" "underscore", | |
" "jquery" | |
" ], | |
" "plugins": { | |
" "node": {} | |
" } | |
"} | |
"vim-autoformat | |
let g:formatdef_eslint = '"SRC=eslint-temp-${RANDOM}.js; cat - >$SRC; eslint --fix $SRC >/dev/null 2>&1; cat $SRC | perl -pe \"chomp if eof\"; rm -f $SRC"' | |
let g:formatters_javascript = ['eslint'] | |
"vim-flake8 | |
let python_highlight_all=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment