# Ctrl-J / Ctrl-K Hotkey for navigation within command palette and quick switcher

**URL:** <https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751>\
**Category:** Feature requests\
**Tags:** valuable, keyboard-shortcut\
**Created:** [October 28, 2020, 12:09pm UTC](https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751 "2020-10-28T12:09:05Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![koKekkoh](https://forum.obsidian.md/user_avatar/forum.obsidian.md/kokekkoh/32/5604_2.png) [@koKekkoh](https://forum.obsidian.md/u/koKekkoh)\
**Post date:** [October 28, 2020, 12:09pm UTC](https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751/1 "2020-10-28T12:09:05Z")

</div>

## 1. Have you searched for an existing request?

like this:

> [@\[MAC\]: Emacs-style (Ctrl-n / Ctrl-p) navigation within command palette](https://forum.obsidian.md/t/emacs-style-c-n-c-p-navigation-within-command-palette/569/3):
>
> I’m curious which OS you’re on. I forget how I did it exactly, but I’ve enable limited emacs keybindings globally on macOS. So C-n and C-p work for cycling through the command-palette. Also C-a and C-e to jump to the start and end of the line are very handy

## 2. Use case or problem

for workaround of wrong operatoin, I use some commands without shortcut key. so, I use command palette, and need to move right hand for taking a command.

## 3. Proposed solution

I hope:  
ctrl+j: move down in command palette  
ctrl+k: move up in commadn palette  
enter: to use the command  
ctrl+[: dismiss

with these shotcut key, I’m sure to feel so happy.  
my hands, too.

## 4. Current workaround (optional)

move my right hand to arrow keys.

## 5. Related feature requests (optional)

---

<div class="post-metadata">

**Author:** ![argentum](https://forum.obsidian.md/user_avatar/forum.obsidian.md/argentum/32/7733_2.png) [@argentum](https://forum.obsidian.md/u/argentum)\
**Post date:** [October 28, 2020, 7:21pm UTC](https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751/2 "2020-10-28T19:21:31Z")

</div>

I didn’t know I wanted this!

---

<div class="post-metadata">

**Author:** ![koKekkoh](https://forum.obsidian.md/user_avatar/forum.obsidian.md/kokekkoh/32/5604_2.png) [@koKekkoh](https://forum.obsidian.md/u/koKekkoh)\
**Post date:** [October 29, 2020, 4:29am UTC](https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751/3 "2020-10-29T04:29:40Z")

</div>

In a obsidian, I hope to any operation without mouse, with arrow keys a little.  
I imagine my operations for vim-mode, and know others imagine them for emacs-mode.  
so, It would be imagined what hot-key is changed to.

---

<div class="post-metadata">

**Author:** ![mobius1](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/m/8dc957/32.png) [@mobius1](https://forum.obsidian.md/u/mobius1)\
**Post date:** [October 31, 2020, 5:57am UTC](https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751/4 "2020-10-31T05:57:57Z")

</div>

I was about to make a separate post, but I think I can tag it here cos it seems similar.

I’ve wanted to have ctrl+j/k in the popup for link suggestions in addition to the palette. It’s pretty standard in Vim, Spacemacs and VSCodeVim as well.

So I guess it’s a related feature request? Enter and ctrl+[ work the same way too.

---

<div class="post-metadata">

**Author:** ![Rockstone](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/r/f4b2a3/32.png) [@Rockstone](https://forum.obsidian.md/u/Rockstone)\
**Post date:** [December 30, 2020, 2:29pm UTC](https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751/5 "2020-12-30T14:29:10Z")

</div>

I really hope this feature will come soon. I use CTRL-J and CTRL-K everywhere I can to scroll in suggestions.

---

<div class="post-metadata">

**Author:** ![gian](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/g/f19dbf/32.png) [@gian](https://forum.obsidian.md/u/gian)\
**Post date:** [January 16, 2021, 10:40am UTC](https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751/6 "2021-01-16T10:40:50Z")

</div>

Fully agree. Probably should be customized depending on your preferences (Emacs style or vim style).

Personally, I always try Ctrl-J and Ctrl-K every time I open the command palette, before realizing I cannot do that.

---

<div class="post-metadata">

**Author:** ![saneef](https://forum.obsidian.md/user_avatar/forum.obsidian.md/saneef/32/30146_2.png) [@saneef](https://forum.obsidian.md/u/saneef)\
**Post date:** [May 22, 2022, 3:37pm UTC](https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751/7 "2022-05-22T15:37:22Z")

</div>

I use [Karabiner](http://karabiner-elements.pqrs.org) to map `ctrl-n` and `ctrl-p` to down and up arrows respectively. In Karabiner, you can set the mapping only while Obsidian is active.

If any one wants to try, here is mapping in my [`karabiner.json`](https://gist.github.com/saneef/b0b2aed598f17764e6d5c5040925fbe5#file-karabiner-json-L34).

---

<div class="post-metadata">

**Author:** ![aviau](https://forum.obsidian.md/user_avatar/forum.obsidian.md/aviau/32/31053_2.png) [@aviau](https://forum.obsidian.md/u/aviau)\
**Post date:** [June 13, 2022, 3:51pm UTC](https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751/8 "2022-06-13T15:51:41Z")

</div>

I’d love to see this!

---

<div class="post-metadata">

**Author:** ![yuhixyz](https://forum.obsidian.md/user_avatar/forum.obsidian.md/yuhixyz/32/32361_2.png) [@yuhixyz](https://forum.obsidian.md/u/yuhixyz)\
**Post date:** [July 20, 2022, 4:43am UTC](https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751/9 "2022-07-20T04:43:30Z")

</div>

Any update? Obsidian v0.15.6 already supports using “ctrl-n/p” to navigate, will “ctrl-j/k” to be possible?

---

<div class="post-metadata">

**Author:** ![anotherroot](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/a/3d9bf3/32.png) [@anotherroot](https://forum.obsidian.md/u/anotherroot)\
**Post date:** [November 18, 2022, 9:57am UTC](https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751/10 "2022-11-18T09:57:55Z")

</div>

I made it work by calling this JS code at obsidian startup. You can do this with various plugins or by making your own plugin.

```javascript

    document.addEventListener('keydown',(e) =>{
        if (e.code == "KeyN" && e.ctrlKey && !e.shiftKey && !e.metaKey){
            document.dispatchEvent(new KeyboardEvent("keydown",{"key":"ArrowDown","code":"ArrowDown"}))
        }
    });

    document.addEventListener('keydown',(e) =>{
        if (e.code == "KeyP" && e.ctrlKey && !e.shiftKey && !e.metaKey){
            document.dispatchEvent(new KeyboardEvent("keydown",{"key":"ArrowUp","code":"ArrowUp"}))
        }
    });

```

This code listens for Ctrl+N and Ctrl+P key press events and creates a new ArrowDown/ArrowUp event.

It could be made more specific by attaching the event listener to the specific DOM elements where you want this functionality.

---

<div class="post-metadata">

**Author:** ![nick\_s](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/n/6a8cbe/32.png) [@nick\_s](https://forum.obsidian.md/u/nick_s)\
**Post date:** [November 22, 2022, 7:43pm UTC](https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751/11 "2022-11-22T19:43:30Z")

</div>

Just building off of [anotherroot](https://forum.obsidian.md/u/anotherroot)’s response you can check to see what the active element is, not sure if you can add the listener to the suggester element since it doesn’t exist when obsidian is first loaded.

I also added `e.preventDefault()` so my other hotkeys weren’t trying to run and swapped `metaKey` and `ctrlKey` since I’m on mac.

```nohighlight
document.addEventListener('keydown',(e) =>{
	if (document.activeElement && document.activeElement.hasClass('prompt-input') && e.code == "KeyJ" && e.metaKey && !e.shiftKey && !e.ctrlKey){
		e.preventDefault();
		document.dispatchEvent(new KeyboardEvent("keydown",{"key":"ArrowDown","code":"ArrowDown"}))
	}
});
document.addEventListener('keydown',(e) =>{
	if (document.activeElement && document.activeElement.hasClass('prompt-input') && e.code == "KeyK" && e.metaKey && !e.shiftKey && !e.ctrlKey){
		e.preventDefault();
		document.dispatchEvent(new KeyboardEvent("keydown",{"key":"ArrowUp","code":"ArrowUp"}))
	}
});

```

---

<div class="post-metadata">

**Author:** ![dhod](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/d/c6cbf5/32.png) [@dhod](https://forum.obsidian.md/u/dhod)\
**Post date:** [June 28, 2023, 10:36am UTC](https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751/12 "2023-06-28T10:36:15Z")

</div>

@nick_s where do you place the code snippet?

---

<div class="post-metadata">

**Author:** ![dhod](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/d/c6cbf5/32.png) [@dhod](https://forum.obsidian.md/u/dhod)\
**Post date:** [June 28, 2023, 10:59am UTC](https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751/13 "2023-06-28T10:59:09Z")

</div>

I managed to make it work by creating a plugin using this guide: [Create your first plugin | Obsidian Plugin Developer Docs](https://marcus.se.net/obsidian-plugin-docs/getting-started/create-your-first-plugin).

I then replaced main.ts with the contents below:

> <https://gist.github.com/danihodovic/7a8c55cc53c3d4c4790a08959a96998c>

---

<div class="post-metadata">

**Author:** ![antenando](https://forum.obsidian.md/user_avatar/forum.obsidian.md/antenando/32/67898_2.png) [@antenando](https://forum.obsidian.md/u/antenando)\
**Post date:** [July 1, 2024, 6:58am UTC](https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751/14 "2024-07-01T06:58:54Z")

</div>

Want this so much!!!

---

<div class="post-metadata">

**Author:** ![eipe2955](https://forum.obsidian.md/user_avatar/forum.obsidian.md/eipe2955/32/25498_2.png) [@eipe2955](https://forum.obsidian.md/u/eipe2955)\
**Post date:** [July 3, 2024, 2:08pm UTC](https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751/15 "2024-07-03T14:08:28Z")

</div>

I want this as well. I was expecting it to be customizable but it seems to be not!

/happy vim user

---

<div class="post-metadata">

**Author:** ![tilimani](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/t/cab0a1/32.png) [@tilimani](https://forum.obsidian.md/u/tilimani)\
**Post date:** [August 14, 2025, 5:17pm UTC](https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751/17 "2025-08-14T17:17:00Z")

</div>

For anyone looking into this, I use this a lot in VS Code and applied it for obsidian in the same way for the default quick switcher and command menu:

1. Changed quick switcher hotkey to `cmd + p`
2. command menu =\> `cmd + shift + p`
3. to go to the next option in either one =\> `cmd + p`
4. to go to the prev option =\>` cmd + shift + p`
5. `cmd key up` =\> open selected option, menu keeps open with cmd pressed

I followed the guide to create a small plugin and edited the main.ts to this:

```auto
import {App, Editor, MarkdownView, Modal, Notice, Plugin, PluginSettingTab, Setting} from 'obsidian';

// Remember to rename these classes and interfaces!

interface MyPluginSettings {
	mySetting: string;
}

const DEFAULT_SETTINGS: MyPluginSettings = {
	mySetting: 'default'
}

function isKeyRelevant(document: HTMLDocument, event: KeyboardEvent, isSuggesting: boolean) {

	if (!document.activeElement || !event.metaKey) {

		return false;
	}
	const el = document.activeElement;
	const isInOmniSearch = el.closest(".omnisearch-modal");
	const isInAutoCompleteFile = el.closest(".cm-content")
	// The OmniSearch plugin already maps Ctrl-J and Ctrl-K and we don't want to duplicate the
	// effort and jump twice.
	return (!isInOmniSearch && el.hasClass('prompt-input')) || isInAutoCompleteFile || isSuggesting;
}

export default class MyPlugin extends Plugin {
	settings: MyPluginSettings;
	private arrowKeyPressed = false;

	async onload() {
		await this.loadSettings();
		// Down event - Cmd+P
		document.addEventListener('keydown', (e) => {
			if (isKeyRelevant(document, e, app.workspace.editorSuggest.currentSuggest) && e.code == "KeyP" && e.metaKey && !e.shiftKey) {
				e.preventDefault();
				this.arrowKeyPressed = true;
				document.dispatchEvent(new KeyboardEvent("keydown", {"key": "ArrowDown", "code": "ArrowDown"}))
			}
		});
		// Up event - Cmd+Shift+P
		document.addEventListener('keydown', (e) => {
			if (isKeyRelevant(document, e, app.workspace.editorSuggest.currentSuggest) && e.code == "KeyP" && e.metaKey && e.shiftKey) {
				e.preventDefault();
				this.arrowKeyPressed = true;
				document.dispatchEvent(new KeyboardEvent("keydown", {"key": "ArrowUp", "code": "ArrowUp"}))
			}
		});
		
		// Trigger Enter on Command key release only if no arrow keys were pressed
		document.addEventListener('keyup', (e) => {
			if ((e.code === "MetaLeft" || e.code === "MetaRight") && this.arrowKeyPressed) {
				document.dispatchEvent(new KeyboardEvent("keydown", {"key": "Enter", "code": "Enter"}))
			}
			// Reset the flag when Command key is released
			if (e.code === "MetaLeft" || e.code === "MetaRight") {
				this.arrowKeyPressed = false;
			}
		});
	}

	onunload() {

	}

	async loadSettings() {
		this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
	}

	async saveSettings() {
		await this.saveData(this.settings);
	}
}

class SampleModal extends Modal {
	constructor(app: App) {
		super(app);
	}

	onOpen() {
		const {contentEl} = this;
		contentEl.setText('Woah!');
	}

	onClose() {
		const {contentEl} = this;
		contentEl.empty();
	}
}

class SampleSettingTab extends PluginSettingTab {
	plugin: MyPlugin;

	constructor(app: App, plugin: MyPlugin) {
		super(app, plugin);
		this.plugin = plugin;
	}

	display(): void {
		const {containerEl} = this;

		containerEl.empty();

		containerEl.createEl('h2', {text: 'Settings for my awesome plugin.'});

		new Setting(containerEl)
			.setName('Setting #1')
			.setDesc('It\'s a secret')
			.addText(text => text
				.setPlaceholder('Enter your secret')
				.setValue(this.plugin.settings.mySetting)
				.onChange(async (value) => {
					console.log('Secret: ' + value);
					this.plugin.settings.mySetting = value;
					await this.plugin.saveSettings();
				}));
	}
}

```

---

<div class="post-metadata">

**Author:** ![Abisheik](https://forum.obsidian.md/user_avatar/forum.obsidian.md/abisheik/32/46914_2.png) [@Abisheik](https://forum.obsidian.md/u/Abisheik)\
**Post date:** [February 25, 2026, 4:41am UTC](https://forum.obsidian.md/t/ctrl-j-ctrl-k-hotkey-for-navigation-within-command-palette-and-quick-switcher/7751/18 "2026-02-25T04:41:38Z")

</div>

My simple script that’s a bit different than other workarounds in this thread since it doesn’t add EventListeners to the entire document:  
[Adding Vim-like Ctrl+J and Ctrl+K navigation to quick switcher - Share & showcase - Obsidian Forum](https://forum.obsidian.md/t/adding-vim-like-ctrl-j-and-ctrl-k-navigation-to-quick-switcher/111602)
