Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add s command #20

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

MajorZiploc
Copy link

The s command from vim to delete character under cursor and then go into insert mode.

Is this something you would be interested in?

Wasn't sure of the correct way to implement this given your structure. Is this a decent approach?

@@ -94,6 +94,7 @@ var the_key_map : Array[Dictionary] = [
{ "keys": ["C"], "type": OPERATOR, "operator": "change" },
{ "keys": ["Shift+C"], "type": OPERATOR_MOTION, "operator": "change", "motion": "move_to_end_of_line", "motion_args": { "inclusive": true } },
{ "keys": ["X"], "type": OPERATOR_MOTION, "operator": "delete", "motion": "move_by_characters", "motion_args": { "forward": true, "one_line": true }, "context": Context.NORMAL },
{ "keys": ["S"], "type": OPERATOR_MOTION, "operator": "delete_and_enter_insert_mode", "motion": "move_by_characters", "motion_args": { "forward": true, "one_line": true }, "action_args": { "insert_at": "inplace" }, "context": Context.NORMAL },

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a one-line, you can remove the delete_and_enter_insert_mode function:

Suggested change
{ "keys": ["S"], "type": OPERATOR_MOTION, "operator": "delete_and_enter_insert_mode", "motion": "move_by_characters", "motion_args": { "forward": true, "one_line": true }, "action_args": { "insert_at": "inplace" }, "context": Context.NORMAL },
{ "keys": ["S"], "type": OPERATOR_MOTION, "operator": "change", "motion": "move_by_characters", "motion_args": { "forward": true }, "context": Context.NORMAL },

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh cool! addressed. Tested and it looks good

hyouuu added a commit to hyouuu/godot-vim that referenced this pull request Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants