Add open_with_reader
This commit is contained in:
parent
abac026ed6
commit
703de6f1fe
7
init.lua
7
init.lua
|
@ -93,6 +93,10 @@ require('config.treesitter')
|
||||||
|
|
||||||
require('config.lspconfig')
|
require('config.lspconfig')
|
||||||
|
|
||||||
|
-- Custom
|
||||||
|
|
||||||
|
Custom = require('config.custom')
|
||||||
|
|
||||||
-- Keybinds
|
-- Keybinds
|
||||||
|
|
||||||
let(nil, 'mapleader', ',')
|
let(nil, 'mapleader', ',')
|
||||||
|
@ -164,3 +168,6 @@ vnoremap <silent> <C-Up> :m '<-2<CR>gv=gv
|
||||||
|
|
||||||
-- Clean highlight
|
-- Clean highlight
|
||||||
map('n', '<leader><esc>', '<cmd>nohls<CR><cmd>call clearmatches()<cr>', opts, "CleanHighlights", "clear_all", "Clear all highlights and matches")
|
map('n', '<leader><esc>', '<cmd>nohls<CR><cmd>call clearmatches()<cr>', opts, "CleanHighlights", "clear_all", "Clear all highlights and matches")
|
||||||
|
|
||||||
|
-- Open links with reader
|
||||||
|
map('n', 'gx', '<cmd>lua Custom.open_with_reader()<cr>', {}, "OpenWithReader", "open_with_reader", "Open the link under the cursor with `reader` in a floating tab")
|
||||||
|
|
11
lua/config/custom.lua
Normal file
11
lua/config/custom.lua
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
local win = require("plenary.window.float")
|
||||||
|
|
||||||
|
local function open_with_reader()
|
||||||
|
vim.cmd [[
|
||||||
|
normal! "uyiW
|
||||||
|
]]
|
||||||
|
win.centered({ winblend = 0 })
|
||||||
|
vim.fn.termopen('reader ' .. vim.fn.getreg('u'))
|
||||||
|
end
|
||||||
|
|
||||||
|
return {open_with_reader = open_with_reader, win = win}
|
Loading…
Reference in New Issue
Block a user