I have recently started my first job in a windows shop in over a decade, so have set up cygwin so I can continue using tmux + vim, as I have become accustomed to over the years. Everything is working great so far, except that in vim, my visual mode is deleting the character after the selection if I highlight something and then hit d.
For example:
If the line is:
Plug 'tpope/vim-sensible'
I press v to get into visual mode and then select the text between the two single quotes (represented by brackets):
Plug '[tpope/vim-sensible]'
And then I hit d to delete. The expected result is:
Plug ''
But what I get is:
Plug '
If I highlight the beginning single quote as well:
Plug ['tpope/vim-sensible]'
Then when I delete the expected result is:
Plug '
But what I actually get is:
Plug
Does anybody know what might be going on to cause this? My .vimrc is identical to my linux machines, none of which have this problem.
As Matt pointed out above, this can be fixed by changing cursor shape to "block" in the Options->Looks->Cursor section of the cygwin terminal app.
Related
It used to be part of my Vim vocabulary... change to visual mode, place cursor to a search word, type * and all text between first and next search word would be highlighted. The highlighting can continue as long as you repeat pressing * and there is the next matching search word. Perfect set of commands to copy text, or simply as visual aid.
Coming back to Vim now after some time, this is not working on my configuration. What happens now is that only the letter under the cursor and all other such letters get highlighted.
I wonder if I have some conflict in my mappings or else? I use Vim v7.3. Anyone can help?
Vim does not have a visual mode command for *; this only works in normal mode. However, many people have a customization that supplies the super star visual variant, from Search for visually selected text - or a plugin like my SearchHighlighting plugin; its plugin page has links to many alternative plugins.
I guess you had something like that, too, but forgot about it. I also doubt that is was triggered by Ctrl + *; combinations of Ctrl and non-alphabetical letters mostly aren't available as unique mappings. The usual mapping is just *, overloading the original normal mode command for visual mode.
Vim 7.3 is from 2010 and very outdated. To become reacquainted with Vim (which I commend!), please choose a modern variant. It should be possible to install the latest version 8.1; if you can't find a proper package for your distribution (for Windows, check the binaries from either vim-win32-installer or tuxproject; on Linux, it's also not very difficult to compile it yourself (e.g. from the GitHub sources).
I know that this question has probably already been answered but I can't find it.
Here is what I want to do, imagine I have world in my clipboard.
And my file looks like :
Hello guys
I want to replace guys by world.
I know that :%s/guys/world/g would work but my section is actually huge.
I would like to select my selection with v (visual mode) then when I have the proper selection highlighted, paste my clipboard. I tried p it's not working.
Any help ?
I just did this on gvim 8.0.2. This post explains how to do it: https://www.reddit.com/r/vim/comments/337cxj/yankpaste_tofrom_system_clipboard/
From that post:
Firstly, execute the command
:echo has('clipboard')
If it returns 1 you're good to go, otherwise check if your distro has a more full-featured vim package (or compile it yourself)
To copy to the clipboard, enter either visual, visual-block , or visual-line mode, select your text and press the sequence (not combo):
"+y
and your text is ready to be pasted into any other program or window.
Additionally you can execute that sequence in normal mode, however its behavior is not ideal (in my opinion). It yanks the remaining characters on the current line, after the cursor plus the characters on the next line up until the column of the cursor. Decent if your cursor is at column 0, otherwise kind of annoying.
By replacing the 'y' with a 'p' you get the same behavior you would expect from just 'p' in normal mode, however pasted from the system clipboard. On a modern setup, this is probably not as useful, as we have Ctrl-Shift-v, but I can certainly think of some use-cases for this.
Have you tried the normal paste command of terminal ctrl+shift+v? It works for me after selecting content through v.
I am trying to use vim (Vi IMproved 8.0) on macOS Sierra for the first time and I noticed that a column selection in visual mode does not work properly.
Typing Ctrl+V toggles visual mode on, and by moving left or right I can make a horizontal selection as usual.
For example, here I selected 'no play' on the second line
However moving cursor down, instead of selecting a column, selects the current second line until the end and the next line is selected from the beginning to the cursor position.
I am guessing that this issue might be associated with the Terminal setting, rather than with bad settings in .vimrc since removing .vimrc does not change this behavior.
Moreover, I can ssh into a remote computer and still experience the same issue, even though vim on that remote computer works fine if I use a different computer to ssh into it.
I would appreciate any suggestions or tips on how to address or understand this issue.
I have a problem that have been bothering me for days now.
Whatever I do, I simply cannot place any single {,},[ or ].
Every time I try, it takes me up to the next or previous paragraph. I've looked it up and I can't find a good way to unmap it and finally have my azerty keyboard to behave correctly so I can peacefully code
In the normal mode, press 'i' to enter the insert mode.
And you can start to edit your file.
After everything is done, press the 'ESC' key and then ':wq' to save your modification.
Vim / vi has several different modes. This dates back to the times when you would edit using a teletyper, i.e. no "visual" representation of the data you are editing, no mouse etc.
With only the "usual" keys at your disposal, you need to navigate in the data, you need to insert data, and you need to execute commands on the data. Not so coincidentially, these are the three modes of Vim / vi, and in each mode, the keys do something differently.
By default, the editor starts in the "normal mode", which you will use to navigate, and enter the other modes from.
In this mode, ) moves you to the end of the sentence, ( to the previous sentence. } and { do the same for paragraphs, combinations of [ and ] work with chapters.
If you enter "insert mode" (most simply by pressing i in "normal mode"), you can enter all the above letters normally. You exit "insert mode" by pressing <Esc>. You will recognize "insert mode" by -- INSERT -- being displayed in the bottommost line of the screen.
If you are in "insert mode", and pressing any of the above keys does move your cursor instead of entering the corresponding symbol, there is some (broken) configuration at work. Check your ~/.vimrc, and if necessary, rename it and try again with a "clean" configuration.
It is next to impossible to do Vim / vi justice in the scope of a SO answer. It is very much an expert-friendly editor, not a novice-friendly one. You need to actually learn how to use this editor, but it is absolutely worth it in the long run.
In insert mode, you should be able to insert brackets without trouble.
In normal mode, those correspond to motions.
To go to insert mode from normal mode, press i.
See: :h object-motions
Alright, Problem Solved ! I had to uninstall and reinstall the Ubuntu bash on windows 10 multiple times and it worked ! Thanks for the help everone !
I want to select multiple lines of code and indent them with [TAB] but this is not working.
The opposite of it, to shift it to the left side with [Ctrl]+[TAB] works.
The problem occurs in IntelliJ IDEA 14.01 but not in other programs ("Gedit" for example).
It is no problem to indent a single line of code by placing the cursor at the beginning of the line.
I'm working in a CentOS 6.2 VM (VirtualBox) on a Windows 7 machine.
I found out, that the "VIM Emulator" is causing those effects.
Tools --> Vim Elmuator (toggle on/off) OR Ctrl+Alt+V
As #Sailcomp pointed out the IdeaVim plugin is what causes the problem.
However if you take a look at Vim's wiki it explains how to indent/unindent using >> and << respectively. Along with the . command to repeat.