How to disable linting in vim (no, it's not ALE) - vim

Recently, the vim built into my Mac has started to show me linting feedback visually whenever I save. This is annoying and I'd rather it not happen. (Previous 20 years of using vi/vim did not have this behavior.)
My web searching suggests perhaps it's ALE, so I tried to disable it with :ALEToggle, but vim replied with "E492: Not an editor command: ALEToggle." So I don't think it's ALE.
The gutter shows many instances of S> as the indicator of where linting feedback resides, and then highlights characters within those lines as points of concern. See examples in screenshot below.
What linter uses S> and how do I disable it globally, for all files? I don't need or want this feature.
The relevant parts of my ~/.exrc file are here. (Note that things like ^H had to be typed out, because trying to paste them here failed for obvious reasons.) There is a little more than this in my file, but everything not shown here I've tried commenting out and it doesn't help, so it's not the problem.
execute pathogen#infect()
set ai
set ts=4
syntax on
set expandtab
set nu
filetype indent off
set softtabstop=4
set shiftwidth=4
set smarttab
set hlsearch
set ignorecase
set t_Co=256
colorscheme wombat256mod
map ^H :nohlsearch<Enter>
set mouse=a
set relativenumber

It looks like you're getting style warnings from Syntastic.
Either you can remove the plugin by deleting ~/.vim/bundle/syntastic or you could try adding this to your Vim config:
let g:syntastic_mode_map = {"mode": "passive"}

Related

Vim doesnt respect vimrc indentation settings

I am new to using Vim, and have been using "The Ultimate Vim configuration" on GitHub. It uses 4 spaces wide tabs as default, so to change that, I changed my .vimrc file to the following:
set runtimepath+=~/.vim_runtime
source ~/.vim_runtime/vimrcs/basic.vim
source ~/.vim_runtime/vimrcs/filetypes.vim
source ~/.vim_runtime/vimrcs/plugins_config.vim
source ~/.vim_runtime/vimrcs/extended.vim
" Own settings
set number
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
set smarttab
try
source ~/.vim_runtime/my_configs.vim
catch
endtry
The my_configs.vim file is deleted, so I know that the indentation settings are not being overwritten there.
The problem is, if i source the vimrc file from vim with :source ~/.vimrc The indentation works perfectly, but if I close Vim and open again, then the indentation is back to 4 spaces wide instead of 2 as specified in the vimrc... All other settings from the Ultimate Vim Configuration get loaded from vimrc but not the indentation settings, which is really frustrating, as I need to source the vimrc file every time i want to use vim.
Any help is greatly appreciated, I really would like to exclusively use Vim but if this cannot be solved then I need to keep using Visual Studio Code :(
Thank you in advance.
EDIT: Here is the output of running command :verbose set tabstop? softtabstop? shiftwidth?:
tabstop=2, Last set from ~/.vimrc line 10
softtabstop=2, Last set from ~/.vimrc line 11
shiftwidth=2, Last set from ~/.vimrc line 12
When you're editing a Python file in Vim, it will auto-detect the file type and apply Python specific settings. Amongst those, it will set the soft tab stop recommended by PEP 8.
You can find these settings in ftplugin/python.vim in your Vim runtime:
if !exists("g:python_recommended_style") || g:python_recommended_style != 0
" As suggested by PEP8.
setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8
endif
You can override those settings with a global variable, which you can set in your vimrc. To disable the Python tab stop automatically set by Vim, include the following somewhere in your vimrc:
let g:python_recommended_style = 0
Note that those settings are there for a reason, they're pretty standard for Python and it's highly unusual to see Python code indented by a different number of spaces... But you have the knob to override it if you really want to.

Vim colors not behaving how I expect?

I read this article on turning off syntax highlighting, and I wanted to try the "color" scheme the author uses (effectively all white with some bolded words and a yellowish cursor), which he links to here. However, when I try to apply it in my terminal, it ends up looking like this instead:
What could be causing that? Context:
macOS 10.13.2
Terminal 2.8 (xterm-256color)
The color file exactly as it appears in the second link is in ~/.vim/colors/
My .vimrc:
set nocompatible
syntax on
set formatoptions=tcroql
set relativenumber
set incsearch
set hlsearch
set smartindent
filetype indent on
let g:go_highlight_trailing_whitespace_error=0
From the comments in the color schema I see you need to install and configure base16-shell.
Set this variable in your .vimrc:
let g:base16_shell_path=base16-builder/output/shell/
before running :color. Set the actual path where you install the scripts.

Vim ignores shiftwidth specified in .vimrc

I am using Vim 7.3.154 cli on Linux Mint 12 "Lisa"(x64).
I prefer using a tabstop and shiftwidth of 2 columns.
My .vimrc has
:set ts=2
:set sw=2
to accomplish the same.
Whenever I open a new instance of Vim, tabstop value is retained, so existing tabs are rendered according to .vimrc. But somehow the shiftwidth value gets changed to 3. This results in 3 column indention while auto-indenting.
Running :set sw=2 on the new instance of Vim fixes this issue.
Can anyone tell me why Vim is ignoring/changing shiftwidth value from .vimrc?
I tried disabling all plugins to no avail.
Vim compiled options | .vimrc
This answer just summarizes what we discussed in the comments. :)
This is most likely caused by the fact that you have file specific settings enabled. Check :h modeline for more info on that. Make sure that those files you have the problems with don't have this line in them.
Instead of only setting tabstop and shiftwidth you should also setup a couple more settings regarding whitespace and tabs.
set noexpandtab " Make sure that every file uses real tabs, not spaces
set shiftround " Round indent to multiple of 'shiftwidth'
set smartindent " Do smart indenting when starting a new line
set autoindent " Copy indent from current line, over to the new line
" Set the tab width
let s:tabwidth=4
exec 'set tabstop=' .s:tabwidth
exec 'set shiftwidth=' .s:tabwidth
exec 'set softtabstop='.s:tabwidth
Check this video for some extra info: http://vimcasts.org/episodes/tabs-and-spaces/
So this is the answer to the actual problem that you were able to solve. That php.php file was in the /plugin directory. That directory gets loaded once, each and every time Vim starts up. Check this: http://learnvimscriptthehardway.stevelosh.com/chapters/42.html#vimplugin
If what you want is that file to load only on PHP files then you should put it in the /ftplugin folder: http://learnvimscriptthehardway.stevelosh.com/chapters/42.html#vimftplugin
Read the documentation there, it should be a .vim file, in other words in this case it would be called php.vim.
What Pathogen or Vundle do is modify the runtimepath (:h runtimepath), nothing more, nothing less.
So you can now accept this answer, by clicking the little green arrow to the left of this answer. :)
You can run:
verbose set shiftwidth ?
to check what is setting the value of shiftwidth. It might coming from a plugin. You can also choose to modify the value there.

