Blank at the beginning of each line in idea - jetbrains-ide

I don't know how it happened, but how to remove blank ?

Looks like you are in Distraction Free Mode or alike. Just check Main Menu | View | Appearance: exit all modes there.
If you are not in one of those modes and this somehow stuck from a previous invocation, then try entering into such mode and exiting it.

Related

Strange behaviour on full stop (.) whilst in insert mode vim

I am using vim with Pymode to write python source code. I have the come across some strange behaviour which is intermittent but very annoying.
If I am in insert mode and type a full stop (e.g. self.method()), whilst typing self vim prints at the bottom
-- Keyword completion (^N^P) The only match
As soon as I type the full stop vim seems to freeze momentarily, then
-- INSERT -- appears at the bottom, but my cursor is now on the full stop, so that when I write method() it actually appears behind the full stop. I keep having to go back and move the full stop.
I can't figure out when it happens and when it doesn't, when I open a new file it doesn't happen straight away.
Any ideas on what may be causing this? I have only noticed it recently.
This is a problem caused by some combination of pymode and rope. Either way putting
let g:pymode_rope_lookup_project = 0
in your vimrc solves it apparently. See here for the pymode issue.

how do I toggle between modes in linux less

After typing this command
less +F file_name.data
I am able to see a file as data is being written to on the fly. This is great but after the data has been fed to the file, I would like to search around the file without leaving the file. Even after all the data has been written to it, it still says at the bottom of the screen "Waiting for data...(interrupt to abort)".
the phrase "Interrupt", to me, means CTRL+C or CTRL+Z but that is not right since I think it will take me out of the file complete. Instead, I think I need to just toggle between modes without leaving the editor. How do I do that?
Normally CTRL-C is trapped by less so that actually you don't quit from less but rather return to the "standard mode". If you don't like this behavior you can run less with -K option in which case less will exit after CTRL-C. By the way, please note that instead of run less +F file you can just hit F in "normal mode".
So to answer your question: you toggle between modes by pressing F and CTRL-C.

Vimscript check if current buffer has unsaved changes

I currently have my status line set up so that it's orange in insert mode and white otherwise. I'd like to make it go another color when I drop back to normal mode if the file has any unsaved changes, as I regularly take a little walk down a rabbit hole wondering why my changes have not taken effect. The little "[+]" doesn't smack me in the face enough ;)
I can't find any functions that start with "buf" and look like predicates for dirtiness though. I assume one exists, but is named something else. I expect there to be something like bufdirty() or bufchanged(). Any pointers? :)
I think that you are looking for
:echo &mod[ified]
which returns 1 if modified and 0 if not modified.
I like the idea of using the statusline color to indicate the buffer state. In fact, I've written the StatusLineHighlight plugin, which indicates the following attributes: modified, readonly, unmodifiable, special non-file "scratch" (but not the insert mode that you're using; for that, I find Vim's mode indication in the lower left corner enough).

What does "1 line >ed 1 time" mean in VIM?

Lately I have been encountering a problem in VIM.
I use the shortcut >> (hold shift, press the period key twice) to indent a line. Sometimes I must be hitting something wrong because this shortcut stops working until I restart VIM.
Every time I try to indent with the shortcut it says "1 line >ed 1 time" instead of indenting. Or, if I have 3 lines selected and try to indent them all it will say: "3 lines >ed 1 time".
How do I fix this and restore the shortcut?
Thanks!
I have no idea, why your shortcut is not working, or what's the wrong key that you have pressed.
Regarding your 1 line >ed 1 time message: What you're doing is to shift a number of lines to the right. Vim is just notifying you about what was done, which is: One line is right-shifted one time. The > here is the right shift operator and >ed is just short for "shifted". If you do the opposite it says <ed, which is shifted to the left.
You can find more details in vim's help with: :help >
When a section is marked (visually marked) one > is sufficiant. The 2nd > should start another indentation, but since now nothing is marked it waits for another >.
More than this, I couldn't reproduce any error. (As it was mentioned by frosch03, the msg is just the normal response)
ed was an (well, probably still is) old editor, but I doubt that is what Vim is telling you. I cannot reproduce the message you're getting, nor find anything in the documentation regarding it.
Does this happen also when you're using a clean Vim (when you start it without vimrc with vim/gvim -u none)? If so, could you paste your vimrc if it's not too big somewhere (one of those paste sites should do nicely), so we can take a look to see is there any weird combo inside causing that behaviour.
Apart from that, not much advice I can offer regarding the given data :/

What should I use vim Visual mode for?

I have been using vim for a couple of years now, and though I have learnt a lot of time saving shortcuts, but I have never used the Visual mode, which is supposed to be all powerful :
... Visual block mode (to edit columns) is something many editors lack, but that I can't live without. I have shocked and awed people at work using just this, making some edit in a few keypresses that someone would've otherwise spent ten minutes doing manually.
I want to understand why and when should I be using Visual mode.
Can someone give me an example of "making some edit in a few keypresses that someone would've otherwise spent ten minutes doing manually"?
If you see CTRL-CCTRL-V and recognise what it does, you should use visual mode.
If, like me, you see A:esc0df:$p$x as an edit command, don't bother :-)
When I use visual mode, it's to select whole lines or blocks. For example you can do [esc][shift+v][y] to copy the currently line I'm on. Here's more information.
Visual mode allows you to perform an operation on a block of text. It is the only way to perform an operation on a block in Vim.
A simple example of this would be copying or moving text.
A more advanced example would be sorting the lines in a certain part of a file. You can do this by entering visual mode, selecting a block of text, pressing Esc to enter command mode, and typing !sort. You can see more details about his example and how it works here: http://www.oualline.com/vim-cook.html#sorting_visual
I actually just did a screencast showing off great uses for visual mode. You can check it out at http://lococast.net/archives/241
As other's have said, it's great for doing any sorts of editing (edit, remove, search/replace) withing a specific range of code.
Insert a column of commas.
Delete a column of commas.
Act on rectangular selections.
Act on a section of text that is not a line or word.
Several good examples have already been given. Here are some others.
I also use visual mode:
To swap two regions of text.
To refactor out variables, types, and functions.
To surround the selection with pair of things (usually brackets)(NB: surround.vim also does this I guess), but also with control statements.
But simply most of the time to have a more interactive way to yank or change text.
To paste over without overwriting the current unnamed register.
To highlight the current selection (with Mark.vim)
And to do many other things I don't remember right know.

Resources