Skip to content

Instantly share code, notes, and snippets.

@Chiang97912
Last active September 25, 2023 10:05
Show Gist options
  • Save Chiang97912/b6993a84bed1eab7a85ecd0eb81ccd3c to your computer and use it in GitHub Desktop.
Save Chiang97912/b6993a84bed1eab7a85ecd0eb81ccd3c to your computer and use it in GitHub Desktop.
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'flazz/vim-colorschemes'
Plugin 'ervandew/supertab'
Plugin 'davidhalter/jedi-vim'
Plugin 'mattn/emmet-vim'
Plugin 'vim-syntastic/syntastic'
Plugin 'nvie/vim-flake8'
Plugin 'Yggdroot/indentLine'
Plugin 'tpope/vim-surround'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'ryanoasis/vim-devicons'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'grep.vim'
Plugin 'tacahiroy/ctrlp-funky'
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
Plugin 'jiangmiao/auto-pairs'
Plugin 'tell-k/vim-autopep8'
call vundle#end()
syntax on
set number
set nowrap
set smartindent
set autoindent
set mouse=a
set hlsearch
set clipboard=unnamed
set encoding=utf8
" Tabs
set softtabstop=4
set expandtab
set tabstop=4
set shiftwidth=4
" Move the cursor in insert mode
inoremap <C-h> <Left>
inoremap <C-j> <Down>
inoremap <C-k> <Up>
inoremap <C-l> <Right>
" colorscheme desert
colorscheme solarized
" NERDTree
map <F3> :NERDTreeMirror<CR>
map <F3> :NERDTreeToggle<CR>
" 自动打开NERDTree
autocmd VimEnter * NERDTree
autocmd BufEnter * silent NERDTreeMirror
" 关闭最后一个文件的同时关闭NERDTree
autocmd BufEnter * if 0 == len(filter(range(1, winnr('$')), 'empty(getbufvar(winbufnr(v:val), "&bt"))')) | qa! | endif
" JSON格式化
map <f4> <esc>:%!python -m json.tool<cr></cr></esc></f4>
" Jedi
let g:SuperTabDefaultCompletionType = "context"
let g:jedi#popup_on_dot = 0
let g:jedi#environment_path = "/Users/peter/anaconda3/bin/python3.6"
let g:jedi#goto_assignments_command = "<leader>g"
let g:jedi#goto_stubs_command = "<leader>s"
let g:jedi#goto_definitions_command = ""
let g:jedi#documentation_command = "K"
let g:jedi#usages_command = "<leader>n"
let g:jedi#completions_command = "<C-Space>"
let g:jedi#rename_command = "<leader>r"
" Emmet
let g:user_emmet_install_global = 0
autocmd FileType html,css EmmetInstall
" Flake8
let python_highlight_all=1
" indentLine
set list lcs=tab:\|\ " 最后面有空格
let g:indentLine_leadingSpaceChar = '.'
let g:indentLine_leadingSpaceEnabled = 1
" Enable folding
set foldmethod=syntax " 语法折叠
set foldlevelstart=99 " 关闭自动折叠
" Other
set showcmd " 显示键入的指令
set ruler " 在底部状态栏显示光标当前所在的“行,列”
set autoread " 检测有外部修改,并自动重读
set backspace=indent,eol,start " 解决backspace无法删除问题
" 设定底部状态栏显示“文件名、文件相关信息、光标所在字符的 ASCII 码值[十六进制],列号、行号,页号,在文件中的百分比”
set statusline=[%n]%<%f%y%h%m%r%=[%b\ 0x%B]\ %l\ of\ %L,%c%V\ Page\ %N\ %P
" vim-nerdtree-tabs
let g:nerdtree_tabs_open_on_console_startup=1
" ctrlp
let g:ctrlp_max_files=0
let g:ctrlp_max_depth=40
let g:ctrlp_working_path_mode=''
" ctrlp-funky
let g:ctrlp_funky_syntax_highlight = 1
let g:ctrlp_funky_multi_buffers = 1
nnoremap <Leader>fu :CtrlPFunky<Cr>
nnoremap <Leader>uu :execute 'CtrlPFunky ' . expand('<cword>')<Cr>
" ultisnips
let g:UltiSnipsExpandTrigger="<C-s>"
" autopep8
let g:autopep8_disable_show_diff=1
autocmd FileType python noremap <buffer> <F8> :call Autopep8()<CR>
" 设置默认光标位于右侧文件编辑区
autocmd VimEnter * wincmd w
" Run Python
map <F5> :w<cr>:!python %<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment