Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

opencode-vim

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opencode-vim - npm Package Compare versions

Comparing version
0.0.7
to
0.0.8
+1
-1
package.json
{
"name": "opencode-vim",
"version": "0.0.7",
"version": "0.0.8",
"exports": {

@@ -5,0 +5,0 @@ "./tui": {

@@ -65,4 +65,6 @@ import type { KeyEvent } from "@opentui/core"

const hostEnd = vimeeKey === "e" ? endMotionOffset(map.hostText, offset, vim.count || 1) : undefined
const result = processKeystroke(vimeeKey, vim, buffer, event.ctrl, false, keybinds)
vim = result.newCtx
if (hostEnd !== undefined && result.actions.every((action) => action.type === "cursor-move") && hostEnd > hostOffset(map, vim.cursor, "previous")) vim = { ...vim, cursor: hostPosition(map, hostEnd) }
applyActions(result.actions as HostAction[], ctx, map)

@@ -282,2 +284,23 @@ syncMode(state, vim.mode)

function endMotionOffset(text: string, offset: number, count: number) {
let index = offset
for (let step = 0; step < count; step++) {
index++
while (index < text.length && isWhitespace(text[index])) index++
const kind = wordKind(text[index])
if (!kind) return Math.max(0, text.length - 1)
while (wordKind(text[index + 1]) === kind) index++
}
return clamp(index, 0, Math.max(0, text.length - 1))
}
function isWhitespace(value: string | undefined) {
return value === " " || value === "\t" || value === "\n"
}
function wordKind(value: string | undefined) {
if (!value || isWhitespace(value)) return undefined
return /\w/.test(value) ? "word" : "punctuation"
}
function createKeybinds(config: VimConfig, log: VimLog): KeybindMap | undefined {

@@ -284,0 +307,0 @@ const map = createKeybindMap()