mirror of
https://github.com/esm7/obsidian-vimrc-support.git
synced 2026-07-22 05:00:25 +00:00
refactor: rename fns
This commit is contained in:
parent
585c68c0ea
commit
3d457c2f8c
2 changed files with 12 additions and 13 deletions
21
main.ts
21
main.ts
|
|
@ -5,7 +5,7 @@ import { followLinkUnderCursor } from './actions/followLinkUnderCursor';
|
|||
import { moveDownSkippingFolds, moveUpSkippingFolds } from './actions/moveSkippingFolds';
|
||||
import { jumpToNextHeading, jumpToPreviousHeading } from './motions/jumpToHeading';
|
||||
import { jumpToNextLink, jumpToPreviousLink } from './motions/jumpToLink';
|
||||
import { defineObsidianVimAction, defineObsidianVimMotion } from './utils/obsidianVimCommand';
|
||||
import { defineAndMapObsidianVimAction, defineAndMapObsidianVimMotion } from './utils/obsidianVimCommand';
|
||||
import { VimApi } from './utils/vimApi';
|
||||
|
||||
declare const CodeMirror: any;
|
||||
|
|
@ -268,7 +268,7 @@ export default class VimrcPlugin extends Plugin {
|
|||
var cmEditor = this.getCodeMirror(view);
|
||||
if (cmEditor && !this.codeMirrorVimObject.loadedVimrc) {
|
||||
this.defineBasicCommands(this.codeMirrorVimObject);
|
||||
this.defineObsidianVimCommands(this.codeMirrorVimObject);
|
||||
this.defineAndMapObsidianVimCommands(this.codeMirrorVimObject);
|
||||
this.defineSendKeys(this.codeMirrorVimObject);
|
||||
this.defineObCommand(this.codeMirrorVimObject);
|
||||
this.defineSurround(this.codeMirrorVimObject);
|
||||
|
|
@ -379,16 +379,15 @@ export default class VimrcPlugin extends Plugin {
|
|||
});
|
||||
}
|
||||
|
||||
defineAndMapObsidianVimCommands(vimObject: VimApi) {
|
||||
defineAndMapObsidianVimMotion(vimObject, jumpToNextHeading, 'gh');
|
||||
defineAndMapObsidianVimMotion(vimObject, jumpToPreviousHeading, 'gH');
|
||||
defineAndMapObsidianVimMotion(vimObject, jumpToNextLink, 'gl');
|
||||
defineAndMapObsidianVimMotion(vimObject, jumpToPreviousLink, 'gL');
|
||||
|
||||
defineObsidianVimCommands(vimObject: VimApi) {
|
||||
defineObsidianVimMotion(vimObject, jumpToNextHeading, 'gh');
|
||||
defineObsidianVimMotion(vimObject, jumpToPreviousHeading, 'gH');
|
||||
defineObsidianVimMotion(vimObject, jumpToNextLink, 'gl');
|
||||
defineObsidianVimMotion(vimObject, jumpToPreviousLink, 'gL');
|
||||
|
||||
defineObsidianVimAction(vimObject, this, moveDownSkippingFolds, 'zj');
|
||||
defineObsidianVimAction(vimObject, this, moveUpSkippingFolds, 'zk');
|
||||
defineObsidianVimAction(vimObject, this, followLinkUnderCursor, 'gf');
|
||||
defineAndMapObsidianVimAction(vimObject, this, moveDownSkippingFolds, 'zj');
|
||||
defineAndMapObsidianVimAction(vimObject, this, moveUpSkippingFolds, 'zk');
|
||||
defineAndMapObsidianVimAction(vimObject, this, followLinkUnderCursor, 'gf');
|
||||
}
|
||||
|
||||
defineSendKeys(vimObject: any) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export type ObsidianActionFn = (
|
|||
vimState: any
|
||||
) => void;
|
||||
|
||||
export function defineObsidianVimMotion(
|
||||
export function defineAndMapObsidianVimMotion(
|
||||
vimObject: VimApi,
|
||||
motionFn: MotionFn,
|
||||
mapping: string
|
||||
|
|
@ -23,7 +23,7 @@ export function defineObsidianVimMotion(
|
|||
vimObject.mapCommand(mapping, "motion", motionFn.name, undefined, {});
|
||||
}
|
||||
|
||||
export function defineObsidianVimAction(
|
||||
export function defineAndMapObsidianVimAction(
|
||||
vimObject: VimApi,
|
||||
vimrcPlugin: VimrcPlugin,
|
||||
obsidianActionFn: ObsidianActionFn,
|
||||
|
|
|
|||
Loading…
Reference in a new issue