try and make everything confined to 80chars
This commit is contained in:
9
init.lua
9
init.lua
@ -9,7 +9,8 @@ end
|
||||
-- bootstrap plugin manager
|
||||
local path = vim.fn.stdpath("data").."/site/pack/deps/opt/dep"
|
||||
if vim.fn.empty(vim.fn.glob(path)) > 0 then
|
||||
vim.fn.system({ "git", "clone", "--depth=1", "https://git.squi.bid/dep", path })
|
||||
vim.fn.system({ "git", "clone", "--depth=1", "https://git.squi.bid/dep",
|
||||
path })
|
||||
end
|
||||
vim.cmd("packadd dep")
|
||||
|
||||
@ -32,8 +33,10 @@ require("dep") {
|
||||
-- aquire all plugin specs
|
||||
local plugs = {}
|
||||
|
||||
for _, file in ipairs(vim.api.nvim_get_runtime_file("lua/conf/plugins/*.lua", true)) do
|
||||
local ret = misc.include("conf.plugins."..file:gsub("^.*/", ""):gsub("%.lua$", ""))
|
||||
for _, file in ipairs(vim.api.nvim_get_runtime_file(
|
||||
"lua/conf/plugins/*.lua", true)) do
|
||||
local ret = misc.include("conf.plugins."..file:gsub("^.*/",
|
||||
""):gsub("%.lua$", ""))
|
||||
if type(ret) ~= "boolean" then
|
||||
plugs[#plugs + 1] = ret
|
||||
end
|
||||
|
@ -24,14 +24,22 @@ map("n", "<leader>x", function() -- execute order 111
|
||||
if vim.fn.getftype(fn) == "file" then
|
||||
local perm = vim.fn.getfperm(fn)
|
||||
if string.match(perm, "x", 3) then
|
||||
vim.notify("Removed executable flags", vim.log.levels.INFO, { title = misc.appid })
|
||||
vim.fn.setfperm(fn, string.sub(fn, 1, 2).."-"..string.sub(fn, 4, 5).."-"..string.sub(fn, 7, 8).."-")
|
||||
vim.notify("Removed executable flags", vim.log.levels.INFO, {
|
||||
title = misc.appid
|
||||
})
|
||||
vim.fn.setfperm(fn, string.sub(fn, 1, 2).."-"..string.sub(fn, 4, 5).."-"
|
||||
..string.sub(fn, 7, 8).."-")
|
||||
else
|
||||
vim.notify("Add executable flags", vim.log.levels.INFO, { title = misc.appid })
|
||||
vim.fn.setfperm(fn, string.sub(fn, 1, 2).."x"..string.sub(fn, 4, 5).."x"..string.sub(fn, 7, 8).."x")
|
||||
vim.notify("Add executable flags", vim.log.levels.INFO, {
|
||||
title = misc.appid
|
||||
})
|
||||
vim.fn.setfperm(fn, string.sub(fn, 1, 2).."x"..string.sub(fn, 4, 5).."x"
|
||||
..string.sub(fn, 7, 8).."x")
|
||||
end
|
||||
else
|
||||
vim.notify("File doesn't exist", vim.log.levels.INFO, { title = misc.appid })
|
||||
vim.notify("File doesn't exist", vim.log.levels.INFO, {
|
||||
title = misc.appid
|
||||
})
|
||||
end
|
||||
end, { desc = "toggle executable flag of the file" })
|
||||
|
||||
@ -50,7 +58,8 @@ vim.keymap.set("n", "z=", function()
|
||||
end
|
||||
local cword = vim.fn.expand("<cword>")
|
||||
local prompt = "Change "..vim.inspect(cword).." to:"
|
||||
vim.ui.select(vim.fn.spellsuggest(cword, vim.o.lines), { prompt = prompt }, spell_on_choice)
|
||||
vim.ui.select(vim.fn.spellsuggest(cword, vim.o.lines), { prompt = prompt },
|
||||
spell_on_choice)
|
||||
end, { desc = "Shows spelling suggestions" })
|
||||
|
||||
-- quickfix
|
||||
|
@ -13,9 +13,8 @@ return { "ThePrimeagen/harpoon",
|
||||
|
||||
map("n", "<leader>a", function()
|
||||
harpoon:list():add()
|
||||
vim.notify("added "..vim.fn.expand("%:t").." to quickmarks", vim.log.levels.INFO, {
|
||||
title = misc.appid
|
||||
})
|
||||
vim.notify("added "..vim.fn.expand("%:t").." to quickmarks",
|
||||
vim.log.levels.INFO, { title = misc.appid })
|
||||
end, { desc = "add current file to quickmarks" })
|
||||
|
||||
map("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
|
||||
|
@ -56,7 +56,8 @@ return { "L3MON4D3/LuaSnip",
|
||||
end)
|
||||
|
||||
-- load all snippets from snippet directory
|
||||
for _, file in ipairs(vim.api.nvim_get_runtime_file("lua/snippets/*.lua", true)) do
|
||||
for _, file in ipairs(vim.api.nvim_get_runtime_file("lua/snippets/*.lua",
|
||||
true)) do
|
||||
local fn = file:gsub("^.*/", ""):gsub("%.lua$", "")
|
||||
local ret = misc.include("snippets."..fn)
|
||||
if type(ret) ~= "boolean" then
|
||||
|
@ -6,7 +6,8 @@ local function parse_output(proc)
|
||||
local result = proc:wait()
|
||||
local ret = {}
|
||||
if result.code == 0 then
|
||||
for line in vim.gsplit(result.stdout, "\n", { plain = true, trimempty = true }) do
|
||||
for line in vim.gsplit(result.stdout, "\n", {
|
||||
plain = true, trimempty = true }) do
|
||||
-- Remove trailing slash
|
||||
line = line:gsub("/$", "")
|
||||
ret[line] = true
|
||||
@ -20,16 +21,20 @@ local function new_git_status()
|
||||
return setmetatable({}, {
|
||||
__index = function(self, key)
|
||||
local ignore_proc = vim.system(
|
||||
{ "git", "ls-files", "--ignored", "--exclude-standard", "--others", "--directory" },
|
||||
{ "git", "ls-files", "--ignored", "--exclude-standard", "--others",
|
||||
"--directory" },
|
||||
{
|
||||
cwd = key,
|
||||
text = true,
|
||||
}
|
||||
)
|
||||
local tracked_proc = vim.system({ "git", "ls-tree", "HEAD", "--name-only" }, {
|
||||
local tracked_proc = vim.system({ "git", "ls-tree", "HEAD",
|
||||
"--name-only" },
|
||||
{
|
||||
cwd = key,
|
||||
text = true,
|
||||
})
|
||||
}
|
||||
)
|
||||
local ret = {
|
||||
ignored = parse_output(ignore_proc),
|
||||
tracked = parse_output(tracked_proc),
|
||||
|
@ -48,7 +48,8 @@ return { "nvim-treesitter/nvim-treesitter",
|
||||
|
||||
-- disable in big files
|
||||
-- TODO: update before nvim 1.0 when vim.loop is removed
|
||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
local ok, stats = pcall(vim.loop.fs_stat,
|
||||
vim.api.nvim_buf_get_name(buf))
|
||||
if ok and stats and stats.size > (1024 * 100 * 10) --[[1MB]] then
|
||||
return true
|
||||
end
|
||||
|
Reference in New Issue
Block a user