Sidebar Keyboard Navigation

by denvolok
5
4
3
2
1
Score: 35/100

Description

The Obsidian Sidebar Keyboard Navigation plugin brings keyboard driven control to the file explorer and search panes, mainly for people who prefer Vim style movement outside the editor. It lets you move through files and folders, open items in tabs or splits, preview files, rename or clone nodes, create notes and folders, manage selection and use context menus without leaving the keyboard. The plugin also tweaks a few native behaviours, such as avoiding duplicate tabs, supporting background opening and keeping focus on nearby items after deletion.

Reviews

No reviews yet.

Stats

stars
downloads
0
forks
2
days
NaN
days
NaN
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
0
total issues
0
open issues
0
closed issues
0
commits

Latest Version

Invalid date

Changelog

README file from

Github

Obsidian Sidebar Keyboard Navigation

Obsidian plugin to enable keyboard based workflow(Vim-like) in the native File Explorer.

For Vim users, Obsidian currently supports using Vim-mode in the Editor (enabled in Settings), but not in other tool windows, like File Explorer. The goal of this plugin is to fill this gap for users who rely on a keyboard-based workflow.

Features

  • Use keyboard to perform common actions in the File Explorer
  • Option to disable certain keys, if they interfere with your workflow (or other plugins)
  • Minimal invasion to the native app behavior (and your note-taking workflow)
  • Changes(improvements) to the native app features
    • Avoid duplicating opened files: if trying to open an already opened file - focus it, instead of opening a duplicate tab (enabled/disabled in Settings).
    • Background opening: for most file-opening actions, there is an alternative action to allow you to open files "in background", while keep the focus on the File Explorer.
    • Deselect all items: new action.
    • After deleting a node in the File Explorer, automatically focus next/prev node, instead of loosing focus.

Showcase

Installation

Install Latest Git Version via BRAT

Refer to the BRAT documentation for detailed instructions.

Manual Installation

  1. Download assets (main.js, manifest.json, styles.css) from the releases page
  2. Create plugin folder in VAULT_DIR/.obsidian/plugins/sidebar-keyboard-navigation
  3. Put downloaded assets into the plugin folder

Usage

  1. (Optional) Consider reviewing/setting the following key bindings provided by Obsidian, so you can use the File Explorer more efficiently:
    • Files: Show file explorer: focus the File Explorer (e.g. Alt+P)
    • Toggle left sidebar: toggle the File Explorer (e.g. Alt+Shift+P)
    • Files: Reveal current file in navigation: (e.g. Alt+F1, similar to one in Intellij IDEA)
    • Focus on tab group to the right/lef/below/above: to switch between opened splits (e.g. Ctrl- L/H/J/K). You can also use Esc to switch from the File Explorer to the most recent Split.
  2. (Optional) Open and review plugin settings.
  3. Focus the File Explorer using Files: Show file explorer or File: Reveal current file in navigation command ( shortcut or from the Command Palette).
  4. Use supported key bindings to navigate and interact with nodes.
    • For new users it's suggested to start with the most basic commands - j/k/h/k/n/f, and introduce more advanced actions gradually.

If, after some operation (e.g. after deleting a note via default mapping - Ctrl-Shift-D), you see that no nodes focused(focus lost) - just press j or k to get focus back.

Search Toolbar

When you open the Search toolbar, the keyboard focus initially placed on the input element. After you entered the search term, you can unfocus the search input by pressing Tab, and then start navigating by moving focus to the first entry (j).

After you open a file from the search results (by pressing l or Enter), you can quickly move focus back to the same position in the search results by pressing Shift + Tab. It's the native app's behavior and will work only if you have a single editor opened (no splits).

Available Actions

[!NOTE]

  • All key bindings currently limited to use only a single key press, and Ctrl/Alt modifiers are not used, as these > are likely to interfere with the native key bindings.
  • Node - an entry in a sidebar toolbar (file or folder for File Explorer)
  • Focused node - a node with the cursor(focus) positioned on it
  • Selected node - a node selected via selection
  • Background-opening - opening a file without switching focus to the Editor
  • Mappings for some destructive actions (e.g. delete note/folder) are disabled by default in Settings, so you don't accidentally damage your precious stuff while exploring the plugin for the first time.
