简体   繁体   English

如何使我的gvimrc文件使用我的vimrc文件(VIM)

[英]How to make my gvimrc file use my vimrc file (VIM)

TDLR; TDLR; I am unable to edit gvim using the _vimrc file 我无法使用_vimrc文件编辑gvim

Basically, I want to change some default settings (like background color) in the GUI version of vim (gvim). 基本上,我想在vim(gvim)的GUI版本中更改一些默认设置(例如背景色)。 However, when I make changes to my .vimrc file, my gvim does not react to the changes. 但是,当我对.vimrc文件进行更改时,我的gvim不会对更改做出反应。

I already have 我已经有了

if has("gui_number") set number colorscheme desert endif 如果has(“ gui_number”)设置了数字colorscheme沙漠endif

in my .vimrc file, and from what I've read that should make changes in my GVIM, but it doesn't. 在我的.vimrc文件中,根据我的阅读,应该在GVIM中进行更改,但事实并非如此。

I even tried to type some random stuff in the .vimrc file to see if GVIM would display an error, which it did not. 我什至试图在.vimrc文件中键入一些随机的东西,以查看GVIM是否会显示错误,但不会显示错误。

So i think the problem may be my gvim isn't reading my .vimrc file at all. 所以我认为问题可能是我的gvim根本没有读取我的.vimrc文件。 So this may be a pathing problem? 所以这可能是一个路径问题?

This below is my .vimrc file 这是我的.vimrc文件

source $VIMRUNTIME/vimrc_example.vim
jhgfjhgjhg (This here was to test for an error)

if has('gui_running')
    set number
    colorscheme desert
endif


set diffexpr=MyDiff()
function MyDiff()
  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg1 = substitute(arg1, '!', '\!', 'g')
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg2 = substitute(arg2, '!', '\!', 'g')
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  let arg3 = substitute(arg3, '!', '\!', 'g')
  if $VIMRUNTIME =~ ' '
    if &sh =~ '\<cmd'
      if empty(&shellxquote)
        let l:shxq_sav = ''
        set shellxquote&
      endif
      let cmd = '"' . $VIMRUNTIME . '\diff"'
    else
      let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
    endif
  else
    let cmd = $VIMRUNTIME . '\diff'
  endif
  let cmd = substitute(cmd, '!', '\!', 'g')
  silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
  if exists('l:shxq_sav')
    let &shellxquote=l:shxq_sav
  endif

endfunction






Here is my .GVIMRC file

version 6.0
if &cp | set nocp | endif
let s:cpo_save=&cpo
set cpo&vim
map! <S-Insert> *
vmap  "*d
map Q gq
vmap [% [%m'gv``
vmap ]% ]%m'gv``
vmap a% [%v]%
vmap gx <Plug>NetrwBrowseXVis
nmap gx <Plug>NetrwBrowseX
vnoremap <silent> <Plug>NetrwBrowseXVis :call netrw#BrowseXVis()

nnoremap <silent> <Plug>NetrwBrowseX :call netrw#BrowseX(expand((exists("g:netrw_gx")? g:netrw_gx : '<cfile>')),netrw#CheckIfRemote())

vmap <C-Del> "*d
vmap <S-Del> "*d
vmap <C-Insert> "*y
vmap <S-Insert> "-d"*P
nmap <S-Insert> "*P
inoremap  u
let &cpo=s:cpo_save
unlet s:cpo_save
set backspace=indent,eol,start
set backup
set diffexpr=MyDiff()
set display=truncate
set guioptions=egmrLT
set helplang=En
set history=200
set hlsearch
set incsearch
set langnoremap
set nolangremap
set nrformats=bin,hex
set ruler
set runtimepath=~/vimfiles,C:\\Program\ Files\ (x86)\\Vim/vimfiles,C:\\Program\ Files\ (x86)\\Vim\\vim81,C:\\Program\ Files\ (x86)\\Vim\\vim81\\pack\\dist\\opt\\matchit,C:\\Program\ Files\ (x86)\\Vim/vimfiles/after,~/vimfiles/after
set scrolloff=5
set ttimeout
set ttimeoutlen=100
set undofile
set wildmenu
" vim: set ft=vim :

I would hope that my gvim would display lines and a different background, but nothing happens. 我希望我的gvim将显示线条和不同的背景,但是什么也不会发生。

edit: should my _vimrc file look exactly like my gvimrc? 编辑:我的_vimrc文件应该看起来完全像我的gvimrc吗?

I figured it out guys. 我想通了。 So apparently I was supposed to create a _vimrc file in my home directory. 因此,显然我应该在主目录中创建_vimrc文件。

If you are on windows 7 and having the problem where you cant edit your _vimrc file in your VIM directory to change gvimrc, then its because you are trying to edit the wrong _vimrc!! 如果您使用的是Windows 7,并且遇到无法在VIM目录中编辑_vimrc文件来更改gvimrc的问题,那么这是因为您正在尝试编辑错误的_vimrc! You need to make a different user one in your home directory! 您需要在主目录中设置一个不同的用户!

Windows 7: Windows 7的:

Open vim, type in :e $HOME/_vimrc And then put the new settings and save (then reopen GVIM) 打开vim,输入:e $ HOME / _vimrc,然后输入新设置并保存(然后重新打开GVIM)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM