Making JavaSciptLint more configurable - vim

I am using mvim with plugin JavaScriptLint. It works great.
However sometimes I work on jQuery or other JavaScript libraries and every single time I save the file, I get tons of warning and cursor moves to the very first warning.
What I would like to have is some way to turn this feature On or off. Something like
:set enableJavaScriptLint
:set disableJavaSCriptLint
My vimrc file is here. And the plugin is here . Notce at line number 14 the plugin autodetects if jsl command is present then it gets enabled. I guess I need to write some function to enable or disable that call.
Any help is appreciated.

Not exactly what you have in mind, but
you can remove the autocommand and call the function manually or replace it with a shortcutkey maybe like this:
map <F11> :call JavascriptLint()
you then have to remember to first save the file, and only call it on *.js files though...
Or, you could fix all warnings...it'll stop complaining too ;-)

Related

vim-javacomplete2 - Don't write first suggestion to line

I recently installed the plugin vim-javacomplete2 via vim-plug into Vim 7.4. Overall, I am happy with it but there is one thing that bugs me. When i initiate it with <C-x><C-o> it writes the first suggestion to the line like so.
Is there anyway to have it list the suggestions without writing the first one to the line like this?
I see it done on the plugin's GitHub page but i am unable to figure out how.
Since it says it uses the vim omnicompletion, i bet it works with the normal completopt settings: :set completeopt+=noinsert see :help completeopt for more information

Can't Remove leafgarland-vim TypeScript experimentalDecorator warning

I have the leafgarland-vim plugin installed, and when I save my .ts file, I always get this warning:
I've tried adding let g:typescript_compiler_options="--experimentalDecorators" to my ~/.vimrc, and I've also entered that command from inside vim, after first typing ":". I can even do :echo g:typescript_compiler_options and it returns --experimentalDecorators. Yet every time I go to save I get this error.
How can I get this error to go away? --experimentalDecorators just doesn't seem to do its job.
edit:
I tried this from inside vim:
:let g:typescript_compiler_options = '--dnwejuidbnwejudbn'
And the code still compiled, with the same warning. I don't think the let g:typescript_compiler_options is actually doing anything.
edit2:
edit3:
In the meantime, this hack gets rid of the warning:
I'm guessing but I think you are seeing these warnings from another plugin, probably Syntastic. Syntastic uses its own compiler settings.
You could try adding something like this line to your vimrc:
let g:syntastic_typescript_tsc_args = "--experimentalDecorators"
See :help syntastic-checker-options for more details.

Run vim commands on errors?

Ok so this question is vaguely related to one of my previous questions:
I want Vim to be able to save and close similarly to Photoshop in regards to buffers?
Basically the solution I found (or gets really close to what I want), is a plugin called BufOnly which basically closes all buffers that have not been modified. So when I have a lot of buffers open and I want to close, I just run this, and then just care of everything that I haven't already. It works well.
But I'm greedy. I want this to execute automatically when I need it to. Basically I would like it so that if I run qa, if qa runs into -->
E73: No write since list change (add ! to override)
Then I want to run
:BufOnly<CR>:bd <cr>
Is there a way to do that?
you can write a function with vim's try-catch mechanism. example:
function! Funk()
try
execute "qa"
let yes = 1
catch /^Vim\%((\a\+)\)\=:E37/
execute "BufOnly"
execute "bd"
endtry
endfunction
this will catch the error :E37 and do the command you want. I don't have that plugin installed, I therefore didn't test with BufOnly. I tested with "h gg", it shows the help page of gg
to call the command, type :call Funk(), of course you could create mapping for that function call.

Is vim able to detect the natural language of a file, then load the correct dictionary?

I am using several languages, and currently I am obliged to indicate to vim with which of these the spell check must be done. Is there a way to set up vim so that it automatically detects the correct one? I vaguely remember that in a previous version of vim, when the spell check was not integrated, the vimspell script made this possible.
It would be even better if this could apply not only to a file but also to a portion of a file, since I frequently mix several languages in a single file. Of course, I would like to avoid to load several dictionaries simultaneously.
I don't know if there is a way to autodetect it, but if you put vim:spell:spelllang=foo,bar,baz at the bottom of the file, vim will set the spellchecking languages to foo, bar, and baz when the file is opened. Note that you must put at least one space before that text, or vim will think it's part of the file.
Since vim is missing this feature, I found it useful to define shortcuts like these in .vimrc:
command! Nb :set spelllang=nb
command! En :set spelllang=en

vim :make automatically jumps to first file with error

When executing :make from vim, after make is complete it automatically jumps to a file with errors. Is there a way to avoid this
EDIT
This is usecase i want to achieve
I want :make to execute then quicklist to open but the current file which i am working on should not be switched to the one with errors
with default settings after :make execution quicklist opens and the current file also changes
From the docs:
7. If [!] is not given the first error is jumped to.
So, just invoke it as :make!.
You can run :make! | copen, which should place your cursor in the quickfix list instead of changing the current buffer. You can make this even easier by putting command Mymake make! | copen in your .vimrc, so you only have to run :Mymake to do this.
Note that when selecting errors from the quickfix list, they will scroll a buffer with the file already open rather than change the current window if possible, and you can open the files in new windows with <C-w> Enter.
It might not be the cleanest solution, but setting the errorformat to an empty string should do the trick, ie.
:set errorformat=""
That should keep it from matching the compiler error strings.

Resources