Link Menu Search Expand Document

Vim/NeoVim

Table of contents

  1. Debuging slowness
    1. Check if it is syntax highlighting
    2. Profile function calls
  2. General Commands
    1. Copy all lines in a buffer
  3. Arduino plugin

Debuging slowness

If vim is slow when using, there are a few tricks to try to figure out why.

Check if it is syntax highlighting

First activate time measurement for syntax highlighting:

:syntime on

Navigate a little bit in the file and then:

:syntime report

Check which one of the highlights is taking too long.

Profile function calls

If syntax is not the problem, it could be one of the plugins functions or files being loaded that are making things slow. For that, we need to profile those calls.

:profile start /tmp/vimprofile.log
:profile func *
:profile file *

Navigate around the file a little bit in a way that reproduce the slow down being observed and then:

:profile pause

Examine the /tmp/vimprofile.log file now looking for functions that are taking too long to execute or that are being executed too many times.

General Commands

Copy all lines in a buffer

:%y+
  • % - Execute next command for all lines in buffer
  • y - Yank (copy)
  • + - To the + buffer

Arduino plugin

Arduino plugin works only on .ino files.

Make sure to set the port where the Arduino is in the system, using :ArduinoChoosePort

Configure the path to the Arduino installation in the .vimrc file by setting the g:arduino_dir global variable.

** Compile and verify **

:ArduinoVerify

Compile and upload

<leader>au

Select board

<leader>ab

Gilgalab Knowledge Base