Vim icon indicating copy to clipboard operation
Vim copied to clipboard

`j` and `k` do not account for tab size

Open WangRongda opened this issue 6 years ago • 8 comments

Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG What happened: Note: The second line start with a tab indent. Default(disabled vim plugin): foo enable vim plugin:(pressing gj can solve, but what about insert and visual mode) foo2 or Insert mode: foo3 Visual mode: bar2

What did you expect to happen: Like vscode default show or native vim. How to reproduce it (as minimally and precisely as possible):

Environment:

  • Extension (VsCodeVim) version:0.11.2
  • VSCode version:1.12.1
  • OS version:4.15.9-1-ARCH

WangRongda avatar Mar 20 '18 08:03 WangRongda

I have the same issue with my vim plugin and it happens in any lines.

RYO0115 avatar Feb 05 '19 00:02 RYO0115

I have the same issue, it sames because of vscode vim thinking tab width is 1. if you set tabwidth=1 or replace tab to space. it will be OK!

gngshn avatar May 14 '19 02:05 gngshn

not sure if it's helpful but here's a similar yet solved issue of vscode-neovim: https://github.com/asvetliakov/vscode-neovim/issues/275

champignoom avatar Feb 16 '21 11:02 champignoom

I confirmed https://github.com/asvetliakov/vscode-neovim works correctly. Can you adopt the same workaround?

falsandtru avatar Apr 22 '21 18:04 falsandtru

Since Golang forces us to use tabs, using Golang is very painful because of this bug.

falsandtru avatar May 06 '21 22:05 falsandtru

Dear. contributers

Hello. I'm not a typescript developer. But, I think...

The getWord function should be modified in textEditor.ts (for every this.whitespaceRegExp.test() used)


+ private static readonly tabRegExp = new RegExp('\\t');
+ let editorTabsize = editor.tabSize;


<before>
    while (this.whitespaceRegExp.test(line[firstNonBlank])) {
	  firstNonBlank++;
    ......


<after>
    while (this.whitespaceRegExp.test(line[firstNonBlank])) {
	  if (this.tabRegExp.test(line[firstNonBlank])){
		firstNonBlank += editorTabsize;
	  }else{
		firstNonBlank++;
	  }
    ......


xiany avatar May 13 '21 10:05 xiany

In position.ts, The value of 'character' is different from the 'Col' value on vscode status bar. So the getLeft() function returns wrong horizontal position.

xiany avatar Jun 01 '21 16:06 xiany

this was fixed in #8756

ontanj avatar Apr 10 '24 12:04 ontanj