I tried to hide a foldcolumn in VIM via .vimrc :
set foldcolumn=0
but it doesn't work. It always appears as an extra column.
Commenting "set foldcolumn=0" didn't work too.
As a buffer-local option, 'foldcolumn' is probably set by a filetype plugin, especially because its global default value is 0.
When the fold column appears, find out where it got set via :verbose setlocal foldcolumn?. Then, e.g. when it was set by ftplugin/cpp.vim, you can put the following into ~/.vim/after/ftplugin/cpp.vim:
:setlocal foldcolumn=0
The after directory allows to override filetype-specific settings without modifying the original script.
For me some automatic folding options were done by the vim-pandoc plugin. Ingo's tip tip worked good when I created the file ~/.vim/after/ftplugin/pandoc.vim with his recommendations; however, the plugin reloaded at times and its folding settings returned. With the vim-pandoc plugin its own settings have to be used. I set the column width to 0 and opted to do folding on my own:
: let g:pandoc#folding#mode = ['manual']
: let g:pandoc#folding#fdc = 0
Related
I use syntastic plugin for vim on a computer with small screen, so want to cut out the unnecessary space. But, syntastic, when there's an error, displays e.g.:
[Syntax: line: 5 (1)]
a.cpp|5 col 59 warning|some error
[Location List] :SyntasticCheck gcc (cpp)
Vim status bar
Is is possible to remove the status line ([Syntax: line...) and the last line ([Location List...), which I don't necessarily need?
I tried disabling the loclist altogether (then I see the warnings/errors in the vim status bar), but I cannot scroll status bar, when it's too long -- but maybe it is possible?
Before turning on loclist:
After:
Here I have already removed the statusline formatting string from my ~\.vimrc. I would like the loclist to occupy one extra line, now it takes 3.
What you need is to hide the statusbar.
Take a look at this post, which implements a function to toggle that functionality.
Or, to disable it altogether:
set noshowmode
set noruler
set laststatus=
set noshowcmd
I think the it's not possible to entirely solve the problem that I asked for, as the loclist is considered another vim window and as such, the first extra line is a mandatory status line of the main window. One can disable the second extra line though by passing:
set laststatus=0
To disable the status bar (the top bars, not the bottom line with format '%d' ...)
Supposedly set laststatus=0 should work. However I noticed this was not working in my vimrc but would work if set manually for each vim session.
To resolve this issue, I added an autocmd within my .vimrc to override any existing laststatus setting:
# ~/.vimrc
" Hide Status Line
set laststatus=0 " For some reason this doesnt work
autocmd BufRead,BufNewFile * set laststatus=0 " This will work instead
As Weston Ganger said, laststatus=0 may not work in the vimrc file. In my case, the reason was in the vim-airline plugin. As stated in https://bbs.archlinux.org/viewtopic.php?id=241303, in airline.vim has a line set laststatus=2, which just needs to be corrected to set laststatus=0.
Whenever I open txt files (and some others) I get my textwidth set to 80. I think this is coming from syntax or ftplugin. I'd like to fix this in my _vimrc so I don't have to call "set tw=0" every time I open a file that has this setting.
My guess is that you are getting the defaults, not a setting from an ftplugin. Check
:verbose set tw? ft?
to confirm. See the examples under
:help autocmd-patterns
for one way to set your own defaults for *.txt files.
On second thought, the default for 'tw' is zero, so you are not getting defaults. Perhaps some ftplugin used :set instead of :setlocal and you are getting the global value of the option. I think the rest of what I wrote is still on target.
The problem was in vimrc_example.vim the line
autocmd FileType text setlocal textwidth=78
sets the textwidth on txt files. Also my formatoptions get reset and no longer have l or lv (verbose doesn't give any detail who did it)
/etc/vimrc can also contain a set tw command - it certainly did in my case, thereby forcing all my files to a text width of 78 until I changed it manually.
How can i do that gvim will auto tab back when I write the word 'end'
(like it does when Im write '}')
I add this rows to gvimrc
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
Thanks.
You can use a plugin like vim-endwise to achieve this. This plugin will de-indent the current line when you type end accordingly. Not only that, if for example you are using Ruby, then the plugin will insert end appropriately, whenever you are starting a method or a condition and so on, like def, if, etc.
More Information: https://github.com/tpope/vim-endwise
If you are writing in one of the languages that vim recognizes, then chances are good that someone has already written an indentation plugin. Try
:filetype indent on
:e foo.???
:help :filetype-indent-on
OK, so first of all: don't use smartindent. Use filetype-specific indent rules. Vim has built-in support for many file types, or you can define your own using 'indentexpr', see :help 30.3 and :help indent-expression.
When using the 'indentexpr' option, another option called 'indentkeys' defines when Vim will automatically adjust the indent.
I am trying to customize my vim popup completion menu as per this guide:
Vim Wiki: "Omni completion popup menu". It notes
add to your vimrc if you always want this choice.
However, with the following settings in my .vimrc file
colo desert
filetype plugin on
set ofu=syntaxcomplete#Complete
highlight Pmenu guibg=brown gui=bold
I get the following:
Note: when I manually enter the highlight command manually, it works:
How do I get the popup to use a color scheme defined in .vimrc without having to enter it in manually each time?
if you put your commands in below sequence, you can get what you want. the syntax option will override your highlight option.
"" gui configuration
color murphy
syntax one
highlight Pmenu guibg=brown gui=bold
See vim - Override colorscheme
Short answer is that you can't. If you use a colorscheme, then all other color scheme tweaks in your .vimrc are ignored. The AfterColors plugin solved the problem for me.
Hmm, most likely there is a highlighting command coming afterwards that is overriding your option. Probably when the filetype is determined and adjusts options. Try running it without the filetype plugin on option set.
If that works, you'll need to adjust the filetype detection to run your special options afterwards.
Well, I'm a newb at Vim, so I'm guessing there's a 99% chance it's a user error!
Vim was soft wrapping long lines very nicely thank you, then a couple of days ago it started to insert hard wraps but only when I had saved the file.
I have been through wrap, nolinebreak, textwidth, nolist, and all combinations thereof to try to get softwrap back but to no avail. Heck, I even read the help pages. All of 'em.
Here's the relevant bits from my .vimrc (as you can tell, I'm getting desperate):
" Editing
set aw ai
set et ts=8 sts=2 sw=2 nu
set fo+=tcrqw fo-=o
set showmatch matchtime=5
set whichwrap=<,>,h,l,[,]
set cursorline
set nofoldenable
set wrap
set linebreak
let mapleader = ","
I picked up this .vimrc from using Vundle.
I found the culprit, Tim Pope's Vim Markdown plugin. Lovely plugin but personally prefer soft wraps, will have to find how to change it!
but only when I had saved the file.
This should hint to you that some plugin is touching the buffer Pre-Write.
Find out which it is by doing
:au BufWrite,BufWritePre,BufWriteCmd
:au FileWriteCmd,FileWritePre
To see where the trigger was installed from:
:verbose au BufWrite,BufWritePre,BufWriteCmd
:verbose au FileWriteCmd,FileWritePre
I have a suspicion this is probably caused by your fo line. Having "t" in the formatoptions option means that if a textwidth is set for the current buffer then vim will break lines at this width. You may notice that this only happens for certain filetypes because different ftplugins may be setting textwidth without you knowing.
The next time you see this happening, I'd suggest running :verbose set textwidth? (with the question mark) and seeing if the value is set. This command will also point you to where it was last set.
Another test would be to just remove "t" from your fo line and see if the problem goes away.
Janus is another Vim plugin that fiddles with linewrap/linebreak and textwidth.
:verbose set tw?
told me:
textwidth=72
Last set from ~/.vim/janus/vim/core/before/plugin/filetypes.vim
Now I just need to figure out the right incantation to disable that... for now, I just added set textwidth=99 to my ~/.vimrc.after file, but there may be a better way...