簡體   English   中英

我如何獲得不同版本的vim來忽略〜/ vimrc中不是插件的部分?

[英]How do I get different builds of vim to ignore parts of the ~/vimrc that they do not the the plugins for?

我的centos 7有兩個vim二進制文件:
在/ usr / bin中/六
在/ usr / bin中/ VIM

發射它們中的任何一個時,它們都會彈出:

VIM-Vi改進
版本7.4.1099

通過在線搜索,我相信這兩個版本是vim和vim-minimal。 問題在於vi和vim-mininter分別〜/ .vimrc。 打開vim的時候很棒。 當打開vim-minimal時,我得到很多錯誤。 下面是我的〜/ .vimrc文件的表示形式:

set number
set nowrap
set modeline
set clipboard=unnamedplus  "Enables mouse center clip pasting, while holding shift, in insert mode.

"Below sets up the mouse in such a way that allows vi split screen resizing while in tmux and screen.
set mouse+=a
if &term =~ '^screen'
    " tmux knows the extended mouse mode
    set ttymouse=xterm2
endif

""""""""""""""""""""""""""""""""""""""""""""""""
""" User Defined Functions
""""""""""""""""""""""""""""""""""""""""""""""""
"Opens up sage specific work in new tabs
fu! Setup1()
  :bd!|e /home/me/example1.h | vsplit /home/me/example1.cc
  :tabnew /home/me/example2.h | vsplit /home/me/example2.cc
  :tabnew /home/me/example3.h | vsplit /home/me/example3.cc
  :tabnew /home/me/example4.h | vsplit /home/me/example4.cc
  :tabnew /home/me/example5.h | vsplit /home/me/example5.cc
  :tabnew /home/me/example6.h | vsplit /home/me/example6.cc
endfunction

"Opens up the most edited rc files in new tabs
fu! RCS()
  :bd!|e ~/.cshrc
  :tabnew ~/.vimrc
  :tabnew ~/.tmux.conf
endfunction

問題是我的用戶定義函數。 打開/ usr / bin / vi時,它將在新選項卡中打開我的兩個函數中的所有文檔。 一個合理的解決方法是不使用/ usr / bin / vi,但這是git打開的。

理想情況下,我將能夠擁有一個if語句來檢查哪個二進制文件正在運行此rc文件。 那可能嗎?

您可以配置git以使用您選擇的編輯器。 您可以設置環境變量GIT_EDITOR ,也可以使用git config --global core.editor /usr/bin/vim設置配置文件來設置core.editor變量。

如果兩者均未設置,則可能會退回到VISUAL環境變量。 關於這一點,您可能希望在~/.bashrc中將其設置為更廣泛的系統范圍的解決方案,以便其他想要打開編輯器的實用程序在/usr/bin/vi默認為/usr/bin/vim

以下博客文章討論了如何針對可能具有不同軟件包和不同功能的不同版本的vim降級vimrc(從而對vimrc做出不同的反應):

優雅地降級.vimrc

(max630在我的問題的評論中提供的答案)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM