0

When I type :set inc it doesn't work and below status bar shows include=^\s*\(from\|import\). Even when I turn on GVim it shows include=^\s*#\s*include error.

Here is my .vimrc file

set nocp
filetype plugin indent on
set hls inc ar ai wrap lbr nu rnu et magic sc acd aw sb spr mouse=a sw=4 sts=4 ts=4 ls=2 bs=indent,eol,start
autocm BufNewFile *.cpp -r ~/Templates/CP_C++.cpp
let mapleader = ","
nnoremap <F9> :w<BAR>:!clear && g++ -Wall -g -std=gnu++14 -static -DLOCAL "%:p" && ./a.out<CR>
imap <F9> <ESC><F9>
nnoremap <leader>b :ls<CR>:buffer<Space>
inoremap <leader>; <ESC>
nnoremap <leader>f :let @+ = expand("%:p")<CR>
noremap <leader>a ggVG
noremap <leader>c "+y
noremap <leader>d "_d
inoremap {<CR> {<CR>}<ESC>O
inoremap ( ()<left>
inoremap [ []<left>
inoremap " ""<left>
inoremap ' ''<left>
vnoremap fb <ESC>`>a)<ESC>`<i(<ESC>
vnoremap qq <ESC>`>a"<ESC>`<i"<ESC>
4
  • This is expected. You're simply asking Vim what the 'include' option (short name 'inc') is currently set to. Were you trying to enable 'incsearch' instead? If so, you need set incsearch or you can shorten it to set is.
    – filbranden
    Commented Apr 24, 2020 at 21:34
  • @filbranden Oops, I am Sorry. My bad. I forgot that :set is is short form of set incsearch. Thank you very much. Should I remove my question as this is a silly mistake? or you will post that as answer? Commented Apr 24, 2020 at 22:36
  • I'll post it as an answer. Thank for confirming my hunch that this is what you were after!
    – filbranden
    Commented Apr 24, 2020 at 22:38
  • And welcome to Vi and Vim!
    – filbranden
    Commented Apr 24, 2020 at 22:40

1 Answer 1

1

This is expected. You're simply asking Vim what the 'include' option (short name 'inc') is currently set to.

When you use :set with an option that takes a value but don't include any =s, Vim will simply tell you what that option is set to, which is what you're seeing here.

From our discussion in comments, we established you were actually trying to enable 'incsearch' instead, which you can do with:

set incsearch

Or you can shorten it to:

set is

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.