Hot answers tagged

5 votes
Accepted

"autocmd!" on a separate line vs. "autocmd! <the autocmd itself>"

As in :help autocmd-remove: :au[tocmd]! [group] {event} {aupat} [++once] [++nested] {cmd} Remove all autocommands associated with {event} and {aupat}, and add the command {cmd}....
user avatar
  • 21.5k
5 votes
Accepted

Is it possible to modify default statusline without resetting it to blank?

By default, :help 'statusline' is empty and Vim uses a hardcoded routine to fill the status line. When it is non-empty, the hardcoded value is ignored, leaving you with a blank slate. When you do any ...
user avatar
  • 33.1k
4 votes

Make Vim _really_ work with both spaces and tabs

When I press >>, it will indent code with 2 spaces setlocal shiftwidth=2 When I press Tab in Insert mode, it will insert the tab character setlocal noexpandtab When I press Backspace and ...
user avatar
  • 16.9k
4 votes
Accepted

What is the reason to specify ':cANSI' (or another character set) for a font

Historically "Charset" denoted a set of glyphs used for the codes 128-255 (i.e. 1-byte chars except those standartized by ASCII 0-127). Now with Unicode everywhere it is of little value and ...
user avatar
  • 16.9k
3 votes
Accepted

Is it possible to wrap and properly align inline comments?

Long comments should precede the code, not follow it. Misuse of "inline" comments is a remarkably bad style. However, Vim is able to format such comments. This is due to &cindent option ...
user avatar
  • 16.9k
3 votes
Accepted

Avoid "cannot find spell file" window

The simples way to ignore this message is to globally ignore the SpellFileMissing autocommand: :set eventignore=SpellFileMissing See :h 'eventignore
user avatar
3 votes

Avoid "cannot find spell file" window

:h spell-SpellFileMissing talks about how to handle your situation. There are basically two ways: Downloading spellfiles is done with a plugin. You can simply disable that plugin. let ...
user avatar
  • 3,137
3 votes

Is it possible to modify default statusline without resetting it to blank?

The reason why set += doesn’t work to append to the default status line format is that the default for the 'statusline' option is actually an empty string, and Vim renders a default status line ...
user avatar
  • 26.2k
3 votes
Accepted

To not wrap at 'textwidth' if 'filetype' is 'text'

If you want to tweak settings for a filetype, use an ftplugin (:help ftplugin, :help ftplugins): " ~/.vim/after/ftplugin/text.vim setlocal formatoptions-=t " don't forget to adjust b:...
user avatar
  • 21.5k
2 votes

After copying a visual selection, return to original location

vim solution : source You can just copy the paragraph to the clipboard with "+yip Instead of selecting the paragraph and copying it just set an auto command with the TextYankPost event. In vim, I ...
user avatar
  • 1,017
2 votes
Accepted

Make Vim _really_ work with both spaces and tabs

As you described in your question, and as Matt confirmed in his answer, you cannot do this using only Vim's options. We are, therefore, going to have to set up a mapping. There are several ways you ...
user avatar
  • 28.2k
1 vote
Accepted

To not treat files like 'vimrc-tips.txt' as Vim Script files

The line in question is in $VIMRUNTIME/filetype.vim, not in defaults.vim. You can override it by creating the following file: ~/.vim/ftdetect/vimtxt.vim with this content: autocmd BufNewFile,BufRead ...
user avatar
  • 33.1k
1 vote
Accepted

Some settings don't work because of their arrangement. Is it possible to workaround this?

As Martin Tournoji mentioned in the comments, should you wish to keep the desired order, you can use autocommands. These commands will run on a specific event. For this specific question, you can use ...
user avatar
  • 1,453
1 vote

Some settings don't work because of their arrangement. Is it possible to workaround this?

It is a truth universally acknowledged that the order just matters. :set colorcolumn& textwidth& " &cc="" &tw=0 :let &colorcolumn = &textwidth " &cc=&...
user avatar
  • 16.9k
1 vote
Accepted

Remap CTRL-x in insert mode

Your current <C-X> mapping is created by the Supertab plugin. I'm not sure off the top of my head whether overwriting it will break that plugin, but you can test it out by setting up your ...
user avatar
  • 28.2k
1 vote
Accepted

Different highlighting between foldtext and "the line number on the folded line"?

I'm afraid this isn't possible. See :help fold-colors: The colors of a closed fold are set with the Folded group hl-Folded. The colors of the fold column are set with the FoldColumn group hl-...
user avatar
  • 28.2k
1 vote
Accepted

.vimrc in local folder

Yes. See :help 'exrc'. But don't skip the part that says: BETTER NOT SET THIS OPTION! We also have a few earlier questions for which the answers detail alternative approaches.
user avatar
  • 28.2k
1 vote

Set location to be same as path

I set environment variables on my machine for the Python .dll and the Python directory. Then, I can reference these variables using the $path convention. Not sure if this is the best way to do this ...
user avatar
  • 145
1 vote

Why is this mapping deleting text?

Instead of using vmap which is recursivly and works in select- and visual-mode, I switched to xnoremap which isn't recursivly and restricts to only visual mode. Now it works fine!
user avatar
  • 23

Only top scored, non community-wiki answers of a minimum length are eligible