diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..0662841 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,22 @@ +# Do not include the following content from *.sublime-package files + +# Git & Github +.github/ export-ignore +.gitattributes export-ignore +.gitignore export-ignore + +# Documentation +doc/ export-ignore +sample/ export-ignore +Contributing.md export-ignore +ToDo.md export-ignore + +# Tests +test/ export-ignore +\[test\]/ export-ignore + +# Settings +.editorconfig export-ignore + +# Source files +src/ export-ignore diff --git a/.gitignore b/.gitignore index e7bfc83..81f41e5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,65 @@ +# templates github.com/github/gitignore # Sublime Text files ace-jump.sublime-project ace-jump.sublime-workspace +# vim +*~ +.*.swp +# (macOS) +.DS_Store +.AppleDouble +.LSOverride +# (macOS)Icon must end with two \r +Icon -# To do +# (macOS)Thumbnails +._* +# (macOS)Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns + +# (macOS)Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# (Windows) Thumbnails +Thumbs.db + +# (Windows) Files build by Visual Studio +*.obj +*.exe +*.pdb +*.user +*.aps +*.pch +*.vspscc +*_i.c +*_p.c +*.ncb +*.suo +*.tlb +*.tlh +*.bak +*.cache +*.ilk +*.log +*.dll +*.lib +*.sbr + +# project's built/temp docs +Changelog.html +ReadMe.html +messages/*.html +ToDo.html +ToDo.md +# test folder +\[test\] *.TODO diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..cc1923a --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.8 diff --git a/AceJump.sublime-settings b/AceJump.sublime-settings index 20b8501..9a24064 100644 --- a/AceJump.sublime-settings +++ b/AceJump.sublime-settings @@ -1,54 +1,55 @@ { - // Characters to be used as labels in order they'll appear - "labels": "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", +// Characters to be used as labels in order they'll appear +"labels" : "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", +"labels_scope" : "invalid" , // Syntax highlighting scope for the labels +"search_case_sensitivity" : true , // Toggles case sensitive search in word and character modes. +"save_files_after_jump" : false , // Saves all the files aceJump tried to parse. This setting will reset any linter warnings you might see during jump. By saving all effected files +"jump_behind_last_characters" : false , // If turned on, character mode will jump after a character it it's the last character on a line. +"popup_mode" : true ,// show near-cursor-popup when mode is enabled (ace_jump_add_cursor, ace_jump_select, ace_jump_after) +"status_mode" : true ,// show status bar indicatro when mode is enabled (ace_jump_add_cursor, ace_jump_select, ace_jump_after) +"status_prefix" : "" ,// status bar indicators are ordered by their name, custom prefix allows changing the location of AceJump's status bar +"icon_cursor" :"⎀" ,// +"icon_select" :"▋" ,// +"icon_after" :"↷" ,// +"popup_flag" :"ksel" ,// space-separated list of popup flags + // Name full short Comment (≝ default) + // NONE no . + // COOPERATE_WITH_AUTO_COMPLETE acompl display next to the auto complete menu + // HIDE_ON_MOUSE_MOVE hmo hide when the mouse is moved, clicked or scrolled + // HIDE_ON_MOUSE_MOVE_AWAY hma hide when the mouse is moved (unless towards the popup), or when clicked or scrolled + // KEEP_ON_SELECTION_MODIFIED ksel ≝don't hide when the selection is modified 4057 + // HIDE_ON_CHARACTER_EVENT hc hide the popup when a character is typed 4057 - // Syntax highlighting scope for the labels - "labels_scope": "invalid", - - // Toggles case sensitive search in word and character modes. - "search_case_sensitivity": true, - - // Saves all the files aceJump tried to parse. - // This setting will reset any linter warnings you might see during jump - // By saving all effected files - "save_files_after_jump": false, - - // If turned on, character mode will jump after a character - // it it's the last character on a line. - "jump_behind_last_characters": false, - - // View settings that should be respected when switching the syntax - // highlighting mode. In case a plugin you use adds a new - // setting to a view, you probably want to add it to this list. - "view_settings": [ - "auto_indent", - "tab_size", - "translate_tabs_to_spaces", - "use_tab_stops", - "trim_automatic_white_space", - "detect_indentation", - "draw_white_space", - "trim_trailing_white_space_on_save", - "always_show_minimap_viewport", - "color_scheme", - "font_face", - "font_options", - "gutter", - "rulers", - "draw_minimap_border", - "highlight_line", - "line_padding_top", - "line_padding_bottom", - "scroll_past_end", - "line_numbers", - "word_wrap", - "wrap_width", - "indent_subsequent_lines", - "draw_centered", - "match_brackets", - "match_brackets_content", - "match_brackets_square", - "match_brackets_braces", - "match_brackets_angle", - ] +// View settings that should be respected when switching the syntax highlighting mode. In case a plugin you use adds a new setting to a view, you probably want to add it to this list. +"view_settings": [ + "auto_indent", + "tab_size", + "translate_tabs_to_spaces", + "use_tab_stops", + "trim_automatic_white_space", + "detect_indentation", + "draw_white_space", + "trim_trailing_white_space_on_save", + "always_show_minimap_viewport", + "color_scheme", + "font_face", + "font_options", + "gutter", + "rulers", + "draw_minimap_border", + "highlight_line", + "line_padding_top", + "line_padding_bottom", + "scroll_past_end", + "line_numbers", + "word_wrap", + "wrap_width", + "indent_subsequent_lines", + "draw_centered", + "match_brackets", + "match_brackets_content", + "match_brackets_square", + "match_brackets_braces", + "match_brackets_angle", +] } diff --git a/Default (Linux).sublime-keymap b/Default (Linux).sublime-keymap index 364e301..f3ad09e 100644 --- a/Default (Linux).sublime-keymap +++ b/Default (Linux).sublime-keymap @@ -1,30 +1,39 @@ [ - { - "keys": ["ctrl+shift+;"], - "command": "ace_jump_word" - }, - { - "keys": ["ctrl+shift+'"], - "command": "ace_jump_char" - }, - { - "keys": ["ctrl+shift+."], - "command": "ace_jump_line" - }, - { - "keys": ["ctrl+shift+,"], - "command": "ace_jump_within_line" - }, - { - "keys": ["alt+;"], - "command": "ace_jump_select" - }, - { - "keys": ["alt+'"], - "command": "ace_jump_add_cursor" - }, - { - "keys": ["alt+."], - "command": "ace_jump_after" - } +// Old defaults // + {"keys":["ctrl+shift+;" ],"command":"ace_jump_word" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + {"keys":["ctrl+shift+'" ],"command":"ace_jump_char" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + {"keys":["ctrl+shift+." ],"command":"ace_jump_line" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + {"keys":["ctrl+shift+," ],"command":"ace_jump_within_line" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + {"keys":["alt+'" ],"command":"ace_jump_add_cursor" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + {"keys":["alt+;" ],"command":"ace_jump_select" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + {"keys":["alt+." ],"command":"ace_jump_after" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + +// Chained Keycap // keycap-based mnemonics w=word + {"keys":["ctrl+j","ctrl+w" ],"command":"ace_jump_word" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+c" ],"command":"ace_jump_char" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+l" ],"command":"ace_jump_line" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+i" ],"command":"ace_jump_within_line" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, +// Chained Modes // + {"keys":["ctrl+j","c" ],"command":"ace_jump_add_cursor" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","s" ],"command":"ace_jump_select" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","a" ],"command":"ace_jump_after" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, + +// Chained Home (more convenient home row mode keys) + {"keys":["ctrl+j","ctrl+k" ] , "command":"ace_jump_word" ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+l" ] , "command":"ace_jump_char" ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+;" ] , "command":"ace_jump_line" ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+j" ] , "command":"ace_jump_within_line" ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, +// Chained Home Modes+: full chain, no need to press prefix key twice // + {"keys":["ctrl+j","ctrl+a","ctrl+k" ],"command":"chain","args":{"commands":[{"command":"ace_jump_add_cursor" },{"command":"ace_jump_word" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+a","ctrl+l" ],"command":"chain","args":{"commands":[{"command":"ace_jump_add_cursor" },{"command":"ace_jump_char" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+a","ctrl+;" ],"command":"chain","args":{"commands":[{"command":"ace_jump_add_cursor" },{"command":"ace_jump_line" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+a","ctrl+j" ],"command":"chain","args":{"commands":[{"command":"ace_jump_add_cursor" },{"command":"ace_jump_within_line" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+s","ctrl+k" ],"command":"chain","args":{"commands":[{"command":"ace_jump_select" },{"command":"ace_jump_word" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+s","ctrl+l" ],"command":"chain","args":{"commands":[{"command":"ace_jump_select" },{"command":"ace_jump_char" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+s","ctrl+;" ],"command":"chain","args":{"commands":[{"command":"ace_jump_select" },{"command":"ace_jump_line" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+s","ctrl+j" ],"command":"chain","args":{"commands":[{"command":"ace_jump_select" },{"command":"ace_jump_within_line" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+f","ctrl+k" ],"command":"chain","args":{"commands":[{"command":"ace_jump_after" },{"command":"ace_jump_word" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+f","ctrl+l" ],"command":"chain","args":{"commands":[{"command":"ace_jump_after" },{"command":"ace_jump_char" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+f","ctrl+;" ],"command":"chain","args":{"commands":[{"command":"ace_jump_after" },{"command":"ace_jump_line" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+f","ctrl+j" ],"command":"chain","args":{"commands":[{"command":"ace_jump_after" },{"command":"ace_jump_within_line" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, ] diff --git a/Default (OSX).sublime-keymap b/Default (OSX).sublime-keymap index 428d8d7..f2252c7 100644 --- a/Default (OSX).sublime-keymap +++ b/Default (OSX).sublime-keymap @@ -1,30 +1,39 @@ [ - { - "keys": ["super+shift+;"], - "command": "ace_jump_word" - }, - { - "keys": ["super+shift+'"], - "command": "ace_jump_char" - }, - { - "keys": ["super+shift+."], - "command": "ace_jump_line" - }, - { - "keys": ["super+shift+,"], - "command": "ace_jump_within_line" - }, - { - "keys": ["ctrl+;"], - "command": "ace_jump_select" - }, - { - "keys": ["ctrl+'"], - "command": "ace_jump_add_cursor" - }, - { - "keys": ["ctrl+."], - "command": "ace_jump_after" - } +// Old defaults // + {"keys":["super+shift+;" ],"command":"ace_jump_word" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + {"keys":["super+shift+'" ],"command":"ace_jump_char" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + {"keys":["super+shift+." ],"command":"ace_jump_line" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + {"keys":["super+shift+," ],"command":"ace_jump_within_line" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + {"keys":["ctrl+'" ],"command":"ace_jump_add_cursor" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + {"keys":["ctrl+;" ],"command":"ace_jump_select" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + {"keys":["ctrl+." ],"command":"ace_jump_after" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + +// Chained Keycap // keycap-based mnemonics w=word + {"keys":["super+j","super+w" ],"command":"ace_jump_word" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, + {"keys":["super+j","super+c" ],"command":"ace_jump_char" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, + {"keys":["super+j","super+l" ],"command":"ace_jump_line" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, + {"keys":["super+j","super+i" ],"command":"ace_jump_within_line" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, +// Chained Modes // + {"keys":["super+j","c" ],"command":"ace_jump_add_cursor" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, + {"keys":["super+j","s" ],"command":"ace_jump_select" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, + {"keys":["super+j","a" ],"command":"ace_jump_after" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, + +// Chained Home (more convenient home row mode keys) + {"keys":["super+j","super+k" ] , "command":"ace_jump_word" ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["super+j","super+l" ] , "command":"ace_jump_char" ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["super+j","super+;" ] , "command":"ace_jump_line" ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["super+j","super+j" ] , "command":"ace_jump_within_line" ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, +// Chained Home Modes+: full chain, no need to press prefix key twice // + {"keys":["super+j","super+a","super+k" ],"command":"chain","args":{"commands":[{"command":"ace_jump_add_cursor" },{"command":"ace_jump_word" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["super+j","super+a","super+l" ],"command":"chain","args":{"commands":[{"command":"ace_jump_add_cursor" },{"command":"ace_jump_char" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["super+j","super+a","super+;" ],"command":"chain","args":{"commands":[{"command":"ace_jump_add_cursor" },{"command":"ace_jump_line" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["super+j","super+a","super+j" ],"command":"chain","args":{"commands":[{"command":"ace_jump_add_cursor" },{"command":"ace_jump_within_line" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["super+j","super+s","super+k" ],"command":"chain","args":{"commands":[{"command":"ace_jump_select" },{"command":"ace_jump_word" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["super+j","super+s","super+l" ],"command":"chain","args":{"commands":[{"command":"ace_jump_select" },{"command":"ace_jump_char" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["super+j","super+s","super+;" ],"command":"chain","args":{"commands":[{"command":"ace_jump_select" },{"command":"ace_jump_line" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["super+j","super+s","super+j" ],"command":"chain","args":{"commands":[{"command":"ace_jump_select" },{"command":"ace_jump_within_line" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["super+j","super+f","super+k" ],"command":"chain","args":{"commands":[{"command":"ace_jump_after" },{"command":"ace_jump_word" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["super+j","super+f","super+l" ],"command":"chain","args":{"commands":[{"command":"ace_jump_after" },{"command":"ace_jump_char" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["super+j","super+f","super+;" ],"command":"chain","args":{"commands":[{"command":"ace_jump_after" },{"command":"ace_jump_line" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["super+j","super+f","super+j" ],"command":"chain","args":{"commands":[{"command":"ace_jump_after" },{"command":"ace_jump_within_line" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, ] diff --git a/Default (Windows).sublime-keymap b/Default (Windows).sublime-keymap index 364e301..f3ad09e 100644 --- a/Default (Windows).sublime-keymap +++ b/Default (Windows).sublime-keymap @@ -1,30 +1,39 @@ [ - { - "keys": ["ctrl+shift+;"], - "command": "ace_jump_word" - }, - { - "keys": ["ctrl+shift+'"], - "command": "ace_jump_char" - }, - { - "keys": ["ctrl+shift+."], - "command": "ace_jump_line" - }, - { - "keys": ["ctrl+shift+,"], - "command": "ace_jump_within_line" - }, - { - "keys": ["alt+;"], - "command": "ace_jump_select" - }, - { - "keys": ["alt+'"], - "command": "ace_jump_add_cursor" - }, - { - "keys": ["alt+."], - "command": "ace_jump_after" - } +// Old defaults // + {"keys":["ctrl+shift+;" ],"command":"ace_jump_word" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + {"keys":["ctrl+shift+'" ],"command":"ace_jump_char" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + {"keys":["ctrl+shift+." ],"command":"ace_jump_line" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + {"keys":["ctrl+shift+," ],"command":"ace_jump_within_line" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + {"keys":["alt+'" ],"command":"ace_jump_add_cursor" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + {"keys":["alt+;" ],"command":"ace_jump_select" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + {"keys":["alt+." ],"command":"ace_jump_after" ,"context":[{"key":"setting.ace_jump_key_single","operator":"equal","operand":true},]}, + +// Chained Keycap // keycap-based mnemonics w=word + {"keys":["ctrl+j","ctrl+w" ],"command":"ace_jump_word" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+c" ],"command":"ace_jump_char" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+l" ],"command":"ace_jump_line" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+i" ],"command":"ace_jump_within_line" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, +// Chained Modes // + {"keys":["ctrl+j","c" ],"command":"ace_jump_add_cursor" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","s" ],"command":"ace_jump_select" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","a" ],"command":"ace_jump_after" ,"context":[{"key":"setting.ace_jump_key_chain","operator":"equal","operand":true},]}, + +// Chained Home (more convenient home row mode keys) + {"keys":["ctrl+j","ctrl+k" ] , "command":"ace_jump_word" ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+l" ] , "command":"ace_jump_char" ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+;" ] , "command":"ace_jump_line" ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+j" ] , "command":"ace_jump_within_line" ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, +// Chained Home Modes+: full chain, no need to press prefix key twice // + {"keys":["ctrl+j","ctrl+a","ctrl+k" ],"command":"chain","args":{"commands":[{"command":"ace_jump_add_cursor" },{"command":"ace_jump_word" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+a","ctrl+l" ],"command":"chain","args":{"commands":[{"command":"ace_jump_add_cursor" },{"command":"ace_jump_char" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+a","ctrl+;" ],"command":"chain","args":{"commands":[{"command":"ace_jump_add_cursor" },{"command":"ace_jump_line" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+a","ctrl+j" ],"command":"chain","args":{"commands":[{"command":"ace_jump_add_cursor" },{"command":"ace_jump_within_line" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+s","ctrl+k" ],"command":"chain","args":{"commands":[{"command":"ace_jump_select" },{"command":"ace_jump_word" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+s","ctrl+l" ],"command":"chain","args":{"commands":[{"command":"ace_jump_select" },{"command":"ace_jump_char" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+s","ctrl+;" ],"command":"chain","args":{"commands":[{"command":"ace_jump_select" },{"command":"ace_jump_line" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+s","ctrl+j" ],"command":"chain","args":{"commands":[{"command":"ace_jump_select" },{"command":"ace_jump_within_line" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+f","ctrl+k" ],"command":"chain","args":{"commands":[{"command":"ace_jump_after" },{"command":"ace_jump_word" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+f","ctrl+l" ],"command":"chain","args":{"commands":[{"command":"ace_jump_after" },{"command":"ace_jump_char" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+f","ctrl+;" ],"command":"chain","args":{"commands":[{"command":"ace_jump_after" },{"command":"ace_jump_line" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, + {"keys":["ctrl+j","ctrl+f","ctrl+j" ],"command":"chain","args":{"commands":[{"command":"ace_jump_after" },{"command":"ace_jump_within_line" }]} ,"context":[{"key":"setting.ace_jump_key_chome","operator":"equal","operand":true},]}, ] diff --git a/Default.sublime-commands b/Default.sublime-commands new file mode 100644 index 0000000..d789487 --- /dev/null +++ b/Default.sublime-commands @@ -0,0 +1,14 @@ +[ +{"caption":"Preferences: AceJump Settings" ,"command":"edit_settings" ,"args":{ + "base_file":"${packages}/AceJump/AceJump.sublime-settings", + "user_file":"${packages}/User/AceJump.sublime-settings", + "default" :"{\n\t$0\n}\n"}}, +{"caption":"Preferences: AceJump Settings: User" ,"command":"open_file" ,"args":{"file":"${packages}/User/AceJump.sublime-settings"}}, +{"caption":"Preferences: AceJump Settings: Default" ,"command":"open_file" ,"args":{"file":"${packages}/AceJump/AceJump.sublime-settings"}}, +{"caption":"Preferences: AceJump Keybinds: Default" ,"command":"open_file" ,"args":{"file":"${packages}/AceJump/Default (${platform}).sublime-keymap"}}, +{"caption":"Preferences: AceJump Keybinds: User" ,"command":"open_file" ,"args":{"file":"${packages}/User/Default (${platform}).sublime-keymap"}}, +{"caption":"Preferences: AceJump Keybinds" ,"command":"edit_settings" ,"args":{ + "base_file":"${packages}/AceJump/Default (${platform}).sublime-keymap", + "user_file":"${packages}/User/Default (${platform}).sublime-keymap", + "default" :"{\n\t$0\n}\n"}}, +] diff --git a/README.md b/README.md index f431ff5..9fa1748 100644 --- a/README.md +++ b/README.md @@ -105,12 +105,37 @@ In case there are more places to jump to than labels available, labels will be b ## Customization -In order to access AceJump settings, go to ```Preferences > Package Settings > AceJump > Settings - User```. +In order to access AceJump settings, go to ```Preferences > Package Settings > AceJump > Settings - User``` or open command palette commands: + + - `Preferences: AceJump Settings` to open default and user settings side-by-side + - `Preferences: AceJump Settings: Default` + - `Preferences: AceJump Settings: User` + - `Preferences: AceJump Keybinds: Default` to open default and user (common `Default (OSX).sublime-keymap` file, not AceJump-specific) keybinds side-by-side + - `Preferences: AceJump Keybinds: User` + - `Preferences: AceJump Keybinds` ### Key bindings -Go to ```Preferences > Package Settings > AceJump > Key Bindings - User```. -You can then override the bindings for any of the following commands: +Default keybindings are disabled to avoid conflicts with your other keybinds, you can enable them by adding __either__ of the following settings to your `Preferences.sublime-settings` file via `Preferences: Settings` command palette command (NOT `AceJump.sublime-settings`): + + - `"ace_jump_key_single":true,` every command mapped to a single key combo + - `"ace_jump_key_chain" :true,` j as a prefix key ( on a Mac) with letter-based "mnemonics" like `W`ord + - `"ace_jump_key_chome" :true,` j as a prefix key ( on a Mac) with more convenient home-row based locations + +| Command | Single | Chain | CHome | +|------------------------ |-------------------------------------- |-------------------------------------------------- |----------------------------------------------------------------------------------------------------------------------------- | +| `ace_jump_word` | ; | j, w | j, k | +| `ace_jump_char` | ' | j, c | j, l | +| `ace_jump_line` | . | j, l | j, ; | +| `ace_jump_within_line` | , | j, i | j, j | +| ↓ Modes | | | | +| `ace_jump_add_cursor` | ' | j, c | j, a, k[^1] or l or ; or j | +| `ace_jump_select` | ; | j, s | j, s, k[^1] or l or ; or j | +| `ace_jump_after` | . | j, a | j, f, k[^1] or l or ; or j | + +[^1]: instead of enabling a mode completes the sequence in one keybind + +Or you can then override the bindings for any of the following commands via ```Preferences > Package Settings > AceJump > Key Bindings - User```: - ```ace_jump_word``` - ```ace_jump_char``` @@ -126,9 +151,13 @@ The commands accept an optional Boolean `current_buffer_only` argument. When pre You can override the ```labels``` setting to provide your own set of labels to be used by AceJump. +### Indicators + +When invoking 3 mode commands (`ace_jump_select`, `ace_jump_add_cursor`, and `ace_jump_after`) you can have visual indicators that a mode is on via a popup menu (e.g., when selection is on you'd see a ▋ symbol ![popup](./img/popup.png)) or in the statubar by setting `popup_mode` and `status_mode` settings. There are also additional settings for more control of these indicators, see `Preferences: AceJump Settings: Default` + ### Highlighting -You can also set the syntsx scope that's used for highlighting by overriding ```labels_scope```. The default scope is ```invalid```. +You can also set the syntax scope that's used for highlighting by overriding ```labels_scope```. The default scope is ```invalid```. ### Case sensitivity diff --git a/ace_jump.py b/ace_jump.py index 82b039c..50bc791 100644 --- a/ace_jump.py +++ b/ace_jump.py @@ -1,5 +1,6 @@ import sublime, sublime_plugin import re, itertools +from AceJump.helper.popup import show_popup_mode last_index = 0 hints = [] @@ -109,6 +110,10 @@ def run(self, current_buffer_only = False): self.view_settings ) + self.status_mode = settings.get('status_mode' , False) + self.status_name =(settings.get('status_prefix', '' ) + 'AceJump') if self.status_mode else '' + self.popup_mode = settings.get('popup_mode' , False) + self.show_prompt(self.prompt(), self.init_value()) def is_enabled(self): @@ -259,6 +264,13 @@ def get_region_type(self): return "visible_region" + def reset_indicator(self, view, mode): # reset popup/status + if view and mode: + if self.popup_mode: + show_popup_mode(view, "") + if self.status_mode: + view.set_status(self.status_name, "") + class AceJumpWordCommand(AceJumpCommand): """Specialized command for word-mode""" @@ -274,6 +286,7 @@ def regex(self): def after_jump(self, view): global mode + self.reset_indicator(view,mode) if mode == 3: view.run_command("move", {"by": "word_ends", "forward": True}) mode = 0 @@ -293,6 +306,7 @@ def regex(self): def after_jump(self, view): global mode + self.reset_indicator(view,mode) if mode == 3: view.run_command("move", {"by": "characters", "forward": True}) mode = 0 @@ -321,6 +335,7 @@ def regex(self): def after_jump(self, view): global mode + self.reset_indicator(view,mode) if mode == 3: view.run_command("move", {"by": "lines", "forward": True}) view.run_command("move", {"by": "characters", "forward": False}) @@ -341,6 +356,7 @@ def regex(self): def after_jump(self, view): global mode + self.reset_indicator(view,mode) if mode == 3: view.run_command("move", {"by": "word_ends", "forward": True}) mode = 0 @@ -354,24 +370,78 @@ class AceJumpSelectCommand(sublime_plugin.WindowCommand): def run(self): global mode + win = self.window + view = win.active_view() #‽optional mode = 0 if mode == 1 else 1 + cfg = sublime.load_settings("AceJump.sublime-settings") + status_mode = cfg.get('status_mode', False) + icon = cfg.get("icon_select",'▋') #❙❚ + status_name =(cfg.get('status_prefix', '') + 'AceJump') if status_mode else '' + popup_mode = cfg.get('popup_mode' , False) + if view: + if mode: # show popup/status + if popup_mode: + show_popup_mode(view, icon) + if status_mode: + view.set_status(status_name, icon) + else: # reset + if popup_mode: + show_popup_mode(view, "") + if status_mode: + view.set_status(status_name, "") class AceJumpAddCursorCommand(sublime_plugin.WindowCommand): """Command for turning on multiple cursor mode""" def run(self): global mode + win = self.window + view = win.active_view() #‽optional mode = 0 if mode == 2 else 2 + cfg = sublime.load_settings("AceJump.sublime-settings") + status_mode = cfg.get('status_mode', False) + icon = cfg.get("icon_cursor",'⎀') #|❘❙❚ + status_name =(cfg.get('status_prefix', '') + 'AceJump') if status_mode else '' + popup_mode = cfg.get('popup_mode' , False) + if view: + if mode: # show popup/status + if popup_mode: + show_popup_mode(view, icon) + if status_mode: + view.set_status(status_name, icon) + else: # reset + if popup_mode: + show_popup_mode(view, "") + if status_mode: + view.set_status(status_name, "") class AceJumpAfterCommand(sublime_plugin.WindowCommand): """Modifier-command which lets you jump behind a character, word or line""" def run(self): global mode + win = self.window + view = win.active_view() #‽optional mode = 0 if mode == 3 else 3 + cfg = sublime.load_settings("AceJump.sublime-settings") + status_mode = cfg.get('status_mode', False) + icon = cfg.get("icon_after",'↷') #↶ + status_name =(cfg.get('status_prefix', '') + 'AceJump') if status_mode else '' + popup_mode = cfg.get('popup_mode' , False) + if view: + if mode: # show popup/status + if popup_mode: + show_popup_mode(view, icon) + if status_mode: + view.set_status(status_name, icon) + else: # reset + if popup_mode: + show_popup_mode(view, "") + if status_mode: + view.set_status(status_name, "") class AddAceJumpLabelsCommand(sublime_plugin.TextCommand): """Command for adding labels to the views""" diff --git a/helper/popup.py b/helper/popup.py new file mode 100644 index 0000000..03fc087 --- /dev/null +++ b/helper/popup.py @@ -0,0 +1,53 @@ +import re +import sublime, sublime_plugin + +re_sp = re.compile(r'\s+') +DEF = dict( + enable = True + ,prefix = '' + ,template = '''{prefix}{count}''' + ,maxwidth = 80 + ,maxheight = 30 +) +import copy +CFG = copy.deepcopy(DEF) # copy defaults to be able to reset values on config reload + +from sublime import active_window, PopupFlags +def get_popup_html(sym) -> str: + return CFG['template'].format_map(dict(prefix=CFG['prefix'],count=sym)) +def show_popup_mode(view:sublime.View, sym:str, point:int=-1) -> None: + cfg = sublime.load_settings("AceJump.sublime-settings") + if not cfg.get("popup_mode",False): + return + cfg_flag = re.split(re_sp,cfg.get("popup_flag","").lower()) + flags = PopupFlags.KEEP_ON_SELECTION_MODIFIED + # todo: move ↓ to a loading function instead of parsing each time + for key in [ "NONE" ,"no" ]: # + if key in cfg_flag: # + flags |= PopupFlags.NONE # + for key in [ "COOPERATE_WITH_AUTO_COMPLETE","acompl" ]: # Causes the popup to display next to the auto complete menu + if key in cfg_flag: # + flags |= PopupFlags.COOPERATE_WITH_AUTO_COMPLETE # + for key in [ "HIDE_ON_MOUSE_MOVE" ,"hmo" ]: # Causes the popup to hide when the mouse is moved, clicked or scrolled + if key in cfg_flag: # + flags |= PopupFlags.HIDE_ON_MOUSE_MOVE # + for key in [ "HIDE_ON_MOUSE_MOVE_AWAY" ,"hma" ]: # Causes the popup to hide when the mouse is moved (unless towards the popup), or when clicked or scrolled + if key in cfg_flag: # + flags |= PopupFlags.HIDE_ON_MOUSE_MOVE_AWAY # + for key in [ "KEEP_ON_SELECTION_MODIFIED" ,"ksel" ]: # Prevent the popup from hiding when the selection is modified 4057 + if key in cfg_flag: # + flags |= PopupFlags.KEEP_ON_SELECTION_MODIFIED # + for key in [ "HIDE_ON_CHARACTER_EVENT" ,"hc" ]: # Hide the popup when a character is typed 4057 + if key in cfg_flag: # + flags |= PopupFlags.HIDE_ON_CHARACTER_EVENT # + + if sym: + view.show_popup( + content = get_popup_html(sym) # str + ,flags = flags # + ,location = point # Point -1 + ,max_width = CFG['maxwidth'] # DIP + ,max_height = CFG['maxheight'] # DIP + ) + else: + view.hide_popup() diff --git a/img/popup.png b/img/popup.png new file mode 100644 index 0000000..9272477 Binary files /dev/null and b/img/popup.png differ