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.
Related
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
This question already has answers here:
Is there a way to change vim's default mode
(5 answers)
Closed 9 years ago.
I am trying to move from GEDIT to GVIM but I noticed that when I open a file I am not free to edit it.
unless I press i to go in (INSERT) mode.
Is there a way to bypass this? So the file is instantly editable?
You can do this by editing your .vimrc file. It looks like set im! is the command you're looking for to set input mode as the default, but you'll also need to explicitly map escape to change to command mode.
A better question is why you would want to do this, though. Unless you're opening a brand new file, once you know vim, you'll probably spend very little time in insert mode, as you should be using more advanced command-mode commands (append, correct, etc) to edit and update your code at the appropriate places. If you're just going to use vim the same way you use gedit, don't bother - gedit is better than vim at being gedit.
EDIT: After reading the comments on your question, it sounds like you really, really shouldn't be using vim. It's not something you want to stumble into by default, certainly not if what you want is a basic editor with customizable display.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Is there any way to reduce the command in VIM?
In vim to open your NERDTree menu you type :NERDTree, but that actually really annoys me, because it's long and mixed case. Since you close it with q, I want to open it with a short key (maybe :n, you can also provide suggestions for that if you feel like it). How can I change that?
I am sorry if this is simple, but I am a newb, and I don't know form where to start aproaching such a problem -from the plugin files, or is there a special remapping technique in your .vimrc.
You can use
map <F2> :NERDTreeToggle<CR>
to map NERDTree to any key you like (F2 in this example)
it's also possible to map it to :n
map :n :NERDTreeToggle<CR>
but that's not very common, I like using one of the F-Keys because that's faster.
This question already has answers here:
Setting servername in vimrc as opposed to command line switch
(2 answers)
Closed 1 year ago.
I have to type
gvim --servername xdvi toto.tex
to enable inverse search from xdvi to latex.
Is there a way to encapsulate this in .vimrc: when vim detects the .tex file, an autocmd sets the servername to vimrc ? It seems it is too late once vim is launched, or?
If not in .vimrc, where ?
The special v:servername variable is read-only; you cannot change it from within Vim. If you need a certain servername, that has to be specified on startup via the --servername argument.
To avoid the additional typing, I would suggest a special shell alias (on Unix) or small batch wrapper (on Windows). Depending on how crucial this is, you could even add some scripting logic to check for .tex arguments, and only then set the servername.
The only way to achieve this from within Vim would be forking a new instance of Vim (via system()), passing all arguments plus the servername argument, and then closing the original Vim instance via :quit. But that's very cumbersome and not as simple to implement.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
vim backspace leaves ^?
My Vim Backspace is not working correctly. When I press it, it prints out ^?. I found some other suggestions on how to fix it such as adding set backspace=indent,eol,start to the .vimrc. But this does not seem to work right. Does anyone have any other ideas on how to fix this?
Thanks!
perreal's answer tells you how to alter the Linux console to match vim's current settings, but you also have the option of altering vim's settings to match the Linux console. The relevant options are t_kb and t_kD to tell vim what characters the terminal generates when you press the Backspace and Delete keys respectively. Query the current settings first so you can see what they're set to:
:set t_kb? t_kD?
and then change them like this:
:set t_kb=XXX t_kD=XXX
In place of the XXX's you should type Ctrl-V followed by Backspace for the first one and Ctrl-V followed by Del for the second one.
There's another question you could be asking, about why these settings weren't properly detected in the first place. If you're interested in investigating that, we'll need to see your $TERM variable and the corresponding terminfo database entry, which you can get with:
echo $TERM
infocmp | egrep 'kdch1|kbs'
From vim-docs :help fixdel
Note about Linux: By default the backspace key produces CTRL-?,
which is wrong. You can fix it by putting this line in your
rc.local:
echo "keycode 14 = BackSpace" | loadkeys