Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent VSCode from unfolding code when cursor moves past folded section

Tags:

Is it possible to prevent VSCode from unfolding a folded code section if I move past it with my cursor using the arrow keys?

A common workflow I have coming from Atom is to fold parts of my code, then move my cursor down below the folded sections to get to later sections of a file. If I do this in VSCode, the folded section will unfold as soon as my cursor crosses the top of the section. I want it to move past it instead.

Here's an example:

enter image description here

I searched my prefs and Google for a setting, but couldn't find one.

like image 927
Sam Selikoff Avatar asked Nov 03 '19 01:11

Sam Selikoff


People also ask

What is the code for beautify code in Visual Studio?

The code formatting is available in Visual Studio Code through the following shortcuts: On Windows Shift + Alt + F. On Mac Shift + Option + F. On Linux Ctrl + Shift + I.


1 Answers

My Google-fu failed me when I first opened this but there's plenty of discussion around it, and a fix.

  • Issue
  • Temp fix issue

The FAQ for the VSCodeVim extension also says this:

  • Moving j/k over folds opens up the folds

Try setting vim.foldfix to true. This is a hack; it works fine, but there are side effects (see issue#22276).

The fix is working great for me!! Very happy to have solved this.

like image 179
Sam Selikoff Avatar answered Nov 25 '22 17:11

Sam Selikoff