working version and testscript

lua
Matthias Bilger 8 months ago
parent b0e7688744
commit e32360bf0a

@ -1,43 +0,0 @@
name: Check
on: [push, pull_request]
jobs:
check:
strategy:
fail-fast: false
matrix:
osFlavor: [ubuntu-20.04, ubuntu-18.04]
vimFlavor: [neovim, vim]
vimVersion: [stable, unstable]
exclude:
- vimFlavor: vim
vimVersion: unstable
runs-on: ${{ matrix.osFlavor }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Enable Universe package repository
run: |
sudo add-apt-repository ${{ matrix.vimVersion == 'stable' && 'universe' || 'ppa:neovim-ppa/unstable' }}
sudo apt-get update
- name: Install tmux and ${{ matrix.vimFlavor }}
run: |
sudo apt-get install tmux ${{ matrix.vimFlavor }}
- name: Review versions
run: |
tmux -V
${{ matrix.vimFlavor == 'neovim' && 'nvim' || 'vim' }} --version
# This tests looks for two thigs:
# * That VIM doesn't hang. If it succedes it will quit quickly. If 5
# seconds later the tmux session is still running either the runner pane
# didn't get closed or (more likely) we threw some error and VIM is
# sitting there expecting us to acknowledge the message(s).
# * That VIM exited normally. This check isn't very useful since :qa
# never bubbles up an error, but if someday we use :cq for a test being
# ready to check the exit code seems like a good thing.
- name: "Try Vimux"
run: |
ec="$(mktemp)"
tmux new -s ci -d "${{ matrix.vimFlavor == 'neovim' && 'nvim -u /dev/null --headless' || 'vim' }} -i NONE \"+so plugin/vimux.vim\" \"+VimuxRunCommand('date')\" \"+VimuxCloseRunner | qa\"; echo \$? > '$ec'"
sleep 5
tmux kill-session -t ci && exit 1
exit "$(cat $ec)"

@ -1,13 +0,0 @@
name: Reviewdog
on: [pull_request]
jobs:
vint:
name: vint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: vint
uses: reviewdog/action-vint@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review

@ -1,15 +0,0 @@
name: Vint
on: [push]
jobs:
vint:
name: vint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- name: Setup dependencies
run: pip install vim-vint
- name: Lint Vimscript
run: vint .

@ -0,0 +1 @@
rm -rf test/state/*

@ -5,12 +5,15 @@ M.default_opts = {
height = 20,
orientation = "v",
use_nearest = true,
reset_sequence = "q C-u",
reset_mode_sequence = {
["copy-mode"] = "q",
},
reset_cmdline_sequence = "C-u",
prompt_string = "Command? ",
runner_type = "pane",
runner_name = "",
tmux_command = "tmux",
open_extra_args = "",
open_extra_args = {},
expand_command = false,
close_on_exit = false,
command_shell = true,

@ -3,82 +3,194 @@ local tmux = require("nvimux.tmux")
local utils = require("nvimux.utils")
local M = {
last_command = {},
}
M.setup = function (user_opts)
config.setup(user_opts)
M.setup = function(user_opts)
config.setup(user_opts)
utils.check()
M.setup_commands()
end
M.prompt_command = function (...)
local completion = if config.get('command_shell') then 'shellcmd' else nil end
local command = nil
if #arg > 0 then
command = ''
for _,v in ipairs(arg) do
command = command .. tostring(v) .. " "
end
end
opts = {
prompt = config.get('prompt_string'),
completion = completion,
default = command,
}
vim.ui.input(opts, function(command)
if config.get('expand_command') then
local expanded_command = {}
for value in string.gmatch(command, "%S+") do
table.insert(expanded_command, vim.fn.expand(value))
end
command = ''
for _, v in ipairs(expanded_command) do
command = command .. ' ' .. v
end
M.prompt_command = function(prefix)
local completion = ""
if config.get("command_shell") then
completion = "shellcmd"
end
local prompt = config.get("prompt_string")
prefix = prefix or ""
local opts = {
prompt = prompt .. prefix,
completion = completion,
default = command,
}
vim.ui.input(opts, function(command)
if command ~= nil then
M.run(prefix .. command)
end
M.run(command)
end)
end)
end
M.run = function(command, autoreturn)
if not utils.runner_exists() then
utils.open()
end
autoreturn = autoreturn or true
table.insert(M.last_command, command)
utils.reset_runner()
utils.send_text(utils.expand_command(command))
if autoreturn then
utils.send_keys("Enter")
end
end
M.run_last = function()
if #M.last_command > 0 then
M.run(M.last_command[#M.last_command])
end
end
M.clear_history = function()
utils.clear_history()
utils.clear_history()
end
M.clear_terminal_screen = function()
utils.send_keys('C-l')
utils.send_keys("C-l")
end
M.interrupt_runner = function()
utils.send_keys('^c')
utils.send_keys("^c")
end
M.inspect_runner = function()
utils.select()
utils.copy_mode()
utils.select()
utils.copy_mode()
end
M.inspect_scroll_up = function()
M.inspect_runner()
utils.last()
utils.send_keys('C-u')
M.inspect_runner()
utils.last()
utils.send_keys("C-u")
end
M.inspect_scroll_down = function()
M.inspect_runner()
utils.last()
utils.send_keys('C-d')
M.inspect_runner()
utils.last()
utils.send_keys("C-d")
end
M.zoom_runner = function()
utils.zoom()
end
M.zoom_runner = function ()
utils.zoom()
M.close_runner = function()
utils.close()
end
M.close_runner = function ()
utils.close()
M.toggle = function()
utils.toggle()
end
M.toggle = function ()
utils.toggle()
local CMDS = {
{
name = "VimuxRunCommand",
opts = { desc = "nvimux: run command", nargs = "*", complete = "shellcmd" },
command = function(c)
M.run(c.args)
end,
},
{
name = "VimuxRunLastCommand",
opts = { desc = "nvimux: rerun last command", bar = true },
command = function()
M.run_last()
end,
},
{
name = "VimuxOpenRunner",
opts = { desc = "nvimux: open runner", bar = true },
command = function()
utils.open()
end,
},
{
name = "VimuxCloseRunner",
opts = { desc = "nvimux: close runner", bar = true },
command = function()
M.close_runner()
end,
},
{
name = "VimuxZoomRunner",
opts = { desc = "nvimux: zoom runner", bar = true },
command = function()
M.zoom_runner()
end,
},
{
name = "VimuxInspectRunner",
opts = { desc = "nvimux: inspect runner", bar = true },
command = function()
M.inspect_runner()
end,
},
{
name = "VimuxScrollUpInspect",
opts = { desc = "nvimux: scroll runner up", bar = true },
command = function()
M.inspect_scroll_down()
end,
},
{
name = "VimuxScrollDownInspect",
opts = { desc = "nvimux: scroll runner down", bar = true },
command = function()
M.inspect_scroll_down()
end,
},
{
name = "VimuxInterruptRunner",
opts = { desc = "nvimux: interrupt running", bar = true },
command = function()
M.interrupt_runner()
end,
},
{
name = "VimuxPromptCommand",
opts = { desc = "nvimux: interrupt running", nargs = "*" },
command = function(c)
M.prompt_command(c.args)
end,
},
{
name = "VimuxClearTerminalScreen",
opts = { desc = "nvimux: interrupt running", bar = true },
command = function()
M.clear_terminal_screen()
end,
},
{
name = "VimuxClearRunnerHistory",
opts = { desc = "nvimux: interrupt running", bar = true },
command = function()
M.clear_history()
end,
},
{
name = "VimuxTogglePane",
opts = { desc = "nvimux: interrupt running", bar = true },
command = function()
M.toggle()
end,
},
}
M.setup_commands = function()
for _, cmd in ipairs(CMDS) do
local opts = vim.tbl_extend("force", cmd.opts, { force = true })
vim.api.nvim_create_user_command(cmd.name, cmd.command, opts)
end
end
return M

@ -1,30 +1,54 @@
local config = require("nvimux.config")
local M = { }
local M = {}
M.exe = function (...)
local command = config.user_opts.tmux
for _,v in ipairs(arg) do
command = command .. tostring(v) .. " "
end
if config.user_opts.debug then
print('[vimux] Run command "' .. command .. '"')
end
if vim.env.TMUX == nil then
vim.message("Not in a tmux session (TMUX environment variable not found)")
else
vim.system(command)
end
local function all_trim(s)
return s:match( "^%s*(.-)%s*$" )
end
M.send_keys = function(keys)
M.exe('send-keys -t '.. M.runner_index .. ' ' .. keys)
M.is_executable = function()
local command = config.get("tmux_command")
return vim.fn.executable(command) == 1
end
M.get_property = function(name)
return M.exe("display -p '".. name .."'")
M.exe = function(cmd)
local command = { config.get("tmux_command") }
local dbg_command = command[1]
if type(cmd) == "string" then
cmd = { cmd }
end
for _, v in ipairs(cmd) do
if type(v) == "table" then
vim.tbl_extend("force", command, v)
else
table.insert(command, tostring(v))
end
dbg_command = dbg_command .. " " .. tostring(v)
end
if vim.env.TMUX == nil then
vim.message("Not in a tmux session (TMUX environment variable not found)")
else
local result = vim.system(command):wait()
return all_trim(result.stdout)
end
return ""
end
M.send_keys = function(runner, keys)
M.exe({ "send-keys", "-t", runner, keys })
end
M.get_property = function(name, runner)
command = { "display" }
if runner ~= nil then
table.insert(command, '-t')
table.insert(command, runner)
end
table.insert(command, '-p')
table.insert(command, name)
return M.exe(command)
end
return M

@ -2,194 +2,234 @@ local config = require("nvimux.config")
local tmux = require("nvimux.tmux")
local M = {
runner_index = nil
runner_index = nil,
}
M.check = function()
if not tmux.is_executable() then
vim.notify("Cannot execute '" .. config.get("tmux") .. "' command", vim.log.levels.ERROR)
end
end
M.has_runner = function(index)
local runner_type = config.user_opts.runner_type
return string.gmatch(tmux.tmux('list-'..runner_type.."s -F '#{"..runner_type.."_id}'"), index)
local runner_type = config.user_opts.runner_type
return string.gmatch(tmux.exe({ "list-" .. runner_type .. "s", "-F", "'#{" .. runner_type .. "_id}'" }), index)
end
M.set_runner_name = function()
local target_name = config.user_opts.runner_name
if target_name == nil or target_name == '' then
return
end
local target_name = config.user_opts.runner_name
if target_name == nil or target_name == "" then
return
end
local runner_type = config.user_opts.runner_type
if runner_type == 'window' then
tmux.exe('rename-window '..target_name)
elseif runner_type == 'pane' then
tmux.exe('select-pane -T '..target_name)
end
local runner_type = config.user_opts.runner_type
if runner_type == "window" then
tmux.exe({ "rename-window ", target_name })
elseif runner_type == "pane" then
tmux.exe({ "select-pane", "-T", target_name })
end
end
M.get_target_filter = function()
local target_name = config.user_opts.runner_name
if target_name == nil or target_name == '' then
return
end
local target_name = config.user_opts.runner_name
if target_name == nil or target_name == "" then
return
end
local runner_type = config.user_opts.runner_type
if runner_type == 'window' then
return " -f '#{==:#{window_name},"..target_name.."}'"
elseif runner_type == 'pane' then
return " -f '#{==:#{pane_title},"..target_name.."}'"
end
local runner_type = config.user_opts.runner_type
if runner_type == "window" then
return " -f '#{==:#{window_name}," .. target_name .. "}'"
elseif runner_type == "pane" then
return " -f '#{==:#{pane_title}," .. target_name .. "}'"
end
end
M.get_nearest_runner = function()
-- Try finding the runner in the current window/session, optionally using a
-- name/title filter
local runner_type = config.user_opts.runner_type
local filter = M.get_target_filter()
local views = tmux.exe('list-'..runner_type.."s -F '#{"..runner_type..'_active}:#{'..runner_type.."_id}'" .. filter)
local pattern = '1:'
for view in string.gmatch(views, "\n+") do
if string.sub(view, 1, #pattern) == #pattern then
return string.sub(view, 2)
end
end
return ''
-- Try finding the runner in the current window/session, optionally using a
-- name/title filter
local runner_type = config.user_opts.runner_type
local filter = M.get_target_filter() or ""
local views = tmux.exe({
"list-" .. runner_type .. "s",
"-F",
"'#{" .. runner_type .. "_active}:#{" .. runner_type .. "_id}'",
})
local pattern = "1:"
for view in string.gmatch(views, "[^\r\n]+") do
if string.sub(view, 1, #pattern) == #pattern then
return string.sub(view, 2)
end
end
return ""
end
M.get_existing_runner_id = function()
local runner_type = config.user_opts.runner_type
local query = config.get('runner_query')[runner_type]
if query == nil or query == '' then
if config.get('use_nearest') then
return M.get_nearest_runner()
else
return ''
end
end
local current_id = M.get_current_index()
local message = tmux.exe('select-'.. runner_type..' -t ' .. query)
if message ~= nil and message ~= '' then
local runner = M.get_current_index()
if runner ~= current_id then
tmux.exe('last-'.. runner_type)
end
end
return ''
local runner_type = config.user_opts.runner_type
local query = config.get("runner_query")[runner_type]
if query == nil or query == "" then
if config.get("use_nearest") then
return M.get_nearest_runner()
else
return ""
end
end
local current_id = M.get_current_index()
local message = tmux.exe({ "select-" .. runner_type, "-t", query })
if message ~= nil and message ~= "" then
local runner = M.get_current_index()
if runner ~= current_id then
tmux.exe("last-" .. runner_type)
end
end
return ""
end
M.get_current_index = function()
local runner_type = config.user_opts.runner_type
if runner_type == 'pane' then
return M.get_pane_id()
else
return M.get_window_id()
end
local runner_type = config.user_opts.runner_type
if runner_type == "pane" then
return M.get_pane_id()
else
return M.get_window_id()
end
end
M.get_pane_id = function()
return tmux.get_property("#{pane_id}")
return tmux.get_property("#{pane_id}")
end
M.get_window_id = function()
return tmux.get_property("#{window_id}")
return tmux.get_property("#{window_id}")
end
M.get_session = function()
return tmux.get_property("#S")
return tmux.get_property("#S")
end
M.get_pane_options = function()
local height = config.get('height')
local orientation = config.get('orientation')
return '-p '..height..' -'..orientation
local height = config.get("height")
local orientation = config.get("orientation")
return { "-p", height, "-" .. orientation }
end
M.select = function()
if M.runner_index ~= nil then
local runner_type = config.user_opts.runner_type
tmux.exe('select-'..runner_type .. ' -t '.. M.runner_index)
end
if M.runner_index ~= nil then
local runner_type = config.user_opts.runner_type
tmux.exe({ "select-" .. runner_type, "-t", M.runner_index })
end
end
M.clear_history = function()
if M.runner_index ~= nil then
tmux.exe('clear-history -t '.. M.runner_index)
end
if M.runner_index ~= nil then
tmux.exe({ "clear-history", "-t", M.runner_index })
end
end
M.copy_mode = function(type)
if M.runner_index ~= nil then
tmux.exec('copy-mode')
end
if M.runner_index ~= nil then
tmux.exec("copy-mode")
end
end
M.last = function(type)
local runner_type = type or config.user_opts.runner_type
tmux.exec('last-' .. runner_type)
local runner_type = type or config.user_opts.runner_type
tmux.exe("last-" .. runner_type)
end
M.send_keys = function(keys)
if M.runner_index ~= nil then
tmux.send_keys(keys)
end
if M.runner_index ~= nil then
tmux.send_keys(M.runner_index, keys)
end
end
M.send_text = function(text)
M.send_keys(vim.fn.shellescape(text))
M.send_keys(string.gsub(text, "[\n]*$", ""))
end
M.zoom = function()
local runner_type = config.user_opts.runner_type
if runner_type == 'pane' then
tmux.exe('resize-pane -Z -t '.. M.runner_index)
else
tmux.exe('select-'.. runner_type..' -t ' .. runner_type)
end
end
M.close = function ()
local runner_type = config.get('runner_type')
tmux.exe('kill-'..runner_type..' -t '.. M.runner_index)
end
M.runner_exists = function ()
return M.runner_index ~= nil
end
M.toggle = function ()
if tmux.runner_exists() then
return
end
local runner_type = config.user_opts.runner_type
if runner_type == 'pane' then
M.runner_index = tmux.exe('break-pane -d -s '..M.runner_index.." -P -F '#{window_id}'")
M.user_opts.runner_type = 'window'
else
tmux.exe('join-pane -s '..M.runner_index..' '..M.get_pane_options())
M.user_opts.runner_type = 'pane'
M.runner_index = M.get_current_index()
M.last()
end
local runner_type = config.user_opts.runner_type
if runner_type == "pane" then
tmux.exe({ "resize-pane", "-Z", "-t", M.runner_index })
else
tmux.exe({ "select-" .. runner_type, "-t", runner_type })
end
end
M.close = function()
local runner_type = config.get("runner_type")
tmux.exe({ "kill-" .. runner_type, "-t", M.runner_index })
end
M.runner_exists = function()
if M.runner_index == nil then
return false
end
if tmux.get_property("#{pane_id}", M.runner_index) == M.runner_index then
return true
end
return false
end
M.reset_runner = function()
if M.runner_index then
local mode = tmux.get_property("#{pane_mode}", M.runner_index)
local reset_sequences = config.get("reset_mode_sequence")
if reset_sequences[mode] ~= nil then
tmux.send_keys(M.runner_index, reset_sequences[mode])
end
local cmd_reset_sequence = config.get("reset_cmdline_sequence")
if cmd_reset_sequence ~= nil then
tmux.send_keys(M.runner_index, cmd_reset_sequence)
end
end
end
M.toggle = function()
if tmux.runner_exists() then
return
end
local runner_type = config.user_opts.runner_type
if runner_type == "pane" then
M.runner_index = tmux.exe({ "break-pane", "-d", "-s", M.runner_index, "-P", "-F", "'#{window_id}'" })
M.user_opts.runner_type = "window"
else
tmux.exe({ "join-pane", "-s", M.runner_index, M.get_pane_options() })
M.user_opts.runner_type = "pane"
M.runner_index = M.get_current_index()
M.last()
end
end
M.open = function()
local existing_id = M.get_existing_runner_id()
if existing_id ~= '' then
M.runner_index = existing_id
else
local extra_args = config.get('open_extra_args')
local runner_type = config.user_opts.runner_type
if runner_type == 'pane' then
tmux.exe('split-window '..M.get_pane_options()..' '..extra_args)
else
tmux.exe('new-window '..extra_args)
local existing_id = M.get_existing_runner_id()
if existing_id ~= "" then
M.runner_index = existing_id
else
local extra_args = config.get("open_extra_args")
local runner_type = config.user_opts.runner_type
if runner_type == "pane" then
tmux.exe({ "split-window", M.get_pane_options(), extra_args })
else
tmux.exe({ "new-window", extra_args })
end
M.runner_index = M.get_current_index()
M.set_runner_name()
M.last()
end
end
M.expand_command = function(command)
if config.get("expand_command") then
local expanded_command = {}
for value in string.gmatch(command, "%S+") do
table.insert(expanded_command, vim.fn.expand(value))
end
command = ""
for _, v in ipairs(expanded_command) do
command = command .. " " .. v
end
M.runner_index = M.get_current_index()
M.set_runner_name()
M.last()
end
return command
end
M.run = function
return M

@ -1,113 +0,0 @@
if exists('g:loaded_vimux') || &compatible
finish
endif
let g:loaded_vimux = 1
" Set up all global options with defaults right away, in one place
let g:VimuxDebug = get(g:, 'VimuxDebug', v:false)
let g:VimuxHeight = get(g:, 'VimuxHeight', 20)
let g:VimuxOpenExtraArgs = get(g:, 'VimuxOpenExtraArgs', '')
let g:VimuxOrientation = get(g:, 'VimuxOrientation', 'v')
let g:VimuxPromptString = get(g:, 'VimuxPromptString', 'Command? ')
let g:VimuxResetSequence = get(g:, 'VimuxResetSequence', 'q C-u')
let g:VimuxRunnerName = get(g:, 'VimuxRunnerName', '')
let g:VimuxRunnerType = get(g:, 'VimuxRunnerType', 'pane')
let g:VimuxRunnerQuery = get(g:, 'VimuxRunnerQuery', {})
let g:VimuxTmuxCommand = get(g:, 'VimuxTmuxCommand', 'tmux')
let g:VimuxUseNearest = get(g:, 'VimuxUseNearest', v:true)
let g:VimuxExpandCommand = get(g:, 'VimuxExpandCommand', v:false)
let g:VimuxCloseOnExit = get(g:, 'VimuxCloseOnExit', v:false)
let g:VimuxCommandShell = get(g:, 'VimuxCommandShell', v:true)
function! VimuxOption(name) abort
return get(b:, a:name, get(g:, a:name))
endfunction
if !executable(VimuxOption('VimuxTmuxCommand'))
echohl ErrorMsg | echomsg 'Failed to find executable '.VimuxOption('VimuxTmuxCommand') | echohl None
finish
endif
command -nargs=* VimuxRunCommand :call VimuxRunCommand(<args>)
command -bar VimuxRunLastCommand :call VimuxRunLastCommand()
command -bar VimuxOpenRunner :call VimuxOpenRunner()
command -bar VimuxCloseRunner :call VimuxCloseRunner()
command -bar VimuxZoomRunner :call VimuxZoomRunner()
command -bar VimuxInspectRunner :call VimuxInspectRunner()
command -bar VimuxScrollUpInspect :call VimuxScrollUpInspect()
command -bar VimuxScrollDownInspect :call VimuxScrollDownInspect()
command -bar VimuxInterruptRunner :call VimuxInterruptRunner()
command -nargs=? VimuxPromptCommand :call VimuxPromptCommand(<args>)
command -bar VimuxClearTerminalScreen :call VimuxClearTerminalScreen()
command -bar VimuxClearRunnerHistory :call VimuxClearRunnerHistory()
command -bar VimuxTogglePane :call VimuxTogglePane()
augroup VimuxAutocmds
au!
autocmd VimLeave * call s:autoclose()
augroup END
function! VimuxRunCommandInDir(command, useFile) abort
let l:file = ''
if a:useFile ==# 1
let l:file = shellescape(expand('%:t'), 1)
endif
call VimuxRunCommand('(cd '.shellescape(expand('%:p:h'), 1).' && '.a:command.' '.l:file.')')
endfunction
function! VimuxRunLastCommand() abort
if exists('g:VimuxLastCommand')
call VimuxRunCommand(g:VimuxLastCommand)
else
echo 'No last vimux command.'
endif
endfunction
function! VimuxRunCommand(command, ...) abort
if !exists('g:VimuxRunnerIndex') || s:hasRunner(g:VimuxRunnerIndex) ==# -1
call VimuxOpenRunner()
endif
let l:autoreturn = 1
if exists('a:1')
let l:autoreturn = a:1
endif
let resetSequence = VimuxOption('VimuxResetSequence')
let g:VimuxLastCommand = a:command
call VimuxSendKeys(resetSequence)
call VimuxSendText(a:command)
if l:autoreturn ==# 1
call VimuxSendKeys('Enter')
endif
endfunction
function! VimuxOpenRunner() abort
let existingId = s:existingRunnerId()
if existingId !=# ''
let g:VimuxRunnerIndex = existingId
else
let extraArguments = VimuxOption('VimuxOpenExtraArgs')
if VimuxOption('VimuxRunnerType') ==# 'pane'
call VimuxTmux('split-window '.s:vimuxPaneOptions().' '.extraArguments)
elseif VimuxOption('VimuxRunnerType') ==# 'window'
call VimuxTmux('new-window '.extraArguments)
endif
let g:VimuxRunnerIndex = s:tmuxIndex()
call s:setRunnerName()
call VimuxTmux('last-'.VimuxOption('VimuxRunnerType'))
endif
endfunction
""
" @return a string of the form '%4', the ID of the pane or window to use,
" or '' if no nearest pane or window is found.
function! s:autoclose() abort
if VimuxOption('VimuxCloseOnExit')
call VimuxCloseRunner()
endif
endfunction

@ -0,0 +1,7 @@
env \
TEST_PLUGIN=$(pwd) \
XDG_CONFIG_HOME=$(pwd)/test/config \
XDG_DATA_HOME=$(pwd)/test/data \
XDG_RUNTIME_DIR=$(pwd)/test/runtime \
XDG_STATE_HOME=$(pwd)/test/state \
nvim

3
test/.gitignore vendored

@ -0,0 +1,3 @@
data/nvim/lazy/
state/nvim/lazy/
config/nvim/lazy-lock.json

@ -0,0 +1,38 @@
-- ~/.dotfiles/base/config/nvim/lua/plugins.lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- Only move on if we can require Packer.
local ok, lazy = pcall(require, "lazy")
if not ok then
print('lazy.nvim could not be laaded')
return
end
lazy.setup({
{
dir=vim.env.TEST_PLUGIN,
config=true
},
{
'numToStr/Navigator.nvim',
config=true
},
})
vim.keymap.set('n', "<C-h>", require('Navigator').left)
vim.keymap.set('n', "<C-k>", require('Navigator').up)
vim.keymap.set('n', "<C-l>", require('Navigator').right)
vim.keymap.set('n', "<C-j>", require('Navigator').down)
vim.keymap.set('n', "<C-p>", require('Navigator').previous)

Binary file not shown.
Loading…
Cancel
Save