I recently ran into this answer when trying to remove highlighting from Vim, after pressing the # key accidentally. I followed the user's code and entered this at the bottom of my .vimrc
file:
" <Ctrl-l> redraws the screen and removes any search highlighting.
nnoremap <silent> <C-l> :nohl<CR><C-l>
I exited Vim, and ran source vimrc
And it returned the following error:
Unmatched ".
So I take this to mean that double quotes need a corresponding fullstop afterwards at the end of the line, as the user has done. But I'm looking through my .vimrc
and none of the "s have matching fullstops. Indeed, when I deleted the line I inserted and tried to run source vimrc
, it still returned an Unmatched ".
error. Here's an example:
" main
syntax enable
set encoding=utf-8
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set smarttab
set number
set showcmd
set bs=2 " use backspace in INSERT mode
"set nomodeline " turn off modeline parsing
And another:
" split nav
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
My problem here is that I don't understand the function of " here, and haven't been able to find any information from Googling or searching previous SO questions. It seems to be used like a comment, but I thought that # was used for comments. I'm a complete Linux beginner - I don't know what the correct syntax is to fix the dotfile, if it needs fixing.
So my question is twofold:
How should I fix this? Should I go through the whole dotfile and add fullstops at the end of each line starting with a "?
What is the function of " anyway?
I'm using TCSH, I believe.
EDIT: Here's the dotfile:
" main
syntax enable
set encoding=utf-8
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set smarttab
set number
set showcmd
set bs=2 " use backspace in INSERT mode
"set nomodeline " turn off modeline parsing
set cursorline
set autoindent
filetype indent on
filetype on
filetype plugin on
set wildmenu " autocomplete menu
set lazyredraw " redraw only when necessary
set showmatch " highlight matching parentheses
set smartcase
set incsearch " search as char entered
set hlsearch " highlight search matches
nnoremap #<space> :nohlsearch<CR> " #<space> turn off search hl
set foldenable " enable folding
set foldlevelstart=10 " open most folds be default
set foldnestmax=10 " 10 nested fold max
nnoremap <space> za " space open/closes fold
set foldmethod=indent " fold based on indent level
nnoremap j gj " move down visually
nnoremap k gk " move up visually
nnoremap gV `[v`] " highlight latest - ins mode
" status line that shows more information than the default one
" set statusline=%F%m%r%h%w\ [FMT=%{&ff}]\ [T=%Y]\ [HEX=\%02.2B]\ [POS=%04l,%04v\ (%p%%)]\ [lines=%L]
" set laststatus=2
" split
set splitbelow
set splitright
" split nav
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>