Vim Scrolling Slowly - performance

Vim is acting slow when I scroll. The cursor skips some lines when I'm pressing j/k continually.
I'm using xterm and urxvt. In both vim acts like this.
This happens locally, with small or big files. I do use Control + F/B they work just fine.
EDIT: ttyfast in small files did the trick but in bigger is the same. When running without customization it goes allright.

:set lazyredraw will buffer screen updates instead of updating all the time. I generally enable it when I'm doing a complex macro playback. Might help you here.

Have you tried the 'ttyfast' option? See:
:help 'ttyfast'
for help, and:
:set ttyfast
to enable it.
Also, what version are you using? And have you tried this with no customizations to see if something you've set is interfering?
Run it like this to omit any of your vimrc settings and plugins:
vim -u NONE
EDIT: If removal of customizations fixes it. Remove things iteratively until the behavior returns. Start by narrowing it down to either a vimrc problem or to plugins.

I had this problem only when using the pylint.vim plugin with syntastic. The only thing I can find that's helpful (other than disabling the syntax checker) is to disable highlighting current line:
:set cul!
This sped up my scrolling significantly.

Regexp Recomputation Bug on Vim
Depending on the version of Vim you are using, you might be affected by a regexp recomputation bug, whose main culprits seem to be highlighting the cursor line and displaying relative line numbers:
set relativenumber
set cursorline
The web is scattered with threads reporting this issue (here, here and here). The issue seems to be exacerbated if one also uses syntax highlighting.
Personally I just solved my slow scrolling problems by disabling relativenumber by adding this to my vimrc:
set number
My Vim
My Vim is the one provided by the vim-nox package version 2:7.3.547-7 on Debian 7.9. Typing :version in Vim yields:
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 11 2014 03:17:52)
Included patches: 1-488

If the other suggestions don't work, it may be a problem with your terminal. My gnome-terminal on Ubuntu was scrolling much slower than PuTTY with the same file.
If you're using Ubuntu's default gnome-terminal, you might want try another terminal program. urxvt both worked for me (terminator had similar problems):
$ sudo apt-get install rxvt-unicode
$ urxvt
The major downside is that it doesn't look very good. You can try the advice here to make it look a bit better
References:
Slow tab switching in Vim with large terminal
The GNOME Terminal is very slow in GNOME 3 [AskUbuntu]
Edit: It seems that the real solution for me may be to stop full-screening my terminal when using vim.

Late answer, but the above did not help me.
First, figure out what the exact problem is rather than flailing about disabling random stuff. Vim has a super nifty profiler.
:help prof
will get you started, but I did
:prof start ~/vim_profile
:prof func *
:prof file *
Then did a bunch of super slow scrolling. Afterwards,
:prof exit
You can then look at the vim_profile and see exactly what the problem is. In my case it was the matchparen which I fixed by adding
set noshowmatch
to .vimrc, but could be different for you.
As an aside, after I got vim itself tuned, I was able to improve performance more by using a different terminal (iTerm2, or Alacritty) instead of the built in one.

My scrolling was fixed after disabling parenthesis highlighting. In ~/.vimrc put:
let loaded_matchparen = 1

Check your silent mappings as well. If you have mappings starting with j, k, h,l then that may also cause a momentary lag.

I was running vim on a Raspberry Pi 1. Disabling this one line sped things up for me:
set foldmethod=syntax "slow!

I came here with similar scrolling problems. I really didn't want to turn off syntax highlighting altogether, so I disabled "set cursorcolumn" and "set cursorline" and my scrolling became much faster.

Related

Process running when starting terminal on Mac OSX

Whenever I start terminal on my Macbook Pro it is running a process. I have to use ctrl+C to kill it. If I close the window directly it warns me that following processs are running: login, bash, bash, perl5.12.
Any idea what might be going on here and how I get back to the normal state?
I personally had this issue a while ago. First check to see if it is from one of your profiles. Assuming you are using bash, we will look at your bash profile.
First, make sure the problem is actually stemming from your bash profile. Source the scrips as follows.
source ~/.bash_profile
source ~/.profile
If after running those you observe the same hanging problem where you have to cntrl+c, then you know what script has the problem.
The best way to remedy the situation is to comment out different parts of your script to figure out where the problem is. Backup your profile and then comment out half of your profile and do a
source ~/.bash_profile
and if it hangs or not will tell you what half the problem is on. Keep repeating this until you find the problem. It sounds longer than it actually is.