VIM CINO not working as expected

I have searched high-and-low for the answer to this question, and have had no luck. I moved away from an integrated development environment to using VIM. (I've been very happy about it, too!) Most of my code is written in C.
I cannot seem to get my cindent options to work correctly. I want my indent levels to be set at 4 space, but no matter what I do, I get eight spaces.
I have tried a number of different options, without success. Here are what I believe are the applicable settings from my .vimrc:
" Set options for c program formatting
set cindent
set tabstop=4
set expandtab
set softtabstop=4
set shiftwidth=4
set smartindent
set cino=>4,e4,n4,^4,:4,=4
set colorcolumn=81
Any thoughts on what I might be doing wrong? (In case it matters, the other plugins that I am using are crefvim, c.vim, minibufexplorer, and cscope_maps).
Thanks for your help.
I think you've misunderstood the purpose of the various C indent options. Almost all of the values that can be set on cino to modify the indentation are described in the vim manual as "Add N to the prevailing indent" under certain circumstances. (Emphasis mine)
You're getting 8 space indentation because you've told vim that you want a standard indent of 4 spaces (via :set sw=4) and then, for example, you've told cindent that you want another 4 spaces of indentation inside of any braces which appear in the first column (via :set cino=^4).
I loaded your settings, minus the cino bit, into a clean vim. I got plain-vanilla, four-space-indent C formatting thereafter.

How to impose hard wrap against my soft wrap wishes?

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...

Resources