vim.keymap.set("n", "<space>#", "Vgc", { desc = "select line and toggle comment", remap = true })
vim.keymap.set("v", "<space>#", "gc", { desc = "toggle comment of selected line", remap = true })
+-- window actions
+vim.keymap.set("n", "<space>s", function()
+ -- Define window configuration
+ local win_config = {
+ vertical = true,
+ width = math.floor(vim.o.columns * 0.4),
+ height = vim.o.lines
+ }
+ -- split window
+ vim.api.nvim_open_win(0, true, win_config)
+end, { desc = "split vertically and move to new window" })
+
-- move highlighted lines
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
-- vim.opt.termguicolors = false
vim.opt.scrolloff = 8
-vim.opt.signcolumn = "yes:1"
+vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50
local finder = finders.new_async_job {
command_generator = function(prompt)
if not prompt or prompt == "" then
- return nil
+ return nil
end
local pieces = vim.split(prompt, " ")
local args = { "rg" }
if pieces[1] then
- table.insert(args, "-e")
- table.insert(args, pieces[1])
+ table.insert(args, "-e")
+ table.insert(args, pieces[1])
end
if pieces[2] then
- table.insert(args, "-g")
- table.insert(args, pieces[2])
+ table.insert(args, "-g")
+ table.insert(args, pieces[2])
end
return vim.tbl_flatten {
- args,
- { "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case" },
+ args,
+ { "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case" },
}
end,
entry_maker = make_entry.gen_from_vimgrep(opts),
-- read history from disk
do
- function project(entry)
+ function Project(entry)
history[entry.path] = entry
end
-- tolerate missing history file
local function serialize()
local str = ""
for _, entry in pairs(history) do
- str = str .. "project { path = \"" .. entry.path .. "\" }\n"
+ str = str .. "Project { path = \"" .. entry.path .. "\" }\n"
end
return str