VIM: available shortcuts? - keyboard-shortcuts

I use many shortcuts for my work in vim.
Other shortcuts are taken by plugins.
Sometimes I would like to add a shortcut for a new command but note afterwards that the shortcut was already taken.
Is there a way to see a list of all available shortcuts in VIM?
(all ctrl-shift-alt shortcuts)

Type :help index to see the mappings (shortcuts as you name them) and commands defined by vim itself.
Type :map to see the mappings defined by your vimrc and plugins. Type :verbose map to know where each mapping was defined.
Also :help map-listing to check what's displayed, but you probably already know about it (it's in map.txt help manual).

If you also want to check which maps or commands are defined by vim itself you can use
:help index

:map //lists all the shortcuts that are assigned.
map also takes a key combination as an argument that lists only the shortcuts assigned to this key combination.
To list all the mappings assigned for Ctrl-V:
:map <c-v>

I found this helpful...
http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html

If you want a sorted, searchable list of your current mappings to look for unused keys, see my answer at:
How to search in the Vim mapping listing?
As a starting point, for the keys are not mapped by default, see
:help map-which-keys
You can use :map < key > to check a specific mapping. Example: to check Shift-F2, :map S-<F2>.
AFAIK, there's no way of getting a list of what's unmapped without writing code to iterate through each possible key combination and check if there is any output from running :map < key > for that particular key.

Related

Intellij IDEA shortcut to "create field"?

There is an useful functionality in IDEA that lets you create a field, and it appears in the little light-bulb when you highlight the non-created variable.
However, I can't find the short-cut, searched for "create field" in the settings but no luck.
Anyone knows?.
Control + Alt + F on a literal will give you the option to extract the value into a field.
Use Alt-Enter to access the lightbulb menu and then use the arrow keys to select the necessary option. There is no possibility to assign shortcuts to individual quickfixes (there are too many of them).
On MacOS, its option-command+F.
Its much faster than Option-Enter, then you need some brain cycle to select create field in the down down menu

Can you store a theorem number in a variable?

I use \newtheorem and the numbering is done automatically. Sometimes in the text I'll refer to a theorem by this number. I'd like to have a variable equal to this number, so if the theorem number changes, the references will change also.
Yes, it works through the usual \label/\ref-mechanism:
\begin{theorem}\label{thm:foo} ...
That was Theorem~\ref{thm:foo}
(You'll need two runs of LaTeX for the number to settle, you'll get a message about changed references.) Label commands "tack onto" certain things like section headers, captions, items of enumerations and, indeed, theorems and friends.
There are also extensions that can automatically distinguish sections from subsections or figures, for that, see hyperref's \autoref or the cleveref package, but don't worry about it at this point.
You need to put a \label between the \begin{yourtheorem} \end{yourtheorem} and use \ref to refer to it as usual.
You can check this link for explanations with some broader context about theorems

Find references of Path Variables used in ISM file

I have one ISM file created using Installshield. In Path Variables Explorer, I can see some variables defined. How can find if they are used anywhere in the ISM ? I want to remove variables if they are unused.
I am using Installshield 11.5 Adminstudio.
Thanks in Advance.
---Sambhaji
I wrote a program that did something similar only it was looking for unused string table entries. You can read about it at:
Use Linq to XML to Clean up ISString Tables
It would only take a few tweaks to change the query to look at the table that holds ISPathVariables.
Sambhaji,
ISM files may be binaries or XML, make sure you are using the XML format.
I'm not sure if the option is the same in InstallShield 11.5, but in InstallShield 12, you have to go to General Information-->Project Properties-->Project File Format.
I understand that the Binary format is a bit faster than XML, but in order to keep my projects under version control I prefer the XML format.
There is one simple way to find references of variable or properties.
Go to Additional Tools -> Direct Editor -> Tables
Just click on Tables and press Ctrl+F (Search option). And type the variable/property you want to search & hit enter.
It will show the reference of variables/properties. Press F3 to see next occurances.

Mapping a default key binding in vim

I want to remap Ctrl-] which is used for jumping to the tags to another key binding.
These mappings work:
:map <F2> <C-]>
:map <A-1> <C-]>
But this mapping doesn't work:
:map <C-1> <C-]>
What might be the reason for this?
I believe the problem is that Ctrl+1 is not a valid ASCII character. From this list
(search for "^^" or "^#" to see the table )
you will see that there are several keybindings such as ctrl+# Ctrl+^ and Ctrl+]
so you are not actually calling Ctrl+2 or Ctrl+6 but their ASCII equivalents.
VIM is designed to be lightweight and fairly platform independent. so if it isn't in the list of ASCII characters you cannot make a binding to it.
It might be getting trapped/filtered by your OS. If you check the mappings, is it listed?

Is there any way I can define a variable in LaTeX?

In LaTeX, how can I define a string variable whose content is used instead of the variable in the compiled PDF?
Let's say I'm writing a tech doc on a software and I want to define the package name in the preamble or somewhere so that if its name changes, I don't have to replace it in a lot of places but only in one place.
add the following to you preamble:
\newcommand{\newCommandName}{text to insert}
Then you can just use \newCommandName{} in the text
For more info on \newcommand, see e.g. wikibooks
Example:
\documentclass{article}
\newcommand\x{30}
\begin{document}
\x
\end{document}
Output:
30
Use \def command:
\def \variable {Something that's better to use as a variable}
Be aware that \def overrides preexisting macros without any warnings and therefore can cause various subtle errors. To overcome this either use namespaced variables like my_var or fall back to \newcommand, \renewcommand commands instead.
For variables describing distances, you would use \newlength (and manipulate the values with \setlength, \addlength, \settoheight, \settolength and \settodepth).
Similarly you have access to \newcounter for things like section and figure numbers which should increment throughout the document. I've used this one in the past to provide code samples that were numbered separatly of other figures...
Also of note is \makebox which allows you to store a bit of laid-out document for later re-use (and for use with \settolength...).
If you want to use \newcommand, you can also include \usepackage{xspace} and define command by \newcommand{\newCommandName}{text to insert\xspace}.
This can allow you to just use \newCommandName rather than \newCommandName{}.
For more detail, http://www.math.tamu.edu/~harold.boas/courses/math696/why-macros.html
I think you probably want to use a token list for this purpose:
to set up the token list
\newtoks\packagename
to assign the name:
\packagename={New Name for the package}
to put the name into your output:
\the\packagename.