mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2025-12-31 22:04:24 -05:00
added media previewer alternative catimg
This commit is contained in:
@@ -377,6 +377,11 @@ require('telekasten').setup({
|
||||
-- home = "/home/user/vaults/personal",
|
||||
},
|
||||
},
|
||||
|
||||
-- how to preview media files
|
||||
-- "telescope-media-files" if you have telescope-media-files.nvim installed
|
||||
-- "catimg-previewer" if you have catimg installed
|
||||
media_previewer = "telescope-media-files",
|
||||
})
|
||||
END
|
||||
```
|
||||
@@ -438,6 +443,9 @@ END
|
||||
| | - `prefer_home`: put all notes in home folder except for `goto_today()` and `goto_thisweek()`, and notes with `sub/folders` in the title ||
|
||||
| | - `same_as_current`: put all new notes in the directory of the currently open note (where the cursor is) if present or else into the home folder, except for notes with `sub/folders/` in the title||
|
||||
| `vaults` | a table of additional vault configurations. Default config values are assumed for all config settings that are not specified for additional vaults | `vaults = { second_vault = { home = "/home/rs/vaults/second", }, third_vault: { home = "/home/rs/vaults/third", }, }` |
|
||||
| `media_previewer` | how to preview media files | default: `telescope-media-files` |
|
||||
|| - `telescope-media-files` if you have telescope-media-files.nvim installed |
|
||||
|| - `catimg-previewer` if you have catimg installed |
|
||||
|
||||
The calendar support has its own options, contained in `calendar_opts`:
|
||||
|
||||
|
||||
@@ -151,6 +151,10 @@ telekasten.setup({opts})
|
||||
-- home = "/home/user/vaults/personal",
|
||||
}
|
||||
},
|
||||
-- how to preview media files
|
||||
-- "telescope-media-files" if you have telescope-media-files.nvim installed
|
||||
-- "catimg-previewer" if you have catimg installed
|
||||
media_previewer = "telescope-media-files",
|
||||
}
|
||||
<
|
||||
|
||||
@@ -399,6 +403,18 @@ telekasten.setup({opts})
|
||||
has been renamed.
|
||||
|
||||
Default: `true`
|
||||
|
||||
*telekasten.settings.media_previewer*
|
||||
media_previewer:~
|
||||
Previewer used for viewing media / image files. There are two
|
||||
options:
|
||||
- `'telescope-media-files'` : use the telescope-media-files.nvim
|
||||
plugin
|
||||
- `'catimg-previewer'` : use the built-in `catimg` previewer.
|
||||
Requires `catimg` to be installed.
|
||||
|
||||
Default: `telescope-media-files`
|
||||
|
||||
*telekasten.calendar_opts*
|
||||
-----------------------------------
|
||||
Valid keys for {opts.calendar_opts}
|
||||
@@ -925,7 +941,7 @@ Section 3.6 Mutliple home directories *telekasten.switch_vaults*
|
||||
|
||||
You can have multiple home directories setup in telekasten. The configuration
|
||||
for each vault is stored as a map in telekasten. You can use `switch_vaults
|
||||
to launch a picker to choose the vaults.
|
||||
to launch a picker to choose the vaults.
|
||||
|
||||
|
||||
================================================================================
|
||||
|
||||
@@ -149,6 +149,11 @@ local function defaultConfig(home)
|
||||
|
||||
-- should all links be updated when a file is renamed
|
||||
rename_update_links = true,
|
||||
|
||||
-- how to preview media files
|
||||
-- "telescope-media-files" if you have telescope-media-files.nvim installed
|
||||
-- "catimg-previewer" if you have catimg installed
|
||||
media_previewer = "telescope-media-files",
|
||||
}
|
||||
M.Cfg = cfg
|
||||
M.note_type_templates = {
|
||||
@@ -964,7 +969,16 @@ local media_files_base_directory = M.base_directory
|
||||
.. "/telescope-media-files.nvim"
|
||||
local defaulter = utils.make_default_callable
|
||||
local media_preview = defaulter(function(opts)
|
||||
local preview_cmd = media_files_base_directory .. "/scripts/vimg"
|
||||
local preview_cmd = ""
|
||||
if M.Cfg.media_previewer == "telescope-media-files" then
|
||||
preview_cmd = media_files_base_directory .. "/scripts/vimg"
|
||||
end
|
||||
|
||||
if M.Cfg.media_previewer == "catimg-previewer" then
|
||||
preview_cmd = M.base_directory
|
||||
.. "/telekasten.nvim/scripts/catimg-previewer"
|
||||
end
|
||||
|
||||
if vim.fn.executable(preview_cmd) == 0 then
|
||||
print("Previewer not found: " .. preview_cmd)
|
||||
return conf.file_previewer(opts)
|
||||
@@ -977,6 +991,7 @@ local media_preview = defaulter(function(opts)
|
||||
if vim.tbl_isempty(tmp_table) then
|
||||
return { "echo", "" }
|
||||
end
|
||||
print(tmp_table[1])
|
||||
return {
|
||||
preview_cmd,
|
||||
tmp_table[1],
|
||||
|
||||
7
scripts/catimg-previewer
Executable file
7
scripts/catimg-previewer
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
img="$1"
|
||||
width="$4"
|
||||
height="$5"
|
||||
|
||||
catimg "$img" -w${width}x${height}
|
||||
Reference in New Issue
Block a user