mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 14:14: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",
|
-- 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
|
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 ||
|
| | - `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||
|
| | - `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", }, }` |
|
| `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`:
|
The calendar support has its own options, contained in `calendar_opts`:
|
||||||
|
|
||||||
|
|||||||
@@ -151,6 +151,10 @@ telekasten.setup({opts})
|
|||||||
-- home = "/home/user/vaults/personal",
|
-- 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.
|
has been renamed.
|
||||||
|
|
||||||
Default: `true`
|
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*
|
*telekasten.calendar_opts*
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
Valid keys for {opts.calendar_opts}
|
Valid keys for {opts.calendar_opts}
|
||||||
|
|||||||
@@ -149,6 +149,11 @@ local function defaultConfig(home)
|
|||||||
|
|
||||||
-- should all links be updated when a file is renamed
|
-- should all links be updated when a file is renamed
|
||||||
rename_update_links = true,
|
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.Cfg = cfg
|
||||||
M.note_type_templates = {
|
M.note_type_templates = {
|
||||||
@@ -964,7 +969,16 @@ local media_files_base_directory = M.base_directory
|
|||||||
.. "/telescope-media-files.nvim"
|
.. "/telescope-media-files.nvim"
|
||||||
local defaulter = utils.make_default_callable
|
local defaulter = utils.make_default_callable
|
||||||
local media_preview = defaulter(function(opts)
|
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
|
if vim.fn.executable(preview_cmd) == 0 then
|
||||||
print("Previewer not found: " .. preview_cmd)
|
print("Previewer not found: " .. preview_cmd)
|
||||||
return conf.file_previewer(opts)
|
return conf.file_previewer(opts)
|
||||||
@@ -977,6 +991,7 @@ local media_preview = defaulter(function(opts)
|
|||||||
if vim.tbl_isempty(tmp_table) then
|
if vim.tbl_isempty(tmp_table) then
|
||||||
return { "echo", "" }
|
return { "echo", "" }
|
||||||
end
|
end
|
||||||
|
print(tmp_table[1])
|
||||||
return {
|
return {
|
||||||
preview_cmd,
|
preview_cmd,
|
||||||
tmp_table[1],
|
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