In vimrc, what's difference between "syntax on" and "syntax enable"? [duplicate] - vim

This question already has an answer here:
Is there a difference between `syntax on` and `syntax enable` in vimscript?
(1 answer)
Closed 3 years ago.
Seems both options are provided to make programming language highlighting effective. But what's the difference between these 2 options, can I just use on of them? Are they exclusive of each other?

:help :syntax-on:
The :syntax enable command will keep your current color settings. This
allows using :highlight commands to set your preferred colors before or
after using this command. If you want Vim to overrule your settings with the defaults, use:
:syntax on

Related

Looking for plugin/way how to highlight syntax in `.md` files in Vim [duplicate]

This question already has answers here:
Enabling markdown highlighting in Vim
(5 answers)
Closed 1 year ago.
Is there a way/plugin to enable syntax highlighting in .md files in Vim?
```js //will highlight javascript
```py //will do python etc
you can try:
':syntax on' then ':set syntax=markdown'
you can try installing a plugin such as plastic boy. If you go ahead with this solution and it caused white space at the end of lines to be highlighted. Check out this fix: https://stackoverflow.com/a/10964847/14944117

stackoverflow syntax highlighting in vim [duplicate]

This question already has answers here:
Enabling markdown highlighting in Vim
(5 answers)
Closed 9 years ago.
Today i woke up with a simple idea.
It would great to have "stackoverflow synthax highlighting in vim".
Do you know a simple way to go SO style ?
Stack Overflow uses Markdown syntax, so this should do it (in Vim versions 7.3+, which ship with it):
:setf markdown
as separate filetype
If you want to do customizations, it's best to define your own custom stackoverflow filetype by creating a file ~/.vim/syntax/stackoverflow.vim with the following contents (and defining corresponding filetype detection rules):
" Quit when a syntax file was already loaded.
if exists('b:current_syntax') | finish | endif
runtime! syntax/markdown.vim syntax/markdown/*.vim
filetype setting from browser
Since Stack Overflow is browser-based, you probably use a browser plugin to do the editing in Vim. I've described such a setup that can automatically set the filetype based on the currently edited URL for Firefox in my blog post Pentadactyl set filetype in external Vim editor based on URL.
Your question is fuzzy; if you mean to mark certain blocks as having a certain syntax (which on Stack Overflow can be done with language: lang-js HTML comments), my SyntaxRange plugin enables you to define a different filetype syntax on regions of a buffer, either manually or automatically based on markers.

Displaying Vim variables [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Get current value of a setting in Vim
I know that you can use :set to change Vim settings and that you can set up a configuration file ~/.vimrc but I'm running into some issues getting this to work with MacVim and I want to be able to display what a Vim environment variable is.
Is there a command like :show tw or something like this that will do this?
Thanks.
:set tw?
or if you want to know where it is set as well
:verbose set tw?
For even more setting fun
:options
In addition to the accepted answer you may also use :echo &tw.
This has the advantage that you can't accidentally set a boolean option by forgetting to add the ?. The disadvantage is that you cannot use this method with verbose.

Checking if an optional Vim feature is available, using Vim script [duplicate]

This question already has answers here:
How can you check which options vim was compiled with?
(3 answers)
Closed 7 years ago.
I am using the same Vim configuration on several computers. They are running different Vim builds, and i do not have root access. I therefore want to check for feature support inside vimrc, so that i can avoid running unsupported plugins.
Is there a way to check if an optional Vim feature is supported from inside a Vim script? In the case i ran into, i want to detect the relatively new float support.
:h has
:h feature-list
if has('float')

Cannot use arrows in VI on some consoles [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Linux vi arrow keys broken in insert mode
When I use vi in some consoles, I can use the arrows normally. But in others if I press the up arrow, it prints an "A". I then have to press escape to use the arrows normally.
I'm guessing it's something in the terminal configuration. How do I fix this?
Try using Vim instead of vi. I was forced to use vi at uni. It's crap.

Resources