I want to have highlights for multiple words. i normally do this in .vimrc-
:highlight HLONE ctermbg=grey ctermfg=white
:highlight HLTWO ctermbg=blue ctermfg=white
:highlight HLTHREE ctermbg=green ctermfg=white
nnoremap 1 :mat HLONE "<C-R><C-W>"<CR>
nnoremap 2 :2mat HLTWO "<C-R><C-W>"<CR>
nnoremap 3 :3mat HLTHREE "<C-R><C-W>"<CR>
But its not working for me at my current workplace for some reason. Presessing one highlights the way it should. but pressing 2 (2mat) gives error -
E481: No range allowed
its seems 2mat, 3mat, matchadd are not available. vim version is 6.3.
is there any workaround or alternative?
Vim 6.3 is from 2004; the :2match commands were only introduced in Vim 7.0. If you're stuck with that version, you can only use :match, or alternatively try :syn keyword (but that will interfere with the regular syntax highlighting).
Even without root / administrative rights, you can usually compile / install a local version of Vim.
Advertisement: If you find the multi-word highlighting indispensable and use it often, try out my Mark plugin; it automates the process of :2match, offers many colors, and highlights in all windows (but requires Vim 7.2). On that page are also links to other such plugins, some of which still use syntax highlighting and may work even with Vim 6.
Related
For running GNAT metric (for Windows, GPL 2017 or CE 2018) I'd like to include the RTL sources as well. There is a "-a" switch but it seems to be ineffective. When I'm forcing visibility of RTL sources, only ada.ads and system.ads are processed. Guessing it is a "crunched name" issue (RTL file names forced to 8 character names) I've tried other tricks without success.
My question is: is there a way to get the RTL source metrics (of the source files actually used) with GNAT Metric?
I'm using the command
gnatmetric -a -xs -nt -j0 -Pmyproj.gpr -U somemain.adb
TIA
In the meantime I've found a workaround by using the gnathtml.pl script.
I've customized the script a bit by removing the H1 headers.
The result is a few hundreds of HTML files with the sources of units actually used: the script does find all dependencies, recursively, through the .ali files - including the RTL.
Then I group the HTML files together, convert them back to text files, pass them through Adalog's Normalize tool for removing comments and empty lines, count lines with the wc command, and the job is done.
What is the difference between vi and vim editor?? I want difference in technical point of view not in theatrical. If you gave example then it is much helpful for me or all the readers.
From the vim documentation:
Vim is a text editor that is upwards compatible to Vi. ... There are a lot of enhancements above Vi: multi level undo, multi windows and buffers, syntax highlighting, command line editing, filename completion, on-line help, visual selection, etc.. See
":help vi_diff.txt" for a summary of the differences between Vim and Vi.
The vi_diff help page is quite extensive; it's over 1000 lines as of vim version 7.4. That's the best place to look. You can access it in vim by running :h vi_diff, or online at http://vimdoc.sourceforge.net/htmldoc/vi_diff.html.
You should also be aware that on many systems running vi will actually invoke vim, because of the presence of either a hardlink or a symlink (or maybe even a script or executable, which I've seen). But there are slight differences between the two methods of invocation; for instance, running vi may not load your .vimrc.
vim has vi's features plus other features like, the ability to visually select blocks of code, and much more. Syntax coloring/highlighting as well. You can use vim for just about anything you would use vi.
Vim stands for Vi IMproved. It has been ported to multiple different platforms, but is functionally almost the same. Wikipedia it!
I recently installed Zsh in hope of a better life and brighter mornings. However, I quickly realized Zsh introduces various issues in conjunction with tmux.
The first issue was some weird stuff happening at the end of the prompt, before my commands, but this was resolved by supplying tmux with the -u flag for unicode-support. However, I am stuck with one final issue that needs resolution before I can use Zsh with tmux:
Usecase: Autocomplete a command which contains multiple suggestions
Issue: Autocompletion shifts suggestion one character to the right, while leaving the original character behind (visual bug, it is not included in the command)
Example 1.
Then I hit TAB..
Example 2.
Then I hit TAB..
Note 1: This does NOT occur when using the Bash-shell.
Note 2: I am using "oh-my-zsh". This issue only occurs when using the provided themes. This narrows it down to an "oh-my-zsh"-theme issue, not native zsh/tmux.
In case some people still get a similar issue, see also the top-voted answer of Remnant characters when tab completing with ZSH. The plugin you were using may have had the same non-printable characters issue, that would explain the symptoms.
I'm simply trying to get shift+tab to be a recognized key sequence during my rxvt terminal sessions. So I can map it to usefulness such as:
bindkey "\e[Z" reverse-menu-complete
But, based on my research, I'm pretty sure the answer is no. Just want to make sure.
This is a hard limitation of rxvt? (Is there a technical reason for this limitation? Or just an unsupported feature?)
I can't get it to emit that either, although strangely enough, the rxvt source code (as shipped with Cygwin) does appear to have support for it:
case XK_Tab:
if (shft)
STRCPY(kbuf, "\033[Z");
else {
...
Anyway, rxvt development stopped eight years ago. Try its successor, rxvt-unicode, aka urxvt, where this does work. If you're on Cygwin or MSYS and you were using rxvt without an X server, which urxvt does require, try mintty.
I have Vim 7.2 installed on Windows. In GVim, the <C-PageUp> and <C-PageDown> work for navigation between tabs by default. However, it doesn't work for Vim.
I have even added the below lines in _vimrc, but it still does not work.
map <C-PageUp> :tabp<CR>
map <C-PageDown> :tabn<CR>
But, map and works.
map <C-left> :tabp<CR>
map <C-right> :tabn<CR>
Does anybody have a clue why?
The problem you describe is generally caused by vim's terminal settings not knowing the correct character sequence for a given key (on a console, all keystrokes are turned into a sequence of characters). It can also be caused by your console not sending a distinct character sequence for the key you're trying to press.
If it's the former problem, doing something like this can work around it:
:map <CTRL-V><CTRL-PAGEUP> :tabp<CR>
Where <CTRL-V> and <CTRL-PAGEUP> are literally those keys, not "less than, C, T, R, ... etc.".
If it's the latter problem then you need to either adjust the settings of your terminal program or get a different terminal program. (I'm not sure which of these options actually exist on Windows.)
This may seem obvious to many, but konsole users should be aware that some versions bind ctrl-pageup / ctrl-pagedown as secondary bindings to it's own tabbed window feature, (which may not be obvious if you don't use that feature).
Simply clearing them from the 'Configure Shortcuts' menu got them working in vim correctly for me. I guess other terminals may have similar features enabeld by default.
I'm adding this answer, taking details from vi & Vim, to integrate those that are already been given/accepted with some more details that sound very important to me.
The alredy proposed answers
It is true what the other answer says:
map <C-PageUp> :echo "hello"<CR> won't work because Vim doesn't know what escape sequence corresponds to the keycode <C-PageUp>;
one solution is to type the escape sequence explicitly: map ^[[5^ :echo "hello"<CR>, where the escape sequence ^[[5^ (which is in general different from terminal to terminal) can be obtained by Ctrl+VCtrl+PageUp.
One additional important detail
On the other hand the best solution for me is the following
set <F13>=^[[5^
map <F13> :echo "hello"<CR>
which makes use of one of additional function key codes (you can use up to <F37>). Likewise, you could have a bunch of set keycode=escapesequence all together in a single place in your .vimrc (or in another dedicated file that you source from your .vimrc, why not?).