How to cancel the jump function of cscope? - cscope

When I installed the cscope and the ctags, they share the same ctrl+] command, how can I cancel the jump fuction of cscope, retain only one of them?

:set nocscopetag should force vim to only search tag files on ctrl-].
:set cscopetagorder=1 will make vim search tags files before cscope databases, but it will still fall back to cscope if it can't find the entry in the tags files.

Related

Using windows shortcuts in vim

I was wondering if there was a way to use windows shortcuts in vim (in particular those used to select lines (with shift, alt, ctrl) ?
Maybe an option to set in the .vimrc ?
Thanks.
You can enable this via the following command in your ~/.vimrc:
source $VIMRUNTIME/mswin.vim
See :help mswin.vim for a detailed explanation.
Alternatively, copy that script into ~/.vim/plugin/mswin.vim. This allows you to gradually comment out or tweak certain mappings. The downside of this plugin is that many Windows shortcuts conflict with Vim commands, so you're losing some features, and the completely different structure may prevent you from learning and using Vim effectively. Having started with a Windows background myself, this is how I proceeded. Now, I only use a few of those Windows mappings in Vim, and have customized several remaining ones so that they provide a true added value.

Intellij Idea's Completion Style for Bash

Is there any smarter bash completion than the normal one. I'm imagining having something like the auto completion feature of Intellij Idea. For example is there is a folder named anExampleFolder, if I type aEF or even aef and then press tab it completes it or somehow open a drop down menu.
fzf ("fuzzy finder for your shell") may be what you're looking for. For your example of cd-ing to anExampleFolder, you have 3 options using fzf:
fdRETaEF↑↑RET
Launch fzf with recursive list of child directories. Enter fuzzy search term aEF, select match with arrow keys, accept.
ALTCaEF↑↑RET
Same as above but using a key binding instead of shell function
cd aEF**TAB↑↑RETRET
Using the experimental auto-completion integration
Note that in all cases the arrow keys may not be necessary, if the fuzzy-search finds what you're looking for as the first match. And it can be used for lots of other stuff besides cd; the GitHub README has plenty of other examples and bindings.
As sylvanaar said - Bash plugin for Intellij should be enough.
zsh has such intelligent autocompletion mechanisms as plugins.
In combination with oh-my-zsh and the plugin fasd you should achieve even more than what IntelliJ offers.

vim keybindings to use system clipboard mac

Since vim doesn't support native clipboard on OS X by default, I decided to create some keybindings to emulate it.
I started with such a command, which passes visual selection to pbcopy and replaces selection with command output. Since it has no output and just deletes text, i immediately undo the change.
:vmap c !pbcopy<CR> :undo<CR>
It works fine, but not if I'm copying the last line in the file. It is copied well, but undo doesn't bring it back. If I manually undo later, it works fine.
Is there a way to make this binding work with on the last line as well?
Remove the space between the first <CR> and :undo:
:vmap c !pbcopy<CR>:undo<CR>
Nothing wrong with setting a keybinding, but I've never felt the need to.
As with all platforms, Vim does save to the system clipboard, but only when using the visual commands. Select using any of the visual commands (V, shift-V, Control-V). Then yank. Whatever was visually selected will be on the system clipboard.

Quick-search using VIM and Netrw on Windows

I use VIM 7.2 on Windows, with the latest netrw (141i, Jan 03 2011).
I use netrw for browsing remote FTP directors. Right now, when I want to navigate to a certain file, I type /<filename> and VIM's own search function gets the cursor there. I then have to hit ENTER twice (once to exit search mode, and then again to make netrw "execute" that file).
I'm sure there's a better way to do this. Any ideas?
Thank you.
It seems that you have the 'incsearch' setting which displays occurrences of a pattern as you type it. It is necessary to hit enter to validate the pattern, then you're back to your buffer.
Maybe the Fuzzyfinder plugin could help you be quicker.
You can use :
set incsearch in your .vimrc to enable incremental search.
You'll still have to type <Enter> twice but you won't have to type the complete filename !

Is there a Firefox add-on to use vim to edit textboxes?

or "How do I answer questions on SO in Firefox using gVim inside the textboxes?"
It's All Text!
From the extension page:
At the bottom right corner of any edit
box, a little edit button will appear.
Click it. If this is the first time
you've used "It's All Text!" then you
will be asked to set your preferences,
most importantly the editor.
The web page will pop up in your
selected editor. When you save it,
it'll refresh in the web page. Wait
for the magic yellow glow that means
that the radiation has taken effect!
Vimperator makes Firefox act very much like VIM:
Vimperator is a free browser add-on for Firefox, which makes it look and behave like the Vim text editor. It has similar key bindings, and you could call it a modal web browser, as key bindings differ according to which mode you are in.
Once you have the cursor in a text box, hit Ctrl-I to open in your editor, which defaults to gvim.
The current answers don't work anymore now that Mozilla removed XUL in favour of WebExtensions. With recent firefox versions, there are the following options (sorted in descending order by the current popularity on addons.mozilla.org).
GhostText provides instant synchronization between editor and textbox via editor-specific plugins. The project is on github and the vim extension is written in Tcl.
withExEditor is cross-platform but requires a native application written in node.js. In addition to editing text fields it also allows viewing the source of the page, MathML, SVG and the current selection. The project on github and the native node.js application
Textern requires a (currently) Linux-only native application written in Python. Synchronizes the content of the text field while you type in the editor. The extension and the native app can be found on github
Tridactyl is probably what you're looking for nowadays.
It's the spiritual successor to the likes of Pentadactyl and Vimperator, which are not available for the current version of Firefox.
If you want something more like It's All Text, where the editing area appears right on top of the browser text area rather than launching an editor window, and you're willing to use Neovim, check out firenvim.
It's All Text! will let you use whatever editor you want. To use vim with it, you'll need a small shell script to open it in a terminal:
#!/bin/sh
exec xterm -e /usr/bin/vim "$#"
If you have GVim, you won't need the shell, script, obviously.
ViewSourceWith is another addon worth lookng at. It supports more than just edit boxes and text. For example, you can configure it to open images in the GIMP.
Another feature that I find useful is that it can pop-up a dialog box that shows all the js and css scripts used on the page. You can then choose to view/edit file in your preferred editor.
For answering questions on SO, you may also want to get the Vim Markdown Syntax file
The "It's all Text" extension, perhaps?
http://addons.mozilla.org/en-US/firefox/addon/4125
If you use vimperator and have the markdown syntax file installed, a useful line for your .vimperatorrc is:
au LocationChange .* :set editor="gvim -f"
au LocationChange stackoverflow\.com :set editor="gvim -f -c 'set ft=mkd'"
This will tell vim to do syntax highlighting for markdown when you are on stackoverflow.com, but not when you are any other site. There are similar hacks for wikipedia/mediawiki etc. Enjoy :)
One way to do this is to use the vimperator extension - of course, that does a lot more than what you're looking for.
At the time of writing it is experimental, but the jV extension looks good. To quote from the page:
This extension makes all html textareas into a very stripped-down version of Vi[m]. It's modal, supports infinite undo, has register support, search, visual mode, and various movement and editing commands.
When using Vimperator in Windows (I am using Vista) you may need to double-escape the path to gvim.exe to use it as the external editor. Single escaping did not work for me as Vimperator unescapes it twice. Eg:
:set editor="C:\\\\Program\\ Files\\ (x86)\\\\Vim\\\\vim72\\\\gvim.exe" -f
Then while in a text box you use Ctrl+I and it will open gvim for editing. When you save and exit it will update the text box.
There is an experimental way to directly embed the real vim in firefox using embedded editor - though it requires mozplugger and will only work on Linux.
Try out the wasavi extension. You might want to check out the all versions page to make sure you try out the latest version. (Copy of this answer.)
You can also use the ViewSourceWith addon to achieve the same. Just right-click on any text input and you can edit it using Vim.
As said by others,
as a Vi/(g)Vim user you'll probably want to look at the Vimperator addon, which also provides the what you ask:
inside a textbox, hit <C-i> to launch the external editor.
(can be defined in _vimperatorrc: set editor=gvim -f )
A hint for Mac users: if you want to use "It's all text" with vim, the easiest way is to use http://code.google.com/p/macvim/ . Point "It's all text" to the mvim script that's provided along with the .app (you can place this script anywhere, I choose /usr/bin/ so that I can load mvim from the command line)
Pterosaur is a Firefox plugin that allows you to use Vim in all input fields. It uses an actual Vim process in the background so it has all the functionality you expect, including reading your .vimrc configuration and your plugins.
With Firefox-57 on Linux, I installed textern https://addons.mozilla.org/en-US/firefox/addon/textern/, and found it to be a suitable replacement for ViewSourceWith for editing text boxes.

Resources