linux vim python配置文件,Linux VIM8 Python 编辑器配置文件
Linux VIM8 Python3 編輯器配置文件
"---------------------簡單配置-------------------------
set nocompatible "關(guān)閉與vi的兼容模式
set number "顯示行號
set nowrap "不自動折行
set showmatch "顯示匹配的括號
set scrolloff=3 "距離頂部和底部3行"
set encoding=utf-8 "編碼
set fenc=utf-8 "編碼
"set mouse=a "啟用鼠標(biāo)
set hlsearch "搜索高亮
syntax on "語法高亮
set backspace=indent,eol,start "啟動刪除設(shè)置
"------------為py文件添加支持pep8風(fēng)格的配置-------------
au BufNewFile,BufRead *.py
\ set tabstop=4 "tab寬度
\ set softtabstop=4
\ set shiftwidth=4
\ set textwidth=79 "行最大寬度
\ set expandtab "tab替換為空格鍵
\ set autoindent "自動縮進(jìn)
\ set fileformat=unix "保存文件格式
"-------分隔窗口將新窗口再右邊或者下方打開,添加配置-----
set splitbelow
set splitright
"分割窗口參數(shù)
":vs 或者 :vsplit 將當(dāng)前窗口豎直分割,并在上面新窗口中顯示當(dāng)前文件
":vs filename 將當(dāng)前窗口豎直分割,新文件在新窗口中顯示
":sp 或者:sv或者:split 將當(dāng)前窗口水平分割,并在左邊新窗口中顯示當(dāng)前文件
":sp filename 將當(dāng)前窗口豎直分割,新文件在左邊新窗口中顯示
":new 新建文件并豎直分割
":vnew 新建文件并水平分割
"--------------添加頭文件信息-------------------
function HeaderPython()
call setline(1, "#!/usr/bin/env python")
call append(1, "# -*- coding: utf-8 -*-")
call append(2, "# Pw @ " . strftime('%Y-%m-%d %T', localtime()))
normal G
normal o
normal o
endf
autocmd bufnewfile *.py call HeaderPython()
"--------------代碼折疊配置-----------------------
set foldmethod=indent
set foldlevel=99
"使用zc按鍵來創(chuàng)建折疊,使用za來打開或者關(guān)閉折疊。
"za經(jīng)常會誤輸入,空格快捷鍵來替代za:
nnoremap za
"--------------一鍵執(zhí)行python代碼配置--------------
"按 F5 執(zhí)行代碼
map :call RunPython()
func! RunPython()
exec "W"
if &filetype == 'python'
exec "!time python3 %"
endif
endfunc
"-----------------Vundle 插件----------------------
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"--------------------------------------------------
" 使用:PluginInstall下載下面的插件
"--------------------------------------------------
"
" 其他:常用命令 ↓
"
" :PluginList 列出所有已配置的插件
" :PluginInstall 安裝插件,追加 ! 用以更新或使用 :PluginUpdate
" :PluginSearch foo 搜索 foo ; 追加 ! 清除本地緩存
" :PluginClean 清除未使用插件,需要確認(rèn); 追加 ! 自動批準(zhǔn)移除未使用插件
"
"-----let Vundle manage Vundle, required-----------
Plugin 'VundleVim/Vundle.vim'
"YCM自動補(bǔ)全
Plugin 'Valloric/YouCompleteMe'
"vim8自動補(bǔ)全插件
Plugin 'maralla/completor.vim'
let g:completor_python_binary = '/usr/bin/python3'
"vim8自動縮進(jìn)插件
Plugin 'vim-scripts/indentpython.vim'
"vim8語法檢查插件
Plugin 'vim-syntastic/syntastic'
"vim8添加flake8代碼風(fēng)格檢查
Plugin 'nvie/vim-flake8'
" F2啟用代碼檢查
autocmd FileType python map :call Flake8()
"保存文件時顯示錯誤
autocmd BufWritePost *.py call flake8#Flake8()
"配色方案1 vundle下載
Plugin 'altercation/vim-colors-solarized'
"light or dark 兩種配色主題
syntax enable
set background=light
"樹形目錄
Plugin 'scrooloose/nerdtree'
"樹形目錄快捷鍵 ctrl + n
map :NERDTreeToggle
"設(shè)置忽略文件
let NERDTreeIgnore=['\~$', '\.pyc$', '\.swp$']
"為nerdtree添加git支持
Plugin 'Xuyuanp/nerdtree-git-plugin'
"如果你想用tab鍵
Plugin 'jistr/vim-nerdtree-tabs'
"美化欄
Plugin 'Lokaltog/vim-powerline'
"縮進(jìn)指示線 | 開關(guān):IndentLinesToggle
Plugin 'Yggdroot/indentLine'
"自動格式化工具 | 運(yùn)行:Autopep8 |效果自動一招pep8標(biāo)準(zhǔn)自動格式化代碼
Plugin 'tell-k/vim-autopep8'
"設(shè)置快捷鍵F8代替:Autopep8
autocmd FileType python noremap :call Autopep8()
"自動補(bǔ)全括號引號等
Plugin 'jiangmiao/auto-pairs'
"搜索插件 | ctrl+p 然后輸入你要尋找的文件就行了
Plugin 'kien/ctrlp.vim'
"搜索引擎使用了 the_silver_searcher
"使用:Ag [options] {pattern} [{directory}]
Plugin 'rking/ag.vim'
"git集成插件 | vim內(nèi)運(yùn)行g(shù)it命令
Plugin 'tpope/vim-fugitive'
"--------------------------------------------
call vundle#end() " required
filetype plugin indent on " required
"--------------------------------------------
標(biāo)簽:插件,set,配置文件,Plugin,Python,vim,python,call,VIM8
來源: https://www.cnblogs.com/xiangsikai/p/11057905.html
總結(jié)
以上是生活随笔為你收集整理的linux vim python配置文件,Linux VIM8 Python 编辑器配置文件的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux脚本开机自动执行脚本文件,如何
- 下一篇: linux 内核中断与时钟的冲突 问题