Skip to content

Commands

lambtho12 edited this page Jan 24, 2022 · 3 revisions

Telekasten commands

You can use the plugin either by executing the :Telekasten <sub-command> command or by calling one of its Lua functions that implement the sub-commands. Which method you use is up to you. Note that you cannot pass arguments to the Telekasten command, but you can add arguments to some of the lua functions.

The Telekasten command supports sub-command completion, so if TAB allows you to autocomplete in nvim, typing :Telekasten <TAB> should make the sub-command list pop up.

The following sub-commands are defined; check their corresponding Lua functions for a more detailed description.

General commands

Sub-command Use
panel Brings up the command palette
find_notes Find notes by filename
search_notes Search (grep) in all notes
follow_link Follow the link under the cursor
insert_link Insert a link to a note
show_tags Search through all tags
rename_note Rename current note and update the links pointing to it
new_note Create a new note, prompts for title
yank_notelink Yank a link to the currently open note
new_templated_note create a new note by template, prompts for title and template
toggle_todo Toggle - [ ] todo status of a line
show_backlinks Show all notes linking to the current one
find_friends Show all notes linking to the link under the cursor

Journal commands

Commands specific for journaling.

Sub-command Use
show_calendar Show the calendar
goto_today Open today's daily note
goto_thisweek Open this week's weekly note
find_daily_notes Find daily notes by title (date)
find_weekly_notes Find weekly notes by title (calendar week)

Image commands

Commands related to image manipulation.

Sub-command Use
paste_img_and_link Paste an image from the clipboard into a file and inserts a link to it
insert_img_link Browse images / media files and insert a link to the selected one
preview_img preview image under the cursor
browse_media Browse images / media files

The command palette

With :Telekasten panel or :lua require('telekasten').panel() you can bring up the command palette, which is a Telescope search through all Telekasten commands.

This is super useful for your keyboard mappings. Suppose all your telekasten mappings start with <leader>z like in the following example:

nnoremap <leader>zf :lua require('telekasten').find_notes()<CR>
nnoremap <leader>zd :lua require('telekasten').find_daily_notes()<CR>
nnoremap <leader>zg :lua require('telekasten').search_notes()<CR>
nnoremap <leader>zz :lua require('telekasten').follow_link()<CR>

Then, simply bind panel() to <leader>z:

nnoremap <leader>z :lua require('telekasten').panel()<CR>
nnoremap <leader>zf :lua require('telekasten').find_notes()<CR>
nnoremap <leader>zd :lua require('telekasten').find_daily_notes()<CR>
nnoremap <leader>zg :lua require('telekasten').search_notes()<CR>
nnoremap <leader>zz :lua require('telekasten').follow_link()<CR>

The moment you hesitate after pressing <leader>z instead of pressing the disambiguating second letter, Telekasten will make it easy for you and pop up a panel.

The command palette comes with two themes: ivy and dropdown (see below). The preferred theme can be configured in Telekasten options with: command_palette_theme = 'ivy' -- or 'dropdown'.

command_palette_theme = 'ivy' command_palette_theme = 'dropdown'