2

I transfer the original post from StackOverflow (Original post) to here since this is about Apple specificity.

I have a new macbook with Mojave and vim already installed.

Unfortunately, even for small source files, the cursor is very fast when I browse the current part of file where I am located but it becomes very slow when I am over this current page (the same thing occurs if I am over or lower this part) with down/up keys.

I don't talk about "mouse scrolling speed" but scrolling with down/up keys.

I saw and tried to apply different suggested solutions on web but none of these work for me (disable cursorline, using an empty ~/.vimrc , etc ...).

Maybe threre is a conflict with some options in my ~/.vimrc. Here below my ~/.vimrc:

set encoding=utf-8
scriptencoding utf-8
set ic
command Il :%s/^/\=line('.'). ' '
set hlsearch
set shiftwidth=2        " number of spaces to use for auto indent
set autoindent          " copy indent from current line when starting a new line
set nu
syntax on               " syntax highlighting
set backspace=indent,eol,start " delete with backspace 
"TOhtml
let html_use_css=1
let html_number_lines=1
let html_no_pre=0
highlight DiffAdd    cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
highlight DiffDelete cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
highlight DiffChange cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
highlight DiffText   cterm=bold ctermfg=10 ctermbg=88 gui=none guifg=bg guibg=Red

I have changed into System Preferences the delay between 2 repeated keys to a small value :

So, into the default Terminal of Mojave macbook, I can move quickly with left/right keys on the command line.

Is there a relation between this small delay I have set and this slow scroll vertically with donw/up keys into vim ?

Another bug which must be known is that some commented code parts (for example when editing Python code with vim) appears as not commented when scrolling with down/up keys and also the contrary occurs : anyone has already got this strange behavior ? this problem doesn't happen when I browse file with CTRL+F or CTRL+B shortcuts.

Any help is welcome, Regards

UPDATE 1 :

Finally, I get to increase speed with the following link :

https://rehmann.co/blog/better-key-rates-osx/

I decided to switch to iterm2. So, as partial conclusion, the solution was to set fatest options in System Preferences and put into ~/.bashrc :

#disable special characters when holding keys
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false

# normal minimum is 15 (225 ms)
defaults write -g InitialKeyRepeat -float 10.0
defaults write NSGlobalDomain InitialKeyRepeat -float 10.0

# normal minimum is 2 (30 ms)
defaults write NSGlobalDomain KeyRepeat -float 1.0
defaults write -g KeyRepeat -float 1.0
############# Enable spees ######################

It might be even too fast. That's why I wonder if there is a way to apply this big speed only for selected keys, i.e in my case, I would like to have this behavior for only down/up and left/right keys and NOT for the others keys (letters or special characters) ?

Is it possible to get this behavior ?

UPDATE 2 : Ok, I have finally found the trick : in iterm2 terminal, there is a GPU rendering option on below image :

GPU rendering

If you have no power on, GPU rendering was by default disable like, so uncheck the first box to be able to benefit from GPU rendering when computer is on battery :

Uncheck first option to  avoid GPU rendering disabled

That's all !

3
  • This question and bounty were about speeding up the scroll. Are you interested in keeping it up or want to ask about the new issue? If the former, ask a new question about the new issue and post an answer here, with the solution you found. If the latter, I feel it will affect the already posted answer too. Both together make it a very unclear and a bit broad question and a potential misuse of bounty.
    – anki
    Oct 19, 2019 at 21:25
  • @ankii thanks, I got your feedback, I can speed up moving of cursor into terminal (iterm2) and into vim (horizontally and vertically). But now, I would like to select this high speedd only for down/up and left/right arrows keys and for delete key. I would like a lower speed for others keys (I mean for letters characters and special characters) : is it possible to do a selection on keys with different dedicated speeds ? Regards
    – user256573
    Oct 20, 2019 at 15:10
  • Yeah I did see the edit. I am unable to answer about vim, but commented to let you know that the question was very unclear then. There are questions lying here and there like this one "Is there a relation between this small delay I have set and this slow scroll vertically with donw/up keys into vim ?" and "anyone has already got this strange behavior ?" And no matter what the outcome of this bounty is, do post even the partial answer below!
    – anki
    Oct 20, 2019 at 19:51

1 Answer 1

0
+50

How to improve into vim of MacOS Mojave the speed of vertical scroll with bottom/up keys?

You didn't tell which Vim's variant you use, whereas there's no such thing as "standard Vim" in MacOS. In fact lots of things aren't described either, including Terminal's window geometry (the more text is shown at once, the more CPU cycles it'd be needed to scroll it), Terminal's active profile (some of them are slimmer and others have somewhat complex graphics thanks to additional effects — "Silver Aerogel" is one example).

I use homebrew's version of Vim and can tell that its scrolling is quite fast (at least there's no slowness) both in Terminal and in iTerm2.

Hence, a few suggestions that logically follows:

  • Try changing either Vim or terminal (or both).
  • Try using GUI version (gvim) and compare its scrolling performance.

You can give a try to Activity Monitor's CPU monitoring (with shortest update interval possible) to see if it shows any major CPU consuming processes during scrolling in Vim.

3
  • Thanks, you can see my solution with iterm2 terminal. GPU rendering is disable by default if power of computer is disconnected, so one has to uncheck this option and speed up for cursor moving into editor or ìterm2 is obtained. Remains the issue about the selection of speed repeating as a function of "classic letters" and only "arrows keys" but this will be another topic and post. Regards
    – user256573
    Oct 21, 2019 at 1:12
  • ook, so is it Vim from homebrew aka macvim?
    – poige
    Oct 21, 2019 at 5:37
  • I installed for this solution the macport vim and the terminal iTerm2.
    – user256573
    Oct 23, 2019 at 20:37

You must log in to answer this question.