VIM在行尾显示$ Character

时间:2015-09-01 19:53:42

标签: vim

这是我的.vimrc

set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

Plugin 'gmarik/vundle'
Plugin 'scrooloose/nerdtree.git'
Plugin 'guns/xterm-color-table.vim'

" Indentation rules
filetype plugin indent on

"Pathogen
execute pathogen#infect()

" Syntax highlighting
syntax enable

" If using a dark background within the editing area and syntax
" highlighting turn on this option as well
set background=dark

" Set color scheme
colorscheme solarized

" Dimensions
set textwidth=80      " Virtual line width
set colorcolumn=81    " Vertical ruler at 81 characters

" Information
set showcmd           " Show (partial) command in status line.
set showmode          " Show the current mode
set laststatus=2      " always show status line

" Statusline
set statusline=%F
set statusline+=%{exists('g:loaded_fugitive')?fugitive#statusline():''}
" set statusline+=%{StatuslineCurrentHighlight()}
set statusline+=%=
set statusline+=%m
set statusline+=\ %Y
set statusline+=\ %3l/%L[%3p%%]

" Navigation
set nu                " Set line numbering
set scrolloff=5       " keep at least 5 lines above/below
set mouse=a           " Enable mouse usage (all modes)
set mousehide         " Hide the mouse when typing
set cursorline        " Highlights the cursor line

" Searching
set ignorecase        " Do case insensitive matching
set smartcase         " Do smart case matching
set incsearch         " Incremental search
set hlsearch          " highlight searches
set showmatch         " Show matching brackets.

" Tabs (spacing)
set expandtab         " Use spaces instead of tabs
set tabstop=4         " How many spaces a tab measures
set shiftwidth=4      " Sets >> and << width
set autoindent
set backspace=indent,eol,start

" Folding
set foldenable!        " Disable folds
" set foldcolumn=1      " Shows folds in a column
au BufWinLeave * silent! mkview
au BufWinEnter * silent! loadview

" Backups
set nobackup          " Remove backup files
set noswapfile        " Remove swap files

set list!

如果我运行类似

的话

vim ex.py

如果我执行类似

的操作,则不会显示尾随$

vim p

尾随$确实显示,直到我运行:set list!

默认情况下,为所有类型的文件隐藏空格/行尾字符的任何想法。

2 个答案:

答案 0 :(得分:2)

如果您查看帮助页:help 'listchars',它会告诉您eol:$是默认值。因此,只要'list'被激活,它就会在该行的末尾显示$

您可以使用:set nolist停用列表。但是它可以在以后再打开。您也可以清除列表,这是一个非常安全的赌注:set listchars=""。为了真正安全,我建议你在你的vimrc中做两件事:

set listchars=""
set nolist

答案 1 :(得分:1)

如果没有跟踪list选项设置的位置,最好的办法就是用set nolist替换最后一行。 set list!切换选项,而set nolist将其关闭,无论当前值是什么。