How could I get this Vim binding to work? - vim

qnamebuf plugin description says:
<S-F4> opens an explorer from the current working directory showing all files which are not in a hidden directory (one that starts with '.')
I'm not very good with Vim, but I imagine S-F4 is a capital S followed by F4. However, when I press S, I find myself in insert mode, and pressing F4 after this, just adds an F4 in the window. What should I do to make the command work? I am running gVim under Windows.

The S stands for Shift. So try pressing Shift-F4.

Related

How to select all text in vim normal mode?

Is there "keyboard-only" way to select an entire vim document in a way that is equivalent to a left-click and drag with a mouse in normal mode? Please do not confuse this with selecting all text in visual mode (ggVG). I want to be able to follow this up with a right-click paste into notepad++ (ggVG/ggVGy followed by a right-click paste in notepad++ does not copy the document). Thanks
Again, the "ggVG" commands are not working, nor are the "+y" commands (which I should have mentioned in my original post). Perhaps it is worth noting that I am working on a Windows local machine (where I have notepad++ open) and am generating the vim file on a linux virtual machine (slurm cluster). Under these working conditions, if I left-click drag over the vim doc and right-click paste in notepad++, the selected text copies over. However, the process is cumbersome for large files, hence my inquiry. Thanks again.
You should have mentioned that, of course, as it is not a meaningless detail at all.
Manual selection in a terminal can only select the text currently displayed in the viewport, which is obviously cumbersome for larger files. The only practical way to copy on the remote machine and paste on the local machine (and vice-versa) is to enable X-forwarding and build Vim on the remote machine against X libraries. This will give you what you want: a shared clipboard.
You won't be able to reach your goal in a practical way if you can't or don't want to install the necessary stuff on the remote machine.
As a lightweight alternative, you could simply scp the remote file to your local machine.
Just use (esc) :%y+. This will copy the entire document to your clipboard. Then you can go to notepad++, or whatever else you want to use, and paste it with a right click.
Explanation:
%: Tells vim the next command will be applied to all lines.
y: to all 'yank' lines
+: Copies all lines to clipboard, You can also use Ctrl + C instead. Note: + is sometimes bound as *. And sometimes both are equivalent.
Or you can also use the slightly longer way: ggVG+.
If you really want to be fancy you can remap Ctrl + A to ggVG or %y by adding this line to your .vimrc:
map <C-a> <esc>ggVG<CR>
Try to use Xshell remote login software. in there is a option called "To Text Editor".
Just open the file using "vi filename.c" it will displayed on the screen after that just made a left click on the work area and choose "To Text Editor--->all" . then these all text moved to a notepad file then u can simply copy and paste in notepad++.

How to copy all the text from vim editor using vim command line?

I want to select all the text from the vim editor, I tried the command :%y+ but getting error E850: Invalid register name. I get this command from this link. Please help me how to copy all the text from file which is open in vim. They are using yank, what is meaning of it..
I had a similar problem. Don't know why you got so many down votes.
The problem is that you haven't installed vim-gnome which takes about 24 MB and adds a feature to the inbuilt vim.
sudo apt-get install vim-gnome
then your command will work. :%y+ This command will copy all the text in system's clipboard.
TLDR: If you want to copy text in Vim to the system clipboard type ggVG"*y. Explanation below...
Vim runs in the terminal and, depending upon how you are using it and which type of Vim you are running, it's not really designed for you to select text with a mouse and copy and paste in the traditional way.
If you want to select all of the text using Vim then use ggVGy (note the uppercase VG in the middle). This command moves the cursor to the top of the file, enters visual mode, moves to the bottom of the file (thus, selecting all of the text) and then yanks (copies) it. You can then use p to put (paste) this code but only inside of Vim.
If you want to copy to the clipboard to use somewhere outside of Vim then try this:
First, select everything using the commands outlined above but without the final y: (ggVG). Then press "*y. This should now copy it to your operating system's clipboard and you can just paste (Ctrl/Cmd+v) anywhere you want outside of Vim. This can vary depending on what settings you have for Vim but it should work.
A brief explanation of the commands used. gg goes to the top of the file. V enters visual mode by lines. G goes to the end of the file. y yanks (copies) the text but not to the clipboard. p puts (pastes) the text.
The more advanced (i.e. cool) stuff:
" allows you to access registers. For example "a provides access to register a.
The * is the system clipboard so "* provides access to the system keyboard. Therefore, "*y yanks into the system clipboard.
While there's a great explanation of how to exploit the system clipboard in vim, it sounds like you're just having trouble getting your vim to access the clipboard in the first place. Try installing vim-gnome, it gives you the packages you need to get to the system clipboard.
For some reason, "* didn't work for me, but the exact same command with the "+ register did.
To select the whole file you can jump to the beginning, start visual mode, jump to the end:
ggVG
This question is a few years old now, but I had this same problem on Linux Mint 18. I found using xclip worked for me. You can map the command vmap <F7> :!xclip -sel c<CR><CR> in your .vimrc to have your current selection in visual mode copied to the system clipboard.
Here is a thread containing the above (and other) solutions.
You can use
Vggy/vggy or,
VGy/VGy
To visually select any number of text and then copy it, in your case it is gg / G as you want all text on the file,
gg is to copy while your cursor is at bottom of the file, gg for go to top
G is to copy while your cursor is at top of the file
Or even you can always use
Vk(as number of time)y to copy the selected lines of text.

How to copy from one split and paste in another in byobu?

So let's say I have two splits open in byobu, side by side. Furthermore, both splits have different files open in vim. I want to highlight text from one file in one split and copy it to a separate file in the other split. Any ideas?
All the results I found while searching for this talked about using the scrollback feature to copy and paste in byobu, however, that only seems to work inside a single split; not across splits.
Looks like I posted to quickly; seemed to have found the solution. I followed the steps found here:
http://linuxcommand.org/lc3_adv_termmux.php
I followed the steps:
shift-f3 - move to split to be copied from
alt-pgup - enter copy mode
space - start selection
cursor through desired text
enter - end selection
shift-f3 - shift focus to split to copy to
ensure receiving vim is in insert mode
alt-insert - paste selected text
If you are using an X Window Server, an alternative mouse-based solution to using the scrollback mode (which involves remembering a lot of keystrokes) is:
Zoom in on the current pane (Shift-F11), bringing this pane to the foreground.
You can now select the relevant text with your mouse without the vertical split getting in the way.
Unzoom the pane (Shift-F11 again)
Switch to other pane or wherever else you want to paste.
Middle click paste.
If your Vim supports the system clipboard (i.e. if vim --version output shows +clipboard), you can copy into the system clipboard from the first Vim and paste from it into the second one. This releaves us of the need to ensure the receiving Vim is in insert mode and has paste set appropriately.
The trick is to use the "+ register. So when you do the copy, prefix whatever yanking command you want to use with "+; and do likewise prefix the put command you use in the receiving Vim with it.
If you're on an X11 system, you can also use the "* register, which is X's "PRIMARY" selection buffer -- the one where text goes if you just highlight it, and which you can paste by pressing the middle button.
See :help gui-selections. GUI selection support generally requires a Vim other than "vim-tiny"; on Debian and Ubuntu the vim-gtk and vim-gnome packages are good choices.

Sublime Text 2 - Vim like search highlight in Command mode?

In Vim if I hit SHIFT * over fooBar, or type
/fooBar
all instances of 'fooBar' in the file will be highlighted and I can navigate through them using the N key.
How do I get this highlighting in Sublime Text 2 with Vintage enabled and VintageEx plugin installed (not Insert mode using ALT F3)?
In SublimeText 2, using / to start and type your search, hold down command and hit g to cycle through the highlighted results. Hit enter to go into visual mode on the result you selected.
I am also a heavy vimer who want try press N to jump to next searching word,as well as I am looking for one plugin which should done as your expect in the past,but I have changed my habit with use shift+enter or minimap to scroll instead of press N to jump, It works effective for me now.
NOTICE:
Don't press ENTER when finished press /foo with Vintage plugin on,this well stop draw outline.
The Vintageous package highlights all / instances by default.

vim path auto completion, how do I enter a directory?

When I want to open a file in vim, I enter :e to see directories on my disk (set wildmenu). Vim shows me list of directories I have, then I press tab several times to choose directory I need, and when I select that directory (vim highlights it) what should I do to stop completion on current level and enter that directory?
I know that in insert mode completion it's ctrl-y, from vim help file:
*complete_CTRL-Y*
When the popup menu is displayed you can use CTRL-Y to stop completion and
accept the currently selected entry. The CTRL-Y is not inserted. Typing a
space, Enter, or some other unprintable character will leave completion mode
and insert that typed character."
how to do that in command mode?
I think its Ctrl E in command mode
From vim docs,
*complete_CTRL-E*
When completion is active you can use CTRL-E to stop it and go back to the
originally typed text. The CTRL-E will not be inserted.
I tried this in my gVim and it works.
EDIT: Thanks to the suggestion by #François, Ctrl D does the same thing with some additional info. ie it stops completion in the current level and also shows the contents of the current selection
Something like
:e eclipse-cpp-indigo-SR2-incubation-win32-x86_64\eclipse\ <Ctrl><D>
artifacts.xml eclipse.exe epl-v10.html p2\
configuration\ eclipse.ini features\ plugins\
dropins\ eclipsec.exe notice.html readme\
It is showing the contents inside the folder eclipse too apart from stopping completion at the eclipse directory level.
When you reach the required directory pressing the tab key, press the right arrow key (or type a character and erase it). After that completion use the directory as the base one and iterates through its subdirectories.
For example, you have the following file structure in the current directory:
- a
- b
- c
- d
You type the e command and press the tab key. The first suggested directory is a. Press the tab key again to select the next directory - b. And now press the right arrow key. After that the b directory is selected and completion starts inside it.
As I said before you may type a character and erase it. If you leave a character (or a sequence of characters, e.g. prefix) it is used as a filter (selects only those directories whose name starts from the prefix).
I think there are other solutions. But the two above is fully enough for me.
One more option: when I want to select and continue, I just enter another "/" and continue tabbing. Looks a little ugly in my status line, but it's one keystroke and I don't have to leave my home row.

Resources