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.
I thought it was surprising that : doesn't even seem to open the vim last line mode but when I do:
:10
nothing happens. Which I thought was weird. Anyone know how to make vs code go to a line using vim commands?
I am using: https://marketplace.visualstudio.com/items?itemName=vscodevim.vim
Resources:
related git issue: https://github.com/VSCodeVim/Vim/issues/1889
reddit: https://www.reddit.com/r/vscode/comments/etfy37/how_does_one_go_to_a_specific_line_with_vs_code/
To get into command mode with vim in vscode or just regular vim, you simply type the esc key.
https://alvinalexander.com/linux/vim-vi-mode-editor-command-insert-mode
The exact commands that worked for me are in this order
First go to command mode by hitting the ESC key
Then type the line number 10
Then G
Or while in command mode go to last line mode with :. The colon while appear at the bottom in the blue section of vs code:
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 !
Issue is what the title says. Earlier I used to copy text from text files open in vim simply by selecting text and doing Ctrl + C. But now it puts me into visual mode, thus not allowing to copy the text. Its really annoying. Anybody knows any fix for this.
Thanks.
You probably have the mouse mode active. You can turn it off with:
:set mouse=
And turn it back on with
:set mouse=a
If you are using iTerm, you can leave mouse mode on all the time if you want, and hold Option when you want to select without using visual mode. I am not aware of a way to do that in OS X Terminal.
Update (from Younes in comments): For Terminal.app on El Capitan, press the Fn key to bypass the mouse mode. See this question for more.
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.