Update home/.config/lvim/lua/user/functions.lua
Update home/.config/lvim/lua/user/keybindings.lua Update home/.config/lvim/lua/user/luasnip-helper-funcs.lua Update home/.config/lvim/lua/user/plugins.lua Update home/.config/lvim/lua/user/whichkey.lua
This commit is contained in:
parent
33a166cf01
commit
3fab56646f
@ -8,26 +8,59 @@ Last Modified By : Jeff Lance <email@jefflance.me>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- function Surround(w_or_W)
|
local M = {}
|
||||||
-- local open_char = vim.fn.input("Surround with: ")
|
|
||||||
-- local closed_char = nil
|
|
||||||
-- if open_char == "(" then closed_char = ")" end
|
|
||||||
-- if open_char == "[" then closed_char = "]" end
|
|
||||||
-- if open_char == "{" then closed_char = "}" end
|
|
||||||
-- if open_char == "<" then closed_char = ">" end
|
|
||||||
-- if open_char == "'" then closed_char = "'" end
|
|
||||||
-- if open_char == '"' then closed_char = '"' end
|
|
||||||
-- if open_char == "`" then closed_char = "`" end
|
|
||||||
-- if open_char == "/" then closed_char = "/" end
|
|
||||||
-- if open_char == "|" then closed_char = "|" end
|
|
||||||
|
|
||||||
-- if w_or_W == "w" then
|
--- Get current buffer size
|
||||||
-- vim.cmd("normal! ciw" .. open_char)
|
---@return {width: number, height: number}
|
||||||
-- elseif w_or_W == "W" then
|
local function get_buf_size()
|
||||||
-- vim.cmd([[normal! ciW]] .. open_char)
|
local cbuf = vim.api.nvim_get_current_buf()
|
||||||
-- end
|
local bufinfo = vim.tbl_filter(function(buf)
|
||||||
-- vim.cmd("normal! p")
|
return buf.bufnr == cbuf
|
||||||
-- vim.cmd("normal! a" .. closed_char)
|
end, vim.fn.getwininfo(vim.api.nvim_get_current_win()))[1]
|
||||||
-- vim.cmd("normal! a")
|
if bufinfo == nil then
|
||||||
-- end
|
return { width = -1, height = -1 }
|
||||||
|
end
|
||||||
|
return { width = bufinfo.width, height = bufinfo.height }
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get the dynamic terminal size in cells
|
||||||
|
---@param direction string
|
||||||
|
---@param size number
|
||||||
|
---@return integer
|
||||||
|
local function get_dynamic_terminal_size(direction, size)
|
||||||
|
size = size or lvim.builtin.terminal.size
|
||||||
|
if direction ~= "float" and tostring(size):find(".", 1, true) then
|
||||||
|
size = math.min(size, 1.0)
|
||||||
|
local buf_sizes = get_buf_size()
|
||||||
|
local buf_size = direction == "horizontal" and buf_sizes.height or buf_sizes.width
|
||||||
|
return buf_size * size
|
||||||
|
else
|
||||||
|
return size
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.xplr_toggle = function()
|
||||||
|
local Terminal = require("toggleterm.terminal").Terminal
|
||||||
|
local direction = "float"
|
||||||
|
|
||||||
|
local xplr = Terminal:new {
|
||||||
|
cmd = "ranger",
|
||||||
|
hidden = true,
|
||||||
|
direction = direction,
|
||||||
|
-- size = 20 | function()
|
||||||
|
-- return get_dynamic_terminal_size("float", 0.8)
|
||||||
|
-- end,
|
||||||
|
float_opts = {
|
||||||
|
border = "curved",
|
||||||
|
},
|
||||||
|
on_open = function(_)
|
||||||
|
vim.cmd "startinsert!"
|
||||||
|
end,
|
||||||
|
on_close = function(_) end,
|
||||||
|
count = 200,
|
||||||
|
}
|
||||||
|
xplr:toggle()
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
||||||
|
@ -12,11 +12,11 @@ local M = {}
|
|||||||
|
|
||||||
M.setup = function()
|
M.setup = function()
|
||||||
-- ============
|
-- ============
|
||||||
-- key mappings
|
-- key mappings examples using nvim or lvim api.
|
||||||
--
|
--
|
||||||
-- vim-surround shortcuts as example
|
|
||||||
-- vim.api.nvim_set_keymap("n", "sw", "<Plug>Ysurroundiw", { noremap = true, silent = true })
|
-- vim.api.nvim_set_keymap("n", "sw", "<Plug>Ysurroundiw", { noremap = true, silent = true })
|
||||||
-- vim.api.nvim_set_keymap("n", "Sw", "<Plug>YSurroundiw", { noremap = true, silent = true })
|
-- vim.api.nvim_set_keymap("n", "Sw", "<Plug>YSurroundiw", { noremap = true, silent = true })
|
||||||
|
-- lvim.keys.normal_mode["<C-t>"] = ":FloatermToggle terminal<CR>"
|
||||||
--
|
--
|
||||||
|
|
||||||
lvim.leader = ";"
|
lvim.leader = ";"
|
||||||
@ -28,7 +28,6 @@ M.setup = function()
|
|||||||
lvim.keys.normal_mode["<C-r>"] = "<CMD>redo<CR>"
|
lvim.keys.normal_mode["<C-r>"] = "<CMD>redo<CR>"
|
||||||
lvim.keys.normal_mode["<C-[>"] = ":<<CR>"
|
lvim.keys.normal_mode["<C-[>"] = ":<<CR>"
|
||||||
lvim.keys.normal_mode["<C-]>"] = ":><CR>"
|
lvim.keys.normal_mode["<C-]>"] = ":><CR>"
|
||||||
lvim.keys.normal_mode["<C-t>"] = ":FloatermNew --name=term --width=0.8"
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -89,15 +89,15 @@ Last Modified By : Jeff Lance <email@jefflance.me>
|
|||||||
-- local rows = tonumber(snip.captures[2])
|
-- local rows = tonumber(snip.captures[2])
|
||||||
-- local cols = tonumber(snip.captures[3])
|
-- local cols = tonumber(snip.captures[3])
|
||||||
-- local nodes = {}
|
-- local nodes = {}
|
||||||
-- local ins_indx = 1
|
-- local ins_indx = 1
|
||||||
-- for j = 1, rows do
|
-- for j = 1, rows do
|
||||||
-- table.insert(nodes, r(ins_indx, tostring(j) .. "x1", i(1)))
|
-- table.insert(nodes, r(ins_indx, tostring(j) .. "x1", i(1)))
|
||||||
-- ins_indx = ins_indx + 1
|
-- ins_indx = ins_indx + 1
|
||||||
-- for k = 2, cols do
|
-- for k = 2, cols do
|
||||||
-- table.insert(nodes, t(" & "))
|
-- table.insert(nodes, t(" & "))
|
||||||
-- table.insert(nodes, r(ins_indx, tostring(j) .. "x" .. tostring(k), i(1)))
|
-- table.insert(nodes, r(ins_indx, tostring(j) .. "x" .. tostring(k), i(1)))
|
||||||
-- ins_indx = ins_indx + 1
|
-- ins_indx = ins_indx + 1
|
||||||
-- end
|
-- end
|
||||||
-- table.insert(nodes, t({ " \\\\", "" }))
|
-- table.insert(nodes, t({ " \\\\", "" }))
|
||||||
-- end
|
-- end
|
||||||
-- -- fix last node.
|
-- -- fix last node.
|
||||||
|
@ -274,6 +274,7 @@ M.setup = function()
|
|||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
-- rnvimr
|
||||||
{
|
{
|
||||||
"kevinhwang91/rnvimr",
|
"kevinhwang91/rnvimr",
|
||||||
cmd = "RnvimrToggle",
|
cmd = "RnvimrToggle",
|
||||||
@ -284,9 +285,9 @@ M.setup = function()
|
|||||||
let g:rnvimr_edit_cmd = 'drop'
|
let g:rnvimr_edit_cmd = 'drop'
|
||||||
let g:rnvimr_draw_border = 1
|
let g:rnvimr_draw_border = 1
|
||||||
let g:rnvimr_hide_gitignore = 1
|
let g:rnvimr_hide_gitignore = 1
|
||||||
let g:rnvimr_border_attr = {'fg': 14, 'bg': -1}
|
" let g:rnvimr_border_attr = {'fg': 14, 'bg': 0}
|
||||||
let g:rnvimr_enable_bw = 1
|
let g:rnvimr_enable_bw = 1
|
||||||
let g:rnvimr_shadow_winblend = 70
|
" let g:rnvimr_shadow_winblend = 70
|
||||||
let g:rnvimr_ranger_cmd = ['ranger', '--cmd=set draw_borders both']
|
let g:rnvimr_ranger_cmd = ['ranger', '--cmd=set draw_borders both']
|
||||||
]])
|
]])
|
||||||
end,
|
end,
|
||||||
|
@ -34,7 +34,7 @@ M.setup = function()
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- remap neo-tree shortcut to rnvimr
|
-- remap neo-tree shortcut to rnvimr
|
||||||
lvim.builtin.which_key.mappings["e"] = { "<CMD>RnvimrToggle<CR>", "File explorer" }
|
-- lvim.builtin.which_key.mappings["e"] = { "<CMD>RnvimrToggle<CR>", "File explorer" }
|
||||||
|
|
||||||
-- remap dashboard
|
-- remap dashboard
|
||||||
lvim.builtin.which_key.mappings["d"] = lvim.builtin.which_key.mappings[";"]
|
lvim.builtin.which_key.mappings["d"] = lvim.builtin.which_key.mappings[";"]
|
||||||
@ -99,6 +99,8 @@ M.setup = function()
|
|||||||
lvim.builtin.which_key.mappings["x"] = { "<CMD>w! <BAR> q!<CR>", "Save and quit" }
|
lvim.builtin.which_key.mappings["x"] = { "<CMD>w! <BAR> q!<CR>", "Save and quit" }
|
||||||
|
|
||||||
lvim.builtin.which_key.mappings[";"] = {}
|
lvim.builtin.which_key.mappings[";"] = {}
|
||||||
|
-- lvim.builtin.which_key.mappings["e"] = { ":lua require('user.functions').xplr_toggle()<CR>", "File manager" }
|
||||||
|
lvim.builtin.which_key.mappings["e"] = { ":RnvimrToggle<CR>", "File manager" }
|
||||||
lvim.builtin.terminal.open_mapping = "<C-t>"
|
lvim.builtin.terminal.open_mapping = "<C-t>"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user