VIM refresh screen or fix rendering - vim

When I ssh into an account for hosted website and use vim to edit files; I see strange behavior.
Let's create file with one number (01 to 25) on each line.
Change line 15 from "15" to "15 15 15 15"
Change the size of xterm window so that only 10 lines are visible.
Position cursor on first line of file.
Press PgDn then PgUp.
On line "07" I see "07 15 15 15" yet only "07" is really in the file!
If I use up/down arrow to move many lines away and then back again; everything is fine; but this is annoying.
Is there a command that will "refresh" the vim screen?
is there a command line option to "fix" this behaviour?
Is there a way to permanetnly fix this behaviour for my account on this remote system?

Related

Very long line in VIM does not show up without having the cursor on it

I'm using VIM version 8.2
When I'm on the line above the very long line, it appears as if there is no line below it. (Refer Below Image)
But as soon as I move down, I get to see everything in that line. (Refer Below Image)
Is there a way to make the very long line appear whithout having the cursor on it?
You can set display+=truncate or set display+=lastline, which tell Vim to display the last line but put ### in the first or last column to indicate the rest is not displayed.
Also see https://vim.fandom.com/wiki/Working_with_long_lines

How to fix odd behaviour when doing :r TEST in vimtutor?

I was going through Lesson 5 in vimtutor, and I had selected a part of lesson 5.3 in visual mode, and then done :w TEST as instructed in lesson 5.3.
In Lesson 5.4 however, I was told to do :r TEST, and so I did do that.
The text from the file TEST was indeed pasted right in to where I had the cursor.
However, when I tried to press the j key to move down further, something weird happened. The line after which I had my cursor on came up to the line I was working on (both these lines were from the pasted text from TEST file), the apparent line break gone.
Eg.
line before I press j
another line
became
line before I press janother line
for some reason.
What I've tried:
pressing Esc. This results in literally nothing happening
looking up Lesson 5.4 and read function of vimtutor and vim in Google and see if others had had this error. Nothing relevant came up.
Anyway, thanks for the help in advance!
Sounds like you hit J which does a « join » on the two lines.
Check your shift key/caps lock.

How to repeat a navigation command in Vim

The . key can be used to repeat the last insert command. However, we might do some navigation that is not part of the insert, but we want it repeated.
Imagine commenting out lines like so:
// line of text
// line of text
line of text
line of text
The insert command is to put the two forward slashes and a space. That can be repeated using the . key. The navigation would be to navigate down one line and then left some number of characters. That part is not captured by the . key command.
How can we achieve this functionality? I read that it was not available in Vi some years ago, but I'm wondering if it exists now in the latest version of Vim.
Press qX, where X is any of the writable registers (typically: pick any lowercase letter).
Do whatever actions you want to record.
Press q again to stop recording.
Press #X (where X is the same register) to play it back (count times, if used with a count).
Press ## to replay the most recently used macro (count times).
I read that it was not available in Vi some years ago, but I'm wondering if it exists now in the latest version of Vim.
If the Vim docs are to be believed, Vi did not support recording (steps 1-3), but did support #. Then you would have to manually yank the characters into the target register with "Xy<motion> or some other register-writing command. That also works under Vim, but I can't recommend it because it is much more error prone.
Another approach would be "block select then edit" approach:
ctrl + v - block select
then go down j or down-arrow
shift + i will put you in insert mode. Make the change here where you want it to be reflected on all the other lines you've selected.
esc twice will show/repeat that change you made on the line one.
If you have a big range of similar lines and want to put // at the beginning of it, you can do something like:
:15,25norm! I//<space>
You can also use visual area (vip selects an entire paragraph)
:'<,'>norm! I//<space>
using a pattern
:g/TODO/norm! I//<space>

gvim Windows - Message popup box with OK button?

I am running gvim version 7.4 on Windows. Everytime i start gvim, before it loads the window with multiple tabs that i have, i get a popup. First thing i would see is this popup titled "Message" and it contains the following lines, with an "OK" button at bottom. If i click the ok button, gvim starts running without any further problems. I have not been able to find anything in google searches. What is the cause of this popup, and how to eliminate it ?
"Week-3-SCHEMA-DESIGN\hw3-2and3-3\blog.py"
"Week-3-SCHEMA-DESIGN\hw3-2and3-3\blog.py" [unix] 332L,
10531C
"Week-3-SCHEMA-DESIGN\using_update.30ad2dc2bda6.py"
"Week-3-SCHEMA-DESIGN\using_update.30ad2dc2bda6.py" [unix]
110L, 2680C
"Week-3-SCHEMA-DESIGN\hw3-2and3-3\blogPostDAO.py"
"Week-3-SCHEMA-DESIGN\hw3-2and3-3\blogPostDAO.py" [unix]
144L, 4261C
"Week-3-SCHEMA-DESIGN\hw3-2and3-3\blogPostDAO.py.b4vim.orig"
Additions after couple of replies:::
Thanks for the replies, Ingo Karkat and romain. I took a look into the vimlog file. It is 26000 lines long. So i searched for the first filename blog.py which occurs only in the following section of vimlog output file. The corresponding region of vimsession file is also given below.
line 140: badd +113 Week-3-SCHEMA-DESIGN\hw3-2and3-3\blog.py
line 141: badd +0 Week-3-SCHEMA-DESIGN\hw3-2and3-3\blogPostDAO.py.b4vim.orig
line 142: silent! argdel *
Error detected while processing C:\nirmal\vimsession:
line 142:
E480: No match: *
line 143: set lines=43 columns=171
line 144: edit Week-3-SCHEMA-DESIGN\hw3-2and3-3\blog.py
"Week-3-SCHEMA-DESIGN\hw3-2and3-3\blog.py"
"Week-3-SCHEMA-DESIGN\hw3-2and3-3\blog.py" [unix] 332L, 10531C
Since the above output contained an error at line 142, i took a look at my vimsession file. BTW, i have the very last statement of my _vimrc file as source vimsession. Even if i delete my vimsession file (while i have my gvim session open), and recreate it from the open gvim session, i still get the same kind of message box. I took a look at the help pages for argdel which occurs in line 142, causing the error, but unable to figure why this line gets into the vimsession. Following is the relevant section of my vimsession file, which pertains to the very first line that comes up in the popup Message window.
badd +1 Week-3-SCHEMA-DESIGN\hw3-2and3-3\blog.py
badd +98 Week-3-SCHEMA-DESIGN\hw3-2and3-3\blogPostDAO.py.b4vim.orig
badd +3466 \Documents\ and\ Settings\bharathil\vimlog
badd +89 \nsam\vimsession
silent! argdel *
set lines=43 columns=171
edit Week-3-SCHEMA-DESIGN\hw3-2and3-3\blog.py
In my readings, I have not yet finished the User Manual, even half way. My _vimrc file is the one that was suggested as starting setup (by the User Manual). I have only added minimal stuff to it. I don't understand how the argdel gets into the vimsession, since i don't remember messing with that command at all. I suspect once i figure out how to fix the error near blog.py (first file in error list), i will be able to repeat the process, for all the 10 tabs (2 windows in each) and stop this message box from popping up.
This is output from stuff in your ~/.vimrc or plugins that runs before GVIM is fully initialized. The execution of those commands should be delayed via
:autocmd VimEnter * {commands-here}
How to find these commands? You can capture a full log of a Vim session with vim -V20vimlog. After quitting Vim, examine the vimlog log file for suspect commands.

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 :/

Resources