从我的 .vimrc,得到:
line 16:
E319: Sorry, the command is not available in this version: filetype on
line 17:
E319: Sorry, the command is not available in this version: filetype plugin on
line 18:
E319: Sorry, the command is not available in this version: filetype indent on
line 21:
E319: Sorry, the command is not available in this version: syntax on
line 45:
E319: Sorry, the command is not available in this version: match ExtraWhitespace /\s\+$/
line 46:
E319: Sorry, the …Run Code Online (Sandbox Code Playgroud) 我正在浏览一个 .vimrc 文件,那里的所有内容都是这样写的:-
" Better copy & paste
" When you want to paste large blocks of code into vim, press F2 before you
" paste. At the bottom you should see ``-- INSERT (paste) --``.
"" set pastetoggle=<F2>
"" set clipboard=unnamed
" Mouse and backspace
"" set mouse=a " on OSX press ALT and click
"" set bs=2 " make backspace behave like normal again
" Rebind <Leader> key
" I like to have it here becuase it is …Run Code Online (Sandbox Code Playgroud) 我已经阅读了大量关于如何在我的 vim 编辑器中更改选项卡长度的帖子,但只是临时更改。
我想让配置永久化,我的理解是我可以在上面提到的文件中配置它。
我试过了:
vim ~/.vimrc
Run Code Online (Sandbox Code Playgroud)
在我的home目录中没有结果。这只会打开一个具有该名称的新文件。
我想添加set mouse=a到.vimrc文件中以添加点击光标,但该/etc/vim/vimrc文件是只读的,不允许我编辑或删除它。我尝试卸载并重新安装,vim但.vimrc文件保持不变。
此外,当我尝试从终端使用
sudo vim /etc/vim/vimrc
Run Code Online (Sandbox Code Playgroud)
它说
Found a swap file by name of 'filename'
Run Code Online (Sandbox Code Playgroud)
显然它说我编辑了同一个文件两次。
我刚刚部署了一些 14.04 系统,我注意到每当我vim做某事时,vim 已经处于替换模式。
因为我习惯于在启动时处于命令模式,所以这相当令人迷惑。
知道为什么吗?我在 中没有看到任何明显的罪魁祸首/etc/vim/vimrc,但是系统上的每个用户都会发生这种情况。
安装相关包:
$ aptitude search vim | grep ^i
i vim - Vi IMproved - enhanced vi editor
i vim-common - Vi IMproved - Common files
i vim-nox - Vi IMproved - enhanced vi editor - with sc
i vim-runtime - Vi IMproved - Runtime files
i vim-tiny - Vi IMproved - enhanced vi editor - compact
Run Code Online (Sandbox Code Playgroud)
vim -V 输出:
# vim -V
chdir(/usr/share/vim)
fchdir() to previous dir
sourcing "$VIM/vimrc" …Run Code Online (Sandbox Code Playgroud) 我刚开始在 ubuntu 中使用 vim,在设置我的 .vimrc 文件时遇到了一些麻烦。这是我目前拥有的:
"============= Solarized color theme =============
"https://github.com/altercation/vim-colors-solarized
syntax enable "Use syntax highlighting
set background=dark "Use dark color scheme
colorscheme solarized "Choose solarized
"============= Settings =============
set nocompatible "Necesary for cool vim things
set number "Line numbers
set colorcolumn=80 "Have a line after 80 char
set ruler "Add ruler at the bottom of vim
set cursorline
Run Code Online (Sandbox Code Playgroud)
但是,当我看不到这些设置的光标线和颜色列时。如果我不使用曝光颜色语法,我确实会看到它们。你们知道我做错了什么吗?
在我的 .vimrc 中我有:
map <Leader>c :GitGutterToggle<CR>
map <Leader>n :set invnumber<CR>
Run Code Online (Sandbox Code Playgroud)
有什么方法可以将这两者合并为一个 Leader 条目吗?
例如:
map <Leader>c :GitGutterToggle && :set invnumber<CR>
Run Code Online (Sandbox Code Playgroud)
我已经尝试过上述方法及其变体,但无济于事。
谢谢。
当我尝试使用 vim 时,所有这些命令都会出错(尽管 vim 可以工作):
autocmd BufWritePre *.rb :%s/\s\+$//e
set filetype off
filetype plugin on
filetype indent on
syntax on " Turn on syntax highlighting
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
let mapleader = ","
set foldmethod=indent "fold based on indent
set foldnestmax=10 "deepest fold is 10 levels
set nofoldenable "dont fold by default
set foldlevel=1 "what I use
let …Run Code Online (Sandbox Code Playgroud)