A swiss army knife plugin that super charges ⚡️ your micro text editor
List of features:
- ⚓️ Project Navigations:
- 🖱️ Cursor Control:
- 📑 Tab Control:
- 📜 Buffers Actions:
- (WIP) Bracket jumping without on top of it
- (WIP) Content selection within brackets
- (WIP) Resize split with keyboard
You can install MicroOmni using micro -plugin install OmniMicro
by either
- Add it to
"pluginrepos"
insettings.json
, like
"pluginrepos": [
"https://raw.githubusercontent.com/Neko-Box-Coder/MicroOmni/master/repo.json"
]
- Or using the unofficial-plugin-channel, like
"pluginchannels": [
"https://raw.githubusercontent.com/Neko-Box-Coder/unofficial-plugin-channel/main/channel.json"
]
- Alternatively, you can
git clone https://github.com/Neko-Box-Coder/MicroOmni
to your microplug
directory
- micro
- fzf
- ripgrep
- bat
- diff (Windows)
All of these are available for Unix and Windows
Windows link to requirements
https://github.com/junegunn/fzf/releases
https://github.com/BurntSushi/ripgrep/releases
Alternatively, you can get all the required executables you need for Windows in Release
Note
On Windows, the directory that has the required executables must be added to the PATH environment variable
Note
The above gif is from older version.
The latest version will show the default keybindings in fzf
Recommended binding:
"Alt-F": "command:OmniGlobalSearch",
//Windows
"Alt-Shift-F": "command:OmniGlobalSearch"
To find a with keyword(s), launch command OmniGlobalSearch
which is bindable to a key.
- Enter the search directories
- Empty for current root directory.
{fileDir}
can be used to substitute with current file directory- Use
,
to separate directories, for example./MyDir,./MyDir2
- Prefix
!
to exclude a directory, for example!./ExcludeThisDir
- Enter keywords (separated by spaces) to be searched (This is using ripgrep and not fuzzy search)
- If successful, a fzf window will be launched. You can now filter with fzf fuzzy search.
- Here are the keybindings by default configured:
- enter: Select
- alt-enter: Output the current filtered results to a new buffer
- up/down: Navigate results
- alt-up / alt-down: Navigate half page of results
- page-up / page-down: Scroll up and down for the preview window
- alt-f: Search again with text in the input field (Non fuzzy but case insensitive)
- alt-q: Abort
MicroOmni.FzfCmd
: Thefzf
location.- Defaults to
"fzf"
- Defaults to
MicroOmni.NewFileMethod
: How to open the new file. Available options are:smart_newtab
: (Default) Opens the new file in newtab if not opened alreadythispane
: Opens in current panenewtab
: Opens in new tabvsplit
: Opens in new pane as vertical splithsplit
: Opens in new pane as horizontal split
MicroOmni.GlobalSearchArgs
: Argument to be passed to fzf. It defaults to the following:
config.RegisterCommonOption('MicroOmni', 'GlobalSearchArgs',
"--header='enter: select | alt-enter: output filtered results | alt-q/esc: exit | "..
"page-[up/down]: preview-[up/down] | alt-[up/down]: half-page-[up/down]' "..
"--bind 'alt-f:reload:rg --glob=!.git/ -i -F -uu -n {q}' "..
"--delimiter : -i --reverse "..
"--bind page-up:preview-half-page-up,page-down:preview-half-page-down,"..
"alt-up:half-page-up,alt-down:half-page-down,alt-q:abort "..
"--bind 'alt-enter:change-multi+select-all+accept' "..
"--preview-window 'down,+{2}-/2' "..
"--preview 'bat -f -n --highlight-line {2} {1}'")
Recommended binding:
"Alt-f": "command:OmniLocalSearch"
Similar to "Fuzzy Search For Text Globally", this do a fuzzy search for the current file.
This is achieved by bat
the file on disk to fzf
, therefore you should save before searching.
The default control is the same as "Fuzzy Search For Text Globally".
To search, simply launch the OmniLocalSearch
command.
MicroOmni.LocalSearchArgs
: Argument to be passed to fzf with{filePath}
substitute with the current file path. It defaults to the following:
config.RegisterCommonOption('MicroOmni', 'LocalSearchArgs',
"--header='enter: select | alt-enter: output filtered results | alt-q/esc: exit | "..
"page-[up/down]: preview-[up/down] | alt-[up/down]: half-page-[up/down]' "..
"--bind 'start:reload:bat -n --decorations always {filePath}' "..
"-i --reverse "..
"--bind page-up:preview-half-page-up,page-down:preview-half-page-down,"..
"alt-up:half-page-up,alt-down:half-page-down,alt-q:abort "..
"--bind 'alt-enter:change-multi+select-all+accept' "..
"--preview-window 'down,+{1}-/2' "..
"--preview 'bat -f -n --highlight-line {1} {filePath}'")
Recommended binding:
"Alt-G": "command:OmniGotoFile",
//Windows
"Alt-Shift-G": "command:OmniGotoFile"
Similar to "Fuzzy Search For Text Globally", this do a fuzzy search for all the files The default control is the same as "Fuzzy Search For Text Globally".
To search, simply launch the OmniGotoFile
command.
MicroOmni.NewFileMethod
: Same as previousMicroOmni.GotoFileArgs
: Argument to be passed to fzf. It defaults to the following:
config.RegisterCommonOption('MicroOmni', 'GotoFileArgs',
"--header='enter: select | alt-enter: output filtered results | alt-q/esc: exit | "..
"page-[up/down]: preview-[up/down] | alt-[up/down]: half-page-[up/down]' "..
"-i --reverse "..
"--bind page-up:preview-half-page-up,page-down:preview-half-page-down,"..
"alt-up:half-page-up,alt-down:half-page-down,alt-q:abort "..
"--bind 'alt-enter:change-multi+select-all+accept' "..
"--preview-window 'down' "..
"--preview 'bat -f -n {}'")
To jump to a word anywhere on the screen, launch the OmniJump
command WITH a keybinding
Recommended binding:
"Alt-j": "command:OmniJump"
When you are editing multiple files or jumping between different functions,
a history of the cursor location is stored. You can go to previous or next cursor position
by launching the OmniPreviousHistory
and OmniNextHistory
commands.
This is similar to the navigate back and forward commands in VSCode
Recommended binding:
"Alt-{": "command:OmniPreviousHistory",
"Alt-}": "command:OmniNextHistory",
//Windows
"Alt-Shift-{": "command:OmniPreviousHistory",
"Alt-Shift-}": "command:OmniNextHistory"
MicroOmni.NewFileMethod
: Same as previousMicroOmni.HistoryLineDiff
: Sets how many line difference count as new cursor history. Defaults to 5MicroOmni.HistoryTimeTravelMulti
: Multiplier toOmniHistoryLineDiff
when in cursor history
It centers your cursor to the middle of your viewport.
"Alt-m": "command:OmniCenter"
A multi cursor selection marker which marks the beginning of a selection when called the first time. And then perform the selection to the current cursors positions when called the second time.
Recommended binding:
"Alt-S": "command-edit:OmniSelectMark",
//Windows
"Alt-Shift-S": "command-edit:OmniSelectMark"
Important
This is deprecated, and will be removed in a few feature releases. Use the more flexible 🚩 Selection Marker instead
Recommended binding:
"Alt-J": "command-edit:OmniJumpSelect ",
//Windows
"Alt-Shift-J": "command-edit:OmniJumpSelect "
To select a section based on line number, launch the OmniJumpSelect
command with
the line number specified.
By default it uses relative line numbers, so 5 is 5 lines down and -5 is 5 lines up. This can be configured to use absolute line number. See settings.
MicroOmni.SelectType
: Sets the jump selection type. Can either berelative
(default) orabsolute
It spawns/moves your cursor to the next highlight match,
or act the same as SpawnMultiCursor
if there's no highlight
Meaning you can use regex expression to spawn multi-cursors.
Recommended binding:
"Alt-d": "command:OmniSpawnCursorNextHighlight"
//OmniMoveLastCursorNextHighlight
Due to how the lua interface works, AddCursor()
(from micro) was not added until recently.
Therefore, a workaround was created to add multi cursor but this doesn't behave exactly like
SpawnMultiCursor
.
The differences are that AddCursor()
will select the highlight text but the workaround will
simply just add the cursor to the end of the highlight.
This can be set with OmniCanUseAddCursor
.
If you are on latest master or using my fork
you can safely turn OmniCanUseAddCursor
on, otherwise just leave it because it can crash micro.
MicroOmni.CanUseAddCursor
: Sets if MicroOmni can use theAddCursor()
interface or not.- Defaults to
false
- Defaults to
Recommended binding:
"Alt-T": "command:OmniTabSearch",
//Windows
"Alt-Shift-T": "command:OmniTabSearch"
Similar to "Fuzzy Search For Text Globally", this do a fuzzy search for all the files The default control is the same as "Fuzzy Search For Text Globally".
To search, simply launch the OmniTabSearch
command.
MicroOmni.NewFileMethod
: Same as previousMicroOmni.TabSearchArgs
: Argument to be passed to fzf. It defaults to the following:
config.RegisterCommonOption('MicroOmni', 'TabSearchArgs',
"--header='enter: select | alt-enter: output filtered results | alt-q/esc: exit | "..
"page-[up/down]: preview-[up/down] | alt-[up/down]: half-page-[up/down]' "..
"--bind 'start:reload:bat {filePath}' "..
"--delimiter : -i --reverse "..
"--bind page-up:preview-half-page-up,page-down:preview-half-page-down,"..
"alt-up:half-page-up,alt-down:half-page-down,alt-q:abort "..
"--bind 'alt-enter:change-multi+select-all+accept' "..
"--preview-window 'down,+{2}-/2' "..
"--preview 'bat -f -n --highlight-line {2} {1}'")
You can create a newtab either on the right or left of the current tab by launching
OmniNewTabRight
or OmniNewTabLeft
command
Recommended binding:
"Alt-t": "command:OmniNewTabRight"
When you have too many tabs, you can scroll via them without switching by launching
OmniTabScrollLeft
or OmniTabScrollLeft
command
Recommended binding:
"Alt-PageUp": "command:OmniTabScrollLeft",
"Alt-PageDown": "command:OmniTabScrollRight"
You can save your current tabs and splits with session management as *.omnisession file Auto saving is also enabled as well.
The following commands are available:
OmniSaveSession <name>
: Saves the current session with the given nameOmniLoadSession <name>
: Loads a previously saved sessionOmniListSessions
: Lists all available sessionsOmniDeleteSession <name>
: Deletes a saved session
Below works the same but on current working directory:
OmniSaveSessionLocal <name>
OmniLoadSessionLocal <name>
OmniListSessionsLocal
OmniDeleteSessionLocal <name>
Recommended binding:
None (Invoke it in command pane)
MicroOmni.AutoSaveEnabled
: Enable session auto save or not. Defaults to trueMicroOmni.AutoSaveToLocal
: Auto save to current working directory instead of plugin temporary directory. Defaults to falseMicroOmni.AutoSaveName
: Name of the auto save, defaults toautosave
MicroOmni.AutoSaveInterval
: Auto save interval in seconds, defaults to 60
To compare the current buffer with another buffer of file, launch the OmniDiff
command.
Buffers are not required to be saved in order to perform the diff.
When being asked on what to diff, you can either specify a filename or a tab
The syntax for diffing a tab is as follow
tab:[+/-]<tab index>[:<split index>]
With +
or -
means it will be relative tab index, or absolute otherwise, similar to tabmove
.
The split index can be used to specify which split to be diff against
Recommended binding:
None (Invoke it in command pane)
To highlight anything without going to it, launch the OmniHighlightOnly
command.
This shows the number of matches which you can go to with the FindNext
and FindPrevious
keybinds.
Recommended binding:
"Alt-h": "command:OmniHighlightOnly"
You can copy the current file absolute or relative path with OmniCopyRelativePath
and
OmniCopyAbsolutePath
command.
Recommended binding:
None (Invoke it in command pane)
"Alt-M": "command:OmniMinimap",
//Windows
"Alt-Shift-M": "command:OmniMinimap"
To see an overview of the current file based on indentation, launch the OmniMinimap
command.
By default it will show neighboring lines as "context" if they have the same indentations
MicroOmni.MinimapMaxIndent
: Max indent limit to be shown in the minimap- Defaults to 5
MicroOmni.MinimapContextNumLines
: Max number of context lines- Defaults to 20
MicroOmni.MinimapMinDistance
: Min skipping distance for the minimap- Defaults to 20
MicroOmni.MinimapMaxColumns
: Max number of columns in minimap, and use "..." if doesn't fit- Defaults to 75
MicroOmni.MinimapTargetNumLines
: Number of lines aiming to have for the minimap- Defaults to 100
MicroOmni.MinimapScrollContent
: Automatically scroll the content buffer when navigating in the minimap- Defaults to true