日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux vim python配置文件,Linux VIM8 Python 编辑器配置文件

發(fā)布時間:2025/3/19 linux 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux vim python配置文件,Linux VIM8 Python 编辑器配置文件 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

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)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。