Система: Raspberry pi работает с Raspbian Stretch, полностью обновлена.
Вот весь мой код ~ / .vimrc.Акцент в нижней строке, который я использую, чтобы убедиться, что я загружаю правильный файл VIMRC.Все в этом VIMRC работает так, как я ожидал, когда я запускаю vim как мой пользователь.
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
" you can find below. If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed. It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
"syntax on
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set background=dark
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
" filetype plugin indent on
"endif
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd " Show (partial) command in status line.
"set showmatch " Show matching brackets.
"set ignorecase " Do case insensitive matching
"set smartcase " Do smart case matching
"set incsearch " Incremental search
"set autowrite " Automatically save before commands like :next and :make
"set hidden " Hide buffers when they are abandoned
"set mouse=a " Enable mouse usage (all modes)
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
syntax on
set mouse-=a
set backspace=indent,eol,start
echo "home vimrc loaded"
ОДНАКО, когда я либо удаляю свою копию ~ / .vimrc, либо (что более важно, так как это проблема, которую я 'После запуска sudo vim моя глобальная версия vimrc по умолчанию (/usr/share/vim/vim80/defaults.vim, которая жестко связана с / etc / vim / vimrc) не работает должным образом.В частности, я замечаю следующие 2 проблемы:
-set mouse- = a работает, даже когда строка закомментирована.
-set backspace = indent, eol, start неработа.
Это эхо, что я загружаю глобальный vimrc, и эхо изменяется соответственно, если я его редактирую.
Вот мой глобальный файл vimrc.
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
" you can find below. If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed. It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
"syntax on
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set background=dark
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
" filetype plugin indent on
"endif
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd " Show (partial) command in status line.
"set showmatch " Show matching brackets.
"set ignorecase " Do case insensitive matching
"set smartcase " Do smart case matching
"set incsearch " Incremental search
"set autowrite " Automatically save before commands like :next and :make
"set hidden " Hide buffers when they are abandoned
"set mouse=a " Enable mouse usage (all modes)
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
syntax on
set mouse-=a
set backspace=indent,eol,start
echo "global vimrc loaded"
Мне кажется, что у меня неправильное понимание того, как работают значения по умолчанию vimrc.Любая помощь приветствуется.
РЕДАКТИРОВАТЬ С ДОПОЛНИТЕЛЬНОЙ ИНФОРМАЦИЕЙ:
Когда я создаю файл /root/.vimrc, а затем запускаю sudo vim, он правильно использует этот vimrc, и все работает, как должно при запуске от имени пользователя root,Глобальный файл все еще не работает, когда я удаляю свой локальный vimrc.Так что это определенно ничего с разрешениями пользователей.Есть ли второй vim-файл, кроме vimrc, который может быть проблемой?
EDIT2:
Вывод: version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Sep 30 2017 18:21:38)
Included patches: 1-197, 322, 377-378, 550, 703, 706-707
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by pkg-vim-maintainers@lists.alioth.debian.org
Huge version without GUI. Features included (+) or not (-):
+acl -clipboard +dialog_con +file_in_path +job -lua +mouse_sgr +path_extra +rightleft +tag_old_static +user_commands +writebackup
+arabic +cmdline_compl +diff +find_in_path +jumplist +menu -mouse_sysmouse -perl -ruby -tag_any_white +vertsplit -X11
+autocmd +cmdline_hist +digraphs +float +keymap +mksession +mouse_urxvt +persistent_undo +scrollbind -tcl +virtualedit -xfontset
-balloon_eval +cmdline_info -dnd +folding +lambda +modify_fname +mouse_xterm +postscript +signs +termguicolors +visual -xim
-browse +comments -ebcdic -footer +langmap +mouse +multi_byte +printer +smartindent +terminfo +visualextra -xpm
++builtin_terms +conceal +emacs_tags +fork() +libcall -mouseshape +multi_lang +profile +startuptime +termresponse +viminfo -xsmp
+byte_offset +cryptv +eval +gettext +linebreak +mouse_dec -mzscheme -python +statusline +textobjects +vreplace -xterm_clipboard
+channel +cscope +ex_extra -hangul_input +lispindent +mouse_gpm +netbeans_intg -python3 -sun_workshop +timers +wildignore -xterm_save
+cindent +cursorbind +extra_search +iconv +listcmds -mouse_jsbterm +num64 +quickfix +syntax +title +wildmenu
-clientserver +cursorshape +farsi +insert_expand +localmap +mouse_netterm +packages +reltime +tag_binary -toolbar +windows
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -fdebug-prefix-map=/build/vim-UkjqTY/vim-8.0.0197=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SO
URCE=1
Linking: gcc -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lnsl -lselinux -lacl -lattr -lgpm -ldl
Вывод: scriptnames
1: /usr/share/vim/vim80/defaults.vim
2: /usr/share/vim/vim80/syntax/syntax.vim
3: /usr/share/vim/vim80/syntax/synload.vim
4: /usr/share/vim/vim80/syntax/syncolor.vim
5: /usr/share/vim/vim80/filetype.vim
6: /usr/share/vim/vim80/plugin/getscriptPlugin.vim
7: /usr/share/vim/vim80/plugin/gzip.vim
8: /usr/share/vim/vim80/plugin/logiPat.vim
9: /usr/share/vim/vim80/plugin/manpager.vim
10: /usr/share/vim/vim80/plugin/matchparen.vim
11: /usr/share/vim/vim80/plugin/netrwPlugin.vim
12: /usr/share/vim/vim80/plugin/rrhelper.vim
13: /usr/share/vim/vim80/plugin/spellfile.vim
14: /usr/share/vim/vim80/plugin/tarPlugin.vim
15: /usr/share/vim/vim80/plugin/tohtml.vim
16: /usr/share/vim/vim80/plugin/vimballPlugin.vim
17: /usr/share/vim/vim80/plugin/zipPlugin.vim
18: /usr/share/vim/vim80/syntax/vim.vim