swi-prolog aborts (after installation via homebrew)

For some reasons I had to uninstall/reinstall homebrew on my MacBook Pro (OS X 10.9).
I wanted to reinstall swi-prolog via homebrew (like I did the first time). The installation process worked without any visible issue, but now every time in want to run swi-prolog in my terminal this message appears: "Abort trap: 6"
I have no clue of what that means. There is a lot of things about this message on the internet but I can't relate them with my issue.
Could you help me?
For some reason it seems that the symbolic link doesn't work correctly. In my version of swi-prolog I had to type the full path to get it to run correctly, for example:
/usr/local/Cellar/swi-prolog/6.4.1/bin/swipl
Remember to keep in mind that your version number could be different than what I have listed above.
This became extremely tedious however to remember when having to type it every time I wanted to use Prolog, so I was able to add it as an alias with this command:
alias prolog='/usr/local/Cellar/swi-prolog/6.4.1/bin/swipl'
From that point on in the current terminal session, I was able to open it by just typing:
prolog
This way is obviously much easier, however you need to remember to change the alias if the version also changes.
The command "prolog" can of course be exchanged with any command you wish to use.
Keep in mind, if you want this command to be more permanent (as in after you close the terminal window), you will need to also add the above alias command to the ~/.bash_profile file so it runs on startup.
Hope this helps!
if i am not mistaken, swi-prolog required x11 to run but now in mac 10.9, there were no x11 anymore instead of xQuartz.
i am not sure if this is the real problem now.

creating multiple tabs in the xterm session of cygwin

I am new to cygwin, since I usually use Linux. I had a quick question regarding it. From the xterm window of cywin, how do I create multiple terminal tabs, so that I can have multiple ssh (with X11 forwarding) sessions from the same window?
I tried googling this, but could not find any useful link for this problem.... I am sure there is some way to do this, just can't figure it out.
Thanks a lot for your help!
If you're already open to starting up X11, check out mrxvt. It does multiple tabs, and last I checked, it built smoothly under Cygwin.
There's also Terminator, which is a java terminal emulator... ISTR it doesn't require X11.

How can I most effectively use Emacs as an editor alongside XCode?

There are a few tutorials online (For example) having to do with configuring emacs to work with XCode, but they all seem to be for old versions, and I haven't found one that ties neatly to XCode 3.x + Emacs 23.1 in a way that I can unpack.
So, I'm running XCode 3.1.2 and the Mac Cocoa application build of Emacs 23.1. I have a passing familiarity with elisp, so modifying configurations doesn't scare me, particularly. I'd like to be editing my Objective-C code in Emacs, because the XCode editor is painful once you've used a real text editor (snark, snark).
What should I do to make this happen?
For Emacs.app you can adopt a cleaner approach, and it doesn't require you to change configurations (unless you don't like make-frame to be called when a file is opened from XCode, but it's very easy to change).
Well, the customization should be similar to the documentation you pointed to. With Emacs 23, the server/client code has changed just a little. Namely, you can start it with the [--daemon][1] option to have Emacs start a server in the background. Then, have XCode just call Emacs using [emacsclient][2]. There are options you can use with emacsclient to force a new frame (graphical window): -c, and you can even start it off with -a to ensure you get an emacs if you forgot to start it with --daemon.

Why do Windows consoles lose command-line history (up arrow) after a time?