Key Action Description
Base Movements
j move down Also works for context menu
J move down, and if a file focused - background-open focused file Native: Ctrl + ArrowDown.Can be used to quickly preview files in a folder
k move up Also works for context menu
K move up, and if a file focused - background-open focused file Native: Ctrl + ArrowUp.Can be used to quickly preview files in a folder
g focus the topmost root node
G focus the bottommost root node
v toggle selection on focused node
V clear selection (deselect all nodes)
Folds
h a) if an opened folder or a file focused - close the current folderb) if a closed folder focused - jump to the parent folder
H a) if an opened folder focused - close it recursivelyb) if a closed folder, or a file focused - jump to the parent folder
l a) if a folder focused - open itb) if a file focused - open it in the recently active Editor
L a) if a folder focused - expand it recursivelyb) if a file focused - open it, but keep focus on File Explorer
Z close all folders recursively
Opening Files
t open focused file in a new tab Native: Ctrl + Enter
T background-open focused file in a new tab
s open focused file in a new vertical split Native: Open to the right
S background-open focused file in a new vertical split
i open focused file in a new horizontal split
I background-open focused file in a new horizontal split
w open selected files (or focused file) in a new window
o show popup preview for the focused file Native: Ctrl + MouseOver.This action is still work-in-progress.Currently, the action doesn't provide auto-hiding for the popup, so you should hide it manually by pressing o again, while focused the same node.Alternatively, you can just mouse-click/mouse-move outside of the popup to hide it.
Editing
n create a new note inside the current/focused folder If a folder is focused, this action will create new note in that folder
N create a new note inside the parent folder If a folder is focused, this action will create new note in the parent folder
f create a new folder inside the current/focused folder
F create a new folder inside the parent folder
r rename focused node Native: Rename (context menu)
c clone focused node Native: Make a copy (context menu).Min app version required - 1.8.7
D a) if some nodes selected - delete selected nodesb) otherwise - delete focused node Native: Delete (shortcut)
Misc
? toggle help menu
; toggle context menu for focused(or selected) node(s) If you want to invoke context menu for selected nodes - the focus should be on some of selected nodes
/ search in the focused folder Native: Search in folder (context menu).Changes to the native behavior: deselect search text after opening search window, so user can start typing search term immediately.Min app version required - 1.7.2
Key Action Description
Base Movements
j move down Also works for context menu
J move down, and if a file focused - background-open focused entry
k move up Also works for context menu
K move up, and if a file focused - background-open focused entry
g focus the topmost root node
G focus the bottommost root node
Folds
h collapse current group
l expand current group, or open focused entry
L expand current group, or background-open focused entry
Z Toggle(expand/collapse) all folds
Opening Files
t open focused entry in a new tab
T background-open focused entry in a new tab
s open focused entry in a new vertical split
S background-open focused entry in a new vertical split
i open focused entry in a new horizontal split
I background-open focused entry in a new horizontal split
Misc
? toggle help menu
; toggle context menu for focused(or selected) node(s)

How It Works

When one of supported leafs (tool windows) (e.g. File Explorer) is focused, the plugin is starting listening for keydown events to invoke appropriate actions. To implement actions logic, where possible, the plugin tries to use the most abstract native(obsidian/browser) functions (e.g. onKeyArrowDown, setFocusedItem) to minimize any conflicts/bugs. For some actions, it's necessary to mimic the logic from internal functions and apply some changes.

APIs used by the plugin:

  • DOM: mostly for reading the state (except for rendering the help modal, and highlighting focused tab)
  • Event: dispatching events to mimic native app behavior
  • Obsidian: using internal (non-sensitive) functions like getMostRecentLeaf, crate leaf, tree.setFocusedItem

No runtime dependencies.

