Colin Schoen
Colin Schoen

Reputation: 2592

VIM Showing $ Character at End of Line

Here is my .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!

If I run something like

vim ex.py

The trailing $ does not show however if I do something like

vim p

The trailing $ does show until I run :set list!

Any ideas to simply hide the whitespace/end of line characters by default for all types of files.

Upvotes: 0

Views: 760

Answers (2)

robustus
robustus

Reputation: 3706

If you take a look at the help-page :help 'listchars' it will tell you that eol:$ is the default value. So as long as 'list' is activated it will display the $ at the end of the line.

You can deactivate list with :set nolist. However it can be turned back on later. You can also clear the listchars which is a really safe bet: set listchars="". To be really safe i suggest doing both in your vimrc:

set listchars=""
set nolist

Upvotes: 2

Ismail Badawi
Ismail Badawi

Reputation: 37177

Short of tracking down where the the list option is getting set, your best bet is to just replace the last line with set nolist. set list! toggles the option, whereas set nolist turns it off, no matter what the current value is.

Upvotes: 1

Related Questions