summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--init.lua9
-rw-r--r--lua/conf/binds.lua21
-rw-r--r--lua/conf/plugins/harpoon.lua5
-rw-r--r--lua/conf/plugins/luasnip.lua3
-rw-r--r--lua/conf/plugins/oil.lua17
-rw-r--r--lua/conf/plugins/treesitter.lua3
6 files changed, 38 insertions, 20 deletions
diff --git a/init.lua b/init.lua
index 053698e..d89096a 100644
--- a/init.lua
+++ b/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
diff --git a/lua/conf/binds.lua b/lua/conf/binds.lua
index 9a9a7d6..6eb3519 100644
--- a/lua/conf/binds.lua
+++ b/lua/conf/binds.lua
@@ -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
diff --git a/lua/conf/plugins/harpoon.lua b/lua/conf/plugins/harpoon.lua
index b4b2330..5bb02d0 100644
--- a/lua/conf/plugins/harpoon.lua
+++ b/lua/conf/plugins/harpoon.lua
@@ -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)
diff --git a/lua/conf/plugins/luasnip.lua b/lua/conf/plugins/luasnip.lua
index 6a04ffd..7385af1 100644
--- a/lua/conf/plugins/luasnip.lua
+++ b/lua/conf/plugins/luasnip.lua
@@ -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
diff --git a/lua/conf/plugins/oil.lua b/lua/conf/plugins/oil.lua
index d985105..62f452b 100644
--- a/lua/conf/plugins/oil.lua
+++ b/lua/conf/plugins/oil.lua
@@ -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" },
{
cwd = key,
text = true,
}
)
- 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),
diff --git a/lua/conf/plugins/treesitter.lua b/lua/conf/plugins/treesitter.lua
index e473de4..4354953 100644
--- a/lua/conf/plugins/treesitter.lua
+++ b/lua/conf/plugins/treesitter.lua
@@ -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