Not Implemented (Yet) Features and Their Drawbacks

  • Configurable key mappings
    • Adds substantial complexity to the codebase
    • Requires handling of different keyboard layouts (should map key codes with key symbols for UI)
    • Adding new keys requires more careful consideration
  • File Explorer
    • Copy/Cut/Paste: pretty hard to mimic the native Clipboard event (perhaps due to the security model of Electron/Browser JS). And another solution - overwriting the native functions(handleCut/handleCopy/handlePaste) seems to not be so safe for edit-actions.
    • scrolloff/zz/zt/zb: there is no ready-to-use internal structure to list currently visible entries in the FileExplorer, so a potential implementation will require a complex path traversal logic
  • Other tool windows
    • Planned to add support for other (sidebar) tool windows - bookmarks, outline.

Known Bugs and Current Limitations

  • This plugin is indented to be used with the core File Explorer plugin. So it might break the functionality of your other plugins if they change the behaviour of the File Explorer.
  • While current keyboard shortcuts have been thoroughly designed and made to be future-proof, they are subject to change (though unlikely).
  • Key mappings (in the docs and in-app) reflect characters produced by en_US QWERTY keyboard layout
  • Background-opening
    • The position of a new tab/split will depend on to the most recently focused split(or tab group)
    • If you background-open a file, and then switch focus to it - the focus is not set properly. Steps to reproduce:
      • Empty Editor (no opened tabs)
      • Focus File Explorer and background-open a file using T
      • Focus Editor using Escape
      • Now, some native key bindings (e.g. scroll via ArrowDown/ArrowUp/Page Down/Page Up) will not work until you click on Editor, or enter the source mode
    • This feature may introduce unnecessary complexity to your workflow, if you try to build a workspace layout with 3+ splits using these actions. So consider using it sparingly.

Contributing

I prefer to host my open-source projects on Codeberg, but in order to publish the plugin to the community store it has to be hosted on GitHub.

If you prefer to contribute on Codeberg – you can find the mirror repository here.

Issues

If you are sure that you have found a bug - please open an issue. For any clarifications regarding plugin's functionality, please ask questions on the forum.

Feedback

Please leave any feedback in the plugin's topic on the Obsidian official forum.

Similar Projects

  • NERDTree - A tree explorer plugin for Vim.
  • Neo-tree - Neovim plugin to manage the file system and other tree. like structures.

License

MIT

Similar Plugins

