Skip to content

Instantly share code, notes, and snippets.

@023Sparrow
Last active January 11, 2019 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 023Sparrow/06f2bd62aaaabed20a8b9664b274a446 to your computer and use it in GitHub Desktop.
Save 023Sparrow/06f2bd62aaaabed20a8b9664b274a446 to your computer and use it in GitHub Desktop.
python vimrc
"补全方面主要参考 https://my.oschina.net/solomonxie/blog/2997475
let mapleader = ","
set nu
set hlsearch
set autoindent
set smartindent
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set t_Co=256
set whichwrap+=<,>,h,l
set ttimeoutlen=0
set backspace=indent,eol,start
set mouse=a
filetype on
syntax on
set laststatus=2 "始终显示状态栏
set wildmenu " vim 自身命名行模式智能补全
set completeopt-=preview " 补全时不显示窗口,只显示补全列表
set nobackup " 设置不备份
set noswapfile " 禁止生成临时文件
set autoread " 文件在 vim 之外修改过,自动重新读入
set autowrite " 设置自动保存
set confirm " 在处理未保存或只读文件的时候,弹出确认
set langmenu=zh_CN.UTF-8
set helplang=cn
set termencoding=utf-8
set encoding=utf8
set fileencodings=utf8,ucs-bom,gbk,cp936,gb2312,gb18030
"补全插件设置
" set pyxversion=3
if has("gui_running")
set guifont=Lucida_Console_for_Powerline:h11:cANSI:qDRAFT " 设置字体
set guioptions-=m " 隐藏菜单栏
set guioptions-=T " 隐藏工具栏
set guioptions-=L " 隐藏左侧滚动条
set guioptions-=r " 隐藏右侧滚动条
set guioptions-=b " 隐藏底部滚动条
set showtabline=0 " 隐藏 Tab 栏
colorscheme gruvbox
endif
"插件
call plug#begin('$VIM/vimfiles/plugged')
Plug 'skywind3000/asyncrun.vim'
"deoplete-jedi
Plug 'zchee/deopete-jedi'
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
call plug#end()
"编辑vimrc
nnoremap <leader>e :edit $MYVIMRC<cr>
"重新加载vimrc
nnoremap <leader>s :source $MYVIMRC<cr>
nnoremap <leader>w :w<cr>
nnoremap <leader>x :x<cr>
nnoremap <leader>q :q<cr>
" 安装、更新、删除插件
nnoremap <leader><leader>i :PlugInstall<cr>
nnoremap <leader><leader>u :PlugUpdate<cr>
nnoremap <leader><leader>c :PlugClean<cr>
" tabular
nnoremap <leader>= :Tab /=<cr>
"搜索后按zz清除高亮
noremap <plug>(slash-after) zz
"代码格式化
nnoremap <leader><leader>= :0,$!yapf<CR>
"airline
let g:airline_theme="silver"
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = '☰'
let g:airline_symbols.maxlinenr = ''
"deoplete
let g:deoplete#enable_at_startup = 1
" Python3的可执行文件位置
let g:python3_host_prog = "C:/Users/yourname/Anaconda3/python.exe"
"调试python
nnoremap <F5> :call CompileRunGcc()<cr>
func! CompileRunGcc()
exec "w"
if &filetype == 'python'
if search("@profile")
exec "AsyncRun kernprof -l -v %"
exec "copen"
exec "wincmd p"
elseif search("set_trace()")
exec "!python %"
else
exec "AsyncRun -raw python %"
exec "copen"
exec "wincmd p"
endif
endif
endfunc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment