feat(ansible): install tmux/mc/git/nvim with laptop dotfiles
This commit is contained in:
25
ansible/files/operator-dotfiles/nvim/lua/utils.lua
Normal file
25
ansible/files/operator-dotfiles/nvim/lua/utils.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
-- ======================================================================
|
||||
-- utils.lua — Helper functions
|
||||
-- ======================================================================
|
||||
|
||||
local M = {}
|
||||
|
||||
-- Show filename aligned to the right
|
||||
function M.show_filename_right()
|
||||
local filename = vim.fn.expand("%:p")
|
||||
local columns = vim.o.columns
|
||||
local space = columns - #filename - 2
|
||||
if space < 0 then space = 0 end
|
||||
vim.api.nvim_echo({{string.rep(" ", space) .. filename, "None"}}, false, {})
|
||||
end
|
||||
|
||||
-- Send cell to slime (delimited by pattern, e.g., "^#%%")
|
||||
function M.send_cell(pattern)
|
||||
local start_line = vim.fn.search(pattern, "bnW")
|
||||
if start_line ~= 0 then start_line = start_line + 1 else start_line = 1 end
|
||||
local stop_line = vim.fn.search(pattern, "nW")
|
||||
if stop_line ~= 0 then stop_line = stop_line - 1 else stop_line = vim.fn.line("$") end
|
||||
vim.fn["slime#send_range"](start_line, stop_line)
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user