It seems random: after some amount of time / usage of any console I use on Windows Vista, I lose the ability to use the command-line history (or command buffer, if you prefer...), and hitting the up or down arrow no longer does anything at all, meaning there are essentially 0 items available in the history.
I've seen this behavior in Cygwin, CMD, and PowerShell.
Sometimes this behavior applies to processes running inside the console - Python, MySQL client, etc.
Is this an inherent problem in Windows? A setting somewhere? Are there other consoles that don't have this problem?
ps - if you think this is non-programming related, please see other questions regarding programming tools, for instance, nearly anything tagged "eclipse" which deal with how to use the IDE rather than programming for it.
Two ways, I think.
1) Far Manager is a good choice for a shell. Even if you don't need it's all power (file/archive management, editor, huge number of plugins, macros), you can use it as a wrapper/executor for cmd, tcc, sh or any other program, shell or command processor.
For example
take 3 files from distrib (Far2 or Far3): far.exe, fareng.lng and (optionally) fareng.hlp
run "far.exe /w", press Ctrl+B Ctrl+O
type any command in command line: dir, set, notepad, putty, an so on...
History will be preserved between sessions, you may access it by Alt+F8 (press Ctrl+Alt+F to switch history into filter mode).
Far 2.0 stores history (and settings) in the registry.
Far 3.0 stores history in SQLite database, and may be portable.
Also, Far can autocomplete commands from history or files/paths from disk. And there is plugin (YAC) which can autocomplete from aliases and so on...
2) I have found recently interesting project: Clink - Bringing Bash's powerful command line editing to Microsoft Windows' cmd.exe
Powerful Bash-like line editing from GNU's Readline library. Read more on Readline's keyboard shortcuts.
Superior path completion (TAB).
Paste from clipboard (Ctrl-V).
Support for the completion of executables/commands, and environment variables.
Undo/Redo (Ctrl-_ or Ctrl-X, Ctrl-U)
Improved command line history.
Persists across sessions.
Searchable (Ctrl-R and Ctrl-S).
History expansion (e.g. !!, !, and !$).
Scriptable completion using Lua.
It seems a young but budding project, so I had created an option for use it in my Console Emulator.
There's a maximum size of history buffer in a windows "DOS box" -- Upper left icon, right click, select properties and you'll see the Command History has a buffer size of 50 by default.
Check your Scroll Lock key.
DOH! I hit mine by accident so that up and down arrow just scrolled the window.
In PowerShell you can control the maximum size of history via the MaximumHistoryCount automatic variable (default is 64)
PS > $MaximumHistoryCount
I have encountered this issue for years. Mostly with python used from the command line in a bash shell. After some experimentation today when this re-occurred for the 1000th time (more or less) I was able to fix the issue by setting the Command History for the shell to have buffer size of 999 and Number of Buffers to 999 (I picked the largest possible setting for each, it's possible any setting would have worked other than what I was prior, which was 50/50). To access the Command history, right click in in the upper left corner of the shell window, select Properties, then the Options tab. I'm not sure the ramifications of these settings to performance of the shell, but thus far nothing else seems affected and command line history is once again working for me in the same shell it previously wasn't working in. I realize this answer is similar to the answer by steve-gilham, but perhaps gives a bit more background.
Admittedly, my answer involves 1 experiment that worked.
All history in console is provided by Doskey. It also is always available for all character-based, interactive programs (such as program debuggers or file transfer programs), and maintains a command history buffer and macros for each program that it starts.
In DOS era, one can remember softwares that after execution cleared the history. I'm not sure they were bugs, expected behavior, or the mix of two. But some Doskey bugs were know as you can see in the end of this link.
I suggest anyone who get this problem to try Doskey command options and see if (s)he can correct it.
I've never experienced this, but I wonder if pressing the key combination ALT+F7, which clears command history according to DOSKEY /?, might be the cause.
If "suddenly" all history is gone, maybe a new cmd-shell starts?
Test:
C:\Users\Guest\>doskey /history
…long history…
C:\Users\Guest\>cmd
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Guest\>doskey /history
…no history…
C:\Users\Guest\>exit
C:\Users\Guest\>doskey /history
…old long history…
Of cause in this example you'l see the new cmd-Start but if you try out this:
doskey /history
…history list…
cmd echo /k
doskey /history
…no list !
You don't see
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
But a new CMD-Shell was started.
So "exit" may help in this case!
This happened to me when I'm in a Rez environment on Windows 10.
As per #user1769064 's answer above setting the buffers to 999 and restarting the shell with a new environment the issue went away. There's probably a lower number than 999 with which it works as well, but haven't tried it.
right-click on the top-left corner of the Windows Command Prompt on the C:\ icon.
Choose Properties
In the Options tab, find Command History setting
Change the Buffer size to 999
Close the terminal and relaunch it again

Resources