info
• Similar plugins are suggested based on the common tags between the plugins.
Vim IM Select
5 years ago by Alonelur
Obsidian plugin: vim im select
Rant-Lang
5 years ago by Leander Neiß
Thin wrapper around Rant-Lang for Obsidian.md
Novel Word Count
4 years ago by Isaac Lyman
Obsidian plugin. Displays a word count or other statistic for each file, folder and vault in the File Explorer pane.
Version History Diff (Sync, File Recovery & Git)
4 years ago by kometenstaub
Get a diff view of your Obsidian Sync, File Recovery and Git version history
Open In Other Editor
4 years ago by Yekingyan
Open current active file in gVim or VScode.
Auto Hide
4 years ago by skelato1
This Obsidian plugin enables you to collapse (and expand) the sidebar easier.
Cycle In Sidebar
3 years ago by Houcheng
Cycle through tabs of left/ right sidebar panel
Frontmatter Alias Display
3 years ago by muhammadv-i
A plugin for Obsidian.md to show front-matter aliases as display names in the file menu.
Soomda
3 years ago by Michael Lee
🙈 Soomda — An Obsidian plugin that lets you quickly hide your sidebars.
Dendron Tree
3 years ago by Levi Rizki Saputra
Mini Vimrc
3 years ago by Felipe M.
Minimal plugin to add key-biddings to Obsidian
Vim Yank Highlight
3 years ago by Aleksey Rowan
Highlight yanked text in Vim mode. Enjoy that subtle animation you've missed so much.
Vim IM Control
3 years ago by hideakitai
Obsidian plugin to switch Input Method when "InsertLeave" and "InsertEnter". Supports macOS, Windows, and Linux.
Custom Sidebar Icons
2 years ago by RavenHogWarts
Custom Icons
Headings in Explorer
2 years ago by Patrick Chiang
This Obsidian plugin makes headings first class concepts in the file explorer and consolidates navigation to a single panel.
Vimium
2 years ago by Karsten Finderup Pedersen
Interact with elements using keyboard shortcuts in the spirit of Vim.
Recent Files
6 years ago by Tony Grosinger
Display a list of most recently opened files
Vimrc Support
6 years ago by esm
A plugin for the Obsidian.md note-taking software
Markdown Formatting Assistant
5 years ago by Reocin
This Plugin provides a simple WYSIWYG Editor for Markdown and in addition a command line interface. The command line interface facilitate a faster workflow.
Collapse All
5 years ago by Nathonius
Sidebar Expand on Hover
5 years ago by Tousif Iqbal Anik (toiq)
This Obsidian plugin expands or collapses the sidebar based on mouse hovering on the ribbons.
Hide Sidebars on Window Resize
5 years ago by NomarCub, Michael Hanson
A simple Obsidian plugin to hide the sidebars when the window gets narrow.
File Explorer Markdown Titles
5 years ago by Dylan Elliott
Obsidian Plugin that adds the the markdown title within your notes to the file explorer
Window Collapse
5 years ago by Guilherme Quental
Prominent Bookmarked Files
5 years ago by Jeremy Valentine
Prominently display starred files in Obsidian.md
Reveal Active File Button
5 years ago by Clare Macrae
Obsidian plugin to add a button to the top of the Obsidian File Explorer, to reveal the active file.
Simple Focus
2 years ago by Lin Qing
Allows you to focus on a specific file or folder. 让你可以专注于一个文件或文件夹
Simple File Info
a year ago by Lukas Capkovic
Hide Index Files
a year ago by d7sd6u
Hides folder notes from the file explorer
Quick Peek Sidebar
a year ago by Bradley Wyatt
Open and close the Obsidian sidebars on hover.
Rainbow Folders Fixer
a year ago by Dee
Stop rainbow folders from changing colors as you scroll through the File Explorer in Obsidian.md
Reveal Folded
a year ago by d7sd6u
Adds a command that reveals current file while collapsing every other tree item
Rainbow-Colored Sidebar
a year ago by Kevin Woblick
Automatically color your sidebar like a rainbow. No configuration needed. 18 themes included.
Mark Open Files
a year ago by Michael Schrauzer
Adds a marker to all the File Explorer items that are currently open in the Obsidian workspace.
Zen Space
a year ago by Aditya Amatya
An enhanced file explorer showing relevant only relevant files for focused work.
Vim Marker Sharpener
a year ago by Artem Dvoryadkin
Text formatting commands in Vim mode. Supports applying styles (bold, italic, etc.). Works correctly in visual mode with selected text.
Scratchpad
a year ago by KVH
An open source Obsidian plugin for quick note-taking and freehand drawing.
Discrete
a year ago by shkarlsson
Scrolls To Nav Top
a year ago by mario
Simply scrolls to nav top
Notebook Navigator
10 months ago by Johan Sanneblad
Replace the default file explorer in Obsidian with a clean two-pane interface featuring folder tree, tag browsing, file previews, keyboard navigation, drag-and-drop, pinned notes, and customizable display options.
Emoji selector
9 months ago by summer
Insert custom emojis with quick search, auto-suggestions, and customizable templates.
Mobile Sidebar Notes
9 months ago by Chris Kephart
Open notes & new tabs in the sidebar on the Obsidian mobile app.
Floating Headings
6 months ago by k0src
Displays a floating, collapsible outline of a note's headings on the right side of the editor. Expands on hover, click to navigate.
TikToker
4 months ago by ameyxd
Save TikTok videos as markdown notes with embedded content and metadata extraction.
WebDAV Explorer
4 months ago by 蓝星晓夜
WebDAV Explorer: Connect to WebDAV server, preview files directly in web view, and generate links through simple drag-and-drop.
File Explorer Reload
3 months ago by mnaoumov
This plugin has not been manually reviewed by Obsidian staff. Reloads file explorer pane
Tree Modal
3 months ago by krannich
This plugin has not been manually reviewed by Obsidian staff. Open files from the file explorer in a modal preview instead of in the editor.