When I use the Linux screen program, pressing the tab key will move between multiple screen windows. But when I want to press Tab to add blank space in a file using vim, it is useless, and will move to another screen. How can I use Tab with vim in screen?
EDIT: (taken from comments)
I have this keybinding in my .screenrc file:
escape ^Ii
And if I remove that, the Tab key works again.
The problem is your escape ^Ii entry in the .screenrc file.
In many/most terminal emulators, ^I (CtrlI) is the same key code as the Tab key (ASCII 0x11, aka "TAB" or "Horizontal Tab").
So the only solution is to choose a different escape key for use in screen.
Related
I have to press "i" and an extra spacebar in order to switch to Insert mode in Vim, which is pretty annoying.
You can see there are 5 "i"s on the screen in Normal mode, if I press spacebar, Vim will switch to Normal mode and 4 "i"s will be added to the file.
It has the same problem for "a", "s", "o" and other command key.
Please help.
Based on the underlining, this looks like a temporary input buffer of an IME (Input Method Editor; to insert non-English characters with a standard keyboard). The application (Vim) doesn't see the characters until you complete the composition (with the Space key). Only then does Vim receive the characters, and processes them.
You need to turn off the IME, at least for the terminal / Vim. There's usually an icon in the systray where you can select the input method, and often a keyboard shortcut like Super + Space toggles the state of it. Vim can interact with the IME, too, and only use its services for insert mode (to be able to write in Unicode scripts). Read more about it in :help mbyte-XIM (Linux) and :help mbyte-IME (Windows).
So, I am trying to copy from one file to another:
- They are both in the same session of tmux
Here is how I get the problem:
tmux new -s vim
Now I split the window in two:
C-b + %
And now I open two files in vim, one in each pane. When I try to yank and paste some lines from one file to the other it doesn't work.
For that I am using the "p" key
If you have different instances of vim running in tmux, then you could copy between them using tmux's copying commands.
For instance:
ctrl-b [ to enter copying mode
<space>, then move around with the arrow keys to highlight some text
<return> to finish
ctrl-b ] to paste (including in a different window or pane)
Update: See this blog post for more details. The exact answer may depend on your key bindings.
You can make the two vim instances share the same clipboard.
First check that your vim supports clipboard by typing vim --version, if you see +clipboard in the output, then in your ~/.vimrc, add
set clipboard=unnamed
now you can freely yank and paste between tmux panes and windows.
How to do a text search into a cygwin window buffer ? Is there a way to make the same kind of text seach as in Windows console buffer (right-click > search) ?
(I use mintty)
In mintty, you can do that using the sequence Alt+F3.
More information in the mintty man page
Searching in the text and scrollback buffer
Alt-F3 opens a search bar with an input field for a search string. Matches are highlighted in the scrollback buffer. Enter/Shift+Enter find the next/previous position of the match and scrolls the scrollback buffer accordingly. The appearance of the search bar and the matching highlight colours can be customized.
Beware this sequence is very close to the infamous windows sequence that closes a window. (which uses F4)
Alternatively, you can enable the Ctrl+Shift+H shortcut by going into the options pane of mintty and enabling Ctrl+Shift+letters shortcuts in the Key section of the options.
You access the options pane by right-clicking the mintty icon of the mintty window (upper left corner)
There's no such function currently. The closest alternative is to 'Select All' (followed by 'Copy' if you've disabled copy-on-select), paste into a text editor, and search there.
You have a few options.
Use cmd | tee file, then search in the resulting file afterwards.
Use screen's copy/scrollback mode.
(Mintty) I'd mucked up an rsync command (wrong direction) so I wanted to track which files had been altered. So I manually selected the Mintty screen output from the bottom with my mouse hold left mouse button and then push to top of the screen and then tediously waited while the screen scrolled forever backwards then when I'd gone back as far as I needed I did a Control-Insert to copy. I then pasted into a text file which I could then search, edit, grep, vim to my hearts content. Don't know if this the only way but it works!
I used emacs editor as buffer. From emacs open shell : C-x shell, then I can do search within buffer as current window.
I have a two part question regarding mouse clicks on gvim.
1.) I would like to change my gvim double left mouse click into something similar to the windows environment (ie Notepad, Microsoft Word), wherein it: highlights the current word, and replaces it with whatever I type. This is akin to pressing 'cw' for changeword in vim.
2.) I would like my single mouse click to place a cursor upon the selected text and enter insert mode. Again like how a mouse normally behaves in Windows.
1) nmap <2-LeftMouse> ciw
You could use viw here, which will visually select the current word, but then you will still have to press c to replace it.
2) nmap <LeftMouse> <Leftmouse>i
Or replace the i with an a if you would prefer to append, rather than insert.
You can use behave mswin or so $VIMRUNTIME/mswin.vim so set up a lot of stuff so that it works more like a regular windows program.
The specific setting you are looking for are:
set select=mouse
this causes the mouse to start select mode instead of visual mode. Select mode causes the selection to be deleted and insert mode to be entered when a printable key is pressed.
As in Prince Goulash's answer
nmap <LeftMouse> <LeftMouse>i
will turn on a sort of click-to-type mode.
My terminal emulator is configured for Unicode character encoding and my .vimrc contains the line
set encoding=utf-8
but when I try pasting the word "café" into vim, it comes out as "café".
I can make an "é" in vim by typing Ctrl-vu followed by the 4-character code point (00e9) but I'd like the ability to paste it in.
The solution was to uncheck the "Escape non-ASCII input" checkbox in the Advanced tab of the Terminal.app settings.
Instead of copying the character from the clipboard and pasting it into the text editor, you can add it to the file using vim's digraph feature.
So, with default settings, using your example, you could enter insert mode, then hit Control-k, and type e'. The result will be é.
You can see the list of defined digraphs by running
:digraphs
and general help by running
:help digraph
which also explains how to customize your mappings.
If you are truly set on pasting the characters in, Shift-Insert has always worked for me.
How to type a non ASCII code into vi
You'll have to know what your encoding is to enter the proper codes, I assume you left VI at the default.
In VI, go into insert mode, while in insert mode, press
Ctrl-v 172
That should insert the Logical Not (sideways and inverted L) character defined here:
http://www.htmlhelp.com/reference/charset/iso160-191.html
From where are you trying to paste it? If it is opera, then since opera-10.5* paste is broken in both directions. Before pasting anything you need to use xclip -o|xclip -i workaround (add -sel clip for clipboard).
What command do you use?