fomratter does lua now
This commit is contained in:
@@ -1,37 +1,37 @@
|
||||
local lsp_zero = require('lsp-zero')
|
||||
local lsp_zero = require("lsp-zero")
|
||||
lsp_zero.on_attach(function(client, bufnr)
|
||||
lsp_zero.default_keymaps({buffer = bufnr})
|
||||
lsp_zero.default_keymaps({ buffer = bufnr })
|
||||
end)
|
||||
|
||||
local cmp = require('cmp')
|
||||
local cmp_format = lsp_zero.cmp_format({details = true})
|
||||
local cmp = require("cmp")
|
||||
local cmp_format = lsp_zero.cmp_format({ details = true })
|
||||
local cmp_action = lsp_zero.cmp_action()
|
||||
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
cmp.setup({
|
||||
sources = {
|
||||
{name = 'nvim_lsp'},
|
||||
{ name = "nvim_lsp" },
|
||||
{
|
||||
name = 'buffer',
|
||||
name = "buffer",
|
||||
option = {
|
||||
get_bufnrs = function()
|
||||
return vim.api.nvim_list_bufs()
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
{name = 'luasnip'},
|
||||
{name = 'vimtex'},
|
||||
{ name = "luasnip" },
|
||||
{ name = "vimtex" },
|
||||
},
|
||||
formatting = cmp_format,
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
-- ['<Tab>'] = cmp_action.tab_complete(),
|
||||
-- ['<S-Tab>'] = cmp_action.select_prev_or_fallback(),
|
||||
['<Tab>'] = cmp_action.luasnip_supertab(),
|
||||
['<S-Tab>'] = cmp_action.luasnip_shift_supertab(),
|
||||
['<C-f>'] = cmp_action.luasnip_jump_forward(),
|
||||
['<C-b>'] = cmp_action.luasnip_jump_backward(),
|
||||
['<CR>'] = cmp.mapping.confirm({select = false}),
|
||||
["<Tab>"] = cmp_action.luasnip_supertab(),
|
||||
["<S-Tab>"] = cmp_action.luasnip_shift_supertab(),
|
||||
["<C-f>"] = cmp_action.luasnip_jump_forward(),
|
||||
["<C-b>"] = cmp_action.luasnip_jump_backward(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
}),
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
@@ -39,11 +39,9 @@ cmp.setup({
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
}
|
||||
},
|
||||
})
|
||||
require'lspconfig'.nil_ls.setup{}
|
||||
require'lspconfig'.pyright.setup{}
|
||||
|
||||
|
||||
require("lspconfig").nil_ls.setup({})
|
||||
require("lspconfig").pyright.setup({})
|
||||
|
||||
@@ -12,12 +12,12 @@ local function parrot_status()
|
||||
return string.format("%s(%s)", status, status_info.model)
|
||||
end
|
||||
|
||||
require('lualine').setup({
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
globalstatus = true,
|
||||
ignore_focus = { "vimtex-toc", }
|
||||
ignore_focus = { "vimtex-toc" },
|
||||
},
|
||||
extensions = {"fugitive", "overseer"},
|
||||
extensions = { "fugitive", "overseer" },
|
||||
sections = {
|
||||
lualine_c = {
|
||||
"filename",
|
||||
@@ -26,13 +26,12 @@ require('lualine').setup({
|
||||
icons_enabled = false,
|
||||
},
|
||||
require("nomodoro").status,
|
||||
parrot_status
|
||||
parrot_status,
|
||||
},
|
||||
lualine_x = {
|
||||
"encoding",
|
||||
{"fileformat", icons_enabled = false},
|
||||
"filetype"
|
||||
}
|
||||
}
|
||||
{ "fileformat", icons_enabled = false },
|
||||
"filetype",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -29,10 +29,8 @@ require("overseer").setup({
|
||||
["<C-j>"] = "ScrollOutputDown",
|
||||
["q"] = "Close",
|
||||
},
|
||||
}
|
||||
},
|
||||
})
|
||||
-- set keymap for commands
|
||||
vim.api.nvim_set_keymap('n', '<leader>oo', '<cmd>OverseerToggle<CR>', { noremap = true})
|
||||
vim.api.nvim_set_keymap('n', '<leader>or', '<cmd>OverseerRun<CR>', { noremap = true})
|
||||
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<leader>oo", "<cmd>OverseerToggle<CR>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "<leader>or", "<cmd>OverseerRun<CR>", { noremap = true })
|
||||
|
||||
@@ -27,20 +27,28 @@ local cwdProject = {
|
||||
},
|
||||
}
|
||||
|
||||
require('spaceport').setup({
|
||||
require("spaceport").setup({
|
||||
sections = {
|
||||
"_global_remaps",
|
||||
"name_blue_green",
|
||||
"remaps",
|
||||
cwdProject,
|
||||
"recents",
|
||||
}
|
||||
},
|
||||
})
|
||||
-- TODO do I really actually use the telescope spaceport extensions?
|
||||
require('telescope').load_extension('spaceport')
|
||||
require("telescope").load_extension("spaceport")
|
||||
-- spaceport breaks a bit if whitespace visible
|
||||
-- set up autocmd to set and unset vim.opt.list as needed
|
||||
vim.api.nvim_create_autocmd("User", { pattern = "SpaceportEnter", callback = function(ev) vim.opt.list = false end})
|
||||
vim.api.nvim_create_autocmd("User", { pattern = "SpaceportDone", callback = function(ev) vim.opt.list = true end})
|
||||
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "SpaceportEnter",
|
||||
callback = function(ev)
|
||||
vim.opt.list = false
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "SpaceportDone",
|
||||
callback = function(ev)
|
||||
vim.opt.list = true
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -1,75 +1,75 @@
|
||||
vim.g.wiki_root = "/home/deepak/wiki"
|
||||
|
||||
local function find_wiki_path_for_file(filename)
|
||||
-- recursively search for the file name in the wiki_root using ripgrep
|
||||
local rg_result_pipe = assert(io.popen(string.format(
|
||||
"rg -g '%s' --files \"%s\"",
|
||||
filename,
|
||||
vim.g.wiki_root
|
||||
)))
|
||||
local rg_result = rg_result_pipe:read("*line")
|
||||
rg_result_pipe:close()
|
||||
-- recursively search for the file name in the wiki_root using ripgrep
|
||||
local rg_result_pipe = assert(io.popen(string.format("rg -g '%s' --files \"%s\"", filename, vim.g.wiki_root)))
|
||||
local rg_result = rg_result_pipe:read("*line")
|
||||
rg_result_pipe:close()
|
||||
|
||||
-- if ripgrep found a result, return that
|
||||
if rg_result then return rg_result end
|
||||
-- if ripgrep found a result, return that
|
||||
if rg_result then
|
||||
return rg_result
|
||||
end
|
||||
|
||||
-- if it didn't find a result, the file does not exist;
|
||||
-- in that case, the link will point to the (not yet existing)
|
||||
-- corresponding file in the wiki_root
|
||||
if vim.g.wiki_root:sub(-1) == "/" then
|
||||
return vim.g.wiki_root .. filename
|
||||
else
|
||||
return vim.g.wiki_root .. "/" .. filename
|
||||
end
|
||||
-- if it didn't find a result, the file does not exist;
|
||||
-- in that case, the link will point to the (not yet existing)
|
||||
-- corresponding file in the wiki_root
|
||||
if vim.g.wiki_root:sub(-1) == "/" then
|
||||
return vim.g.wiki_root .. filename
|
||||
else
|
||||
return vim.g.wiki_root .. "/" .. filename
|
||||
end
|
||||
end
|
||||
|
||||
local function resolve_wiki_link(url)
|
||||
local components = {}
|
||||
local components = {}
|
||||
|
||||
-- print(vim.inspect(url))
|
||||
-- print(vim.inspect(url))
|
||||
|
||||
for element in (url.stripped .. "#"):gmatch("([^#]*)#") do
|
||||
table.insert(components, element)
|
||||
end
|
||||
for element in (url.stripped .. "#"):gmatch("([^#]*)#") do
|
||||
table.insert(components, element)
|
||||
end
|
||||
|
||||
-- print(vim.inspect(components))
|
||||
-- print("spot A")
|
||||
-- print(vim.inspect(components))
|
||||
-- print("spot A")
|
||||
|
||||
local filename = components[1]
|
||||
url.anchor = components[2] or ""
|
||||
local filename = components[1]
|
||||
url.anchor = components[2] or ""
|
||||
|
||||
-- print("spot B")
|
||||
-- print("spot B")
|
||||
|
||||
-- infer the .md file extension
|
||||
if filename:sub(-3) ~= ".md" then filename = filename .. ".md" end
|
||||
-- infer the .md file extension
|
||||
if filename:sub(-3) ~= ".md" then
|
||||
filename = filename .. ".md"
|
||||
end
|
||||
|
||||
-- print("spot C")
|
||||
-- print(filename)
|
||||
if (url.origin:sub(1, #vim.g.wiki_root) == vim.g.wiki_root) or url.origin == '' then
|
||||
-- print("in the wiki root start block")
|
||||
--
|
||||
-- if the "origin" (the file that contains the link) is in the wiki_root,
|
||||
-- the wiki_root directory is recursively searched for the file name;
|
||||
--
|
||||
-- an empty origin, like you'd get from <leader>ww, is also mapped to this block
|
||||
url.path = find_wiki_path_for_file(filename)
|
||||
-- print("spot C")
|
||||
-- print(filename)
|
||||
if (url.origin:sub(1, #vim.g.wiki_root) == vim.g.wiki_root) or url.origin == "" then
|
||||
-- print("in the wiki root start block")
|
||||
--
|
||||
-- if the "origin" (the file that contains the link) is in the wiki_root,
|
||||
-- the wiki_root directory is recursively searched for the file name;
|
||||
--
|
||||
-- an empty origin, like you'd get from <leader>ww, is also mapped to this block
|
||||
url.path = find_wiki_path_for_file(filename)
|
||||
-- print("in the wiki root")
|
||||
else
|
||||
-- print("not in the wiki root start block")
|
||||
-- if the origin is not in the wiki_root,
|
||||
-- fall back to only looking in the same directory as the origin
|
||||
url.path = url.origin:match(".*/") .. filename
|
||||
-- print("not in the wiki root")
|
||||
end
|
||||
else
|
||||
-- print("not in the wiki root start block")
|
||||
-- if the origin is not in the wiki_root,
|
||||
-- fall back to only looking in the same directory as the origin
|
||||
url.path = url.origin:match(".*/") .. filename
|
||||
-- print("not in the wiki root")
|
||||
end
|
||||
|
||||
-- print(vim.inspect(url))
|
||||
|
||||
return url
|
||||
-- print(vim.inspect(url))
|
||||
|
||||
return url
|
||||
end
|
||||
|
||||
vim.g.wiki_link_schemes = {
|
||||
wiki = {
|
||||
resolver = resolve_wiki_link,
|
||||
-- handler = function(x) print(vim.inspect(x)) end,
|
||||
},
|
||||
wiki = {
|
||||
resolver = resolve_wiki_link,
|
||||
-- handler = function(x) print(vim.inspect(x)) end,
|
||||
},
|
||||
}
|
||||
|
||||
4
stylua.toml
Normal file
4
stylua.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
column_width = 120
|
||||
line_endings = "Unix"
|
||||
indent_type = "Tabs"
|
||||
indent_width = 4
|
||||
@@ -14,4 +14,7 @@
|
||||
programs.shellcheck.enable = true;
|
||||
programs.shfmt.enable = true;
|
||||
programs.yamlfmt.enable = true;
|
||||
programs.just.enable = true;
|
||||
|
||||
programs.stylua.enable = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user