Skip to content

Commit 07267ba

Browse files
committed
getcurpos()
1 parent 3a21025 commit 07267ba

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/vimscript/expression/evaluate.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import { Pattern, SearchDirection } from '../pattern';
3434
import { escapeRegExp, isInteger } from 'lodash';
3535
import { VimState } from '../../state/vimState';
3636
import { Position } from 'vscode';
37-
import { isVisualMode } from '../../mode/mode';
3837

3938
// ID of next lambda; incremented each time one is created
4039
let lambdaNumber = 1;
@@ -1065,7 +1064,11 @@ export class EvaluationContext {
10651064
return _default ?? int(0);
10661065
// TODO: get({func}, {what})
10671066
}
1068-
// TODO: getcurpos()
1067+
case 'getcurpos': {
1068+
const { bufnum, lnum, col, off } = getpos('.');
1069+
const curswant = this.vimState!.desiredColumn + 1;
1070+
return list([int(bufnum), int(lnum), int(col), int(off), int(curswant)]);
1071+
}
10691072
// TODO: getline()
10701073
case 'getpos': {
10711074
const [s] = getArgs(1);

0 commit comments

Comments
 (0)