diff options
| author | Robert Günzler <r@gnzler.io> | 2022-07-01 17:02:38 +0200 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2022-08-02 22:15:22 +0200 |
| commit | 9967b1702a7aa29232194f2c5dbf02d2b6e5bf0d (patch) | |
| tree | 396f68ef10fe3497c5cbe7c2145846bd24c9cd22 /.vim | |
| parent | e41e232f1371c1332c1ecb406ef157d68f4626c3 (diff) | |
vim: add mapping to open terminal from dirbuf
Diffstat (limited to '.vim')
| -rw-r--r-- | .vim/lua/misc.lua | 3 | ||||
| -rw-r--r-- | .vim/lua/plugins.lua | 11 |
2 files changed, 12 insertions, 2 deletions
diff --git a/.vim/lua/misc.lua b/.vim/lua/misc.lua index 7d4fa31..37ef854 100644 --- a/.vim/lua/misc.lua +++ b/.vim/lua/misc.lua @@ -40,8 +40,7 @@ function M.open_under_cursor(cmd, detect_cmd) if cmd:sub(1, 1) == ":" then vim.cmd(cmd:sub(2) .. ' ' .. txt) else - local c - c = vim.loop.spawn(cmd, { args = {txt} }, function() c:close() end) + vim.loop.spawn(cmd, {args = {txt}}) end end) end diff --git a/.vim/lua/plugins.lua b/.vim/lua/plugins.lua index c451a30..eb62b1e 100644 --- a/.vim/lua/plugins.lua +++ b/.vim/lua/plugins.lua @@ -202,6 +202,17 @@ require('packer').startup({function() hash_padding = 4, sort_order = 'directories_first', } + vim.api.nvim_create_autocmd('FileType', { + pattern = 'dirbuf', + callback = function() + vim.keymap.set('n', 'gT', function() + vim.loop.spawn('swaymsg', {args = {'exec', '--', 'foot', '-D', vim.fn.expand('%')}}) + -- vim.fn.system('swaymsg exec -- foot -D ' .. vim.fn.expand('%')) + end, { buffer = 0 }) + wk_register { ['gT'] = {'Open in foot'} } + end, + group = vim.api.nvim_create_augroup('DirBufEnter', {}), + }) end} -- }}} use {'ggandor/leap.nvim', -- {{{ |