ref(nvim): stylua

This commit is contained in:
Léana 江 2024-02-17 12:00:05 +01:00 committed by Léana 江
parent f115a84799
commit 531862a6c4
20 changed files with 369 additions and 369 deletions

View file

@ -1,8 +1,8 @@
local Rule = require "nvim-autopairs.rule"
local cond = require "nvim-autopairs.conds"
local npairs = require "nvim-autopairs"
local cmp = require "cmp"
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
local Rule = require("nvim-autopairs.rule")
local cond = require("nvim-autopairs.conds")
local npairs = require("nvim-autopairs")
local cmp = require("cmp")
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
npairs.setup {
disable_filetype = { "fennel", "clojure", "lisp", "racket", "scheme" },
@ -11,8 +11,8 @@ npairs.setup {
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
for _, punct in pairs { ",", ";" } do
require "nvim-autopairs".add_rules {
require "nvim-autopairs.rule" ("", punct)
require("nvim-autopairs").add_rules {
require("nvim-autopairs.rule")("", punct)
:with_move(function(opts) return opts.char == punct end)
:with_pair(function() return false end)
:with_del(function() return false end)
@ -24,14 +24,13 @@ end
local function pair_with_insertion(a1, ins, a2, lang)
npairs.add_rule(
Rule(ins, ins, lang)
:with_pair(function(opts) return a1 .. a2 == opts.line:sub(opts.col - #a1, opts.col + #a2 - 1) end)
:with_move(cond.none())
:with_cr(cond.none())
:with_del(function(opts)
local col = vim.api.nvim_win_get_cursor(0)[2]
return a1 .. ins .. ins .. a2 ==
opts.line:sub(col - #a1 - #ins + 1, col + #ins + #a2) -- insert only works for #ins == 1 anyway
end)
:with_pair(function(opts) return a1 .. a2 == opts.line:sub(opts.col - #a1, opts.col + #a2 - 1) end)
:with_move(cond.none())
:with_cr(cond.none())
:with_del(function(opts)
local col = vim.api.nvim_win_get_cursor(0)[2]
return a1 .. ins .. ins .. a2 == opts.line:sub(col - #a1 - #ins + 1, col + #ins + #a2) -- insert only works for #ins == 1 anyway
end)
)
end
@ -41,9 +40,11 @@ pair_with_insertion("[", " ", "]", { "typst", "python", "haskell" })
pair_with_insertion("{", " ", "}", nil)
for _, symb in ipairs { "$", "```", "_", "*" } do
npairs.add_rule(Rule(symb, symb, "typst")
:with_pair(cond.not_before_text(symb))
:with_pair(cond.not_after_regex "%a")
:with_pair(cond.not_before_regex "%a")
:with_move(cond.done))
npairs.add_rule(
Rule(symb, symb, "typst")
:with_pair(cond.not_before_text(symb))
:with_pair(cond.not_after_regex("%a"))
:with_pair(cond.not_before_regex("%a"))
:with_move(cond.done)
)
end

View file

@ -1,5 +1,5 @@
local cmp = require "cmp"
local ls = require "luasnip"
local cmp = require("cmp")
local ls = require("luasnip")
local s = ls.snippet
local sn = ls.snippet_node
@ -10,28 +10,28 @@ local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local r = ls.restore_node
local l = require "luasnip.extras".lambda
local rep = require "luasnip.extras".rep
local p = require "luasnip.extras".partial
local m = require "luasnip.extras".match
local n = require "luasnip.extras".nonempty
local dl = require "luasnip.extras".dynamic_lambda
local fmt = require "luasnip.extras.fmt".fmt
local fmta = require "luasnip.extras.fmt".fmta
local types = require "luasnip.util.types"
local conds = require "luasnip.extras.conditions"
local conds_expand = require "luasnip.extras.conditions.expand"
local l = require("luasnip.extras").lambda
local rep = require("luasnip.extras").rep
local p = require("luasnip.extras").partial
local m = require("luasnip.extras").match
local n = require("luasnip.extras").nonempty
local dl = require("luasnip.extras").dynamic_lambda
local fmt = require("luasnip.extras.fmt").fmt
local fmta = require("luasnip.extras.fmt").fmta
local types = require("luasnip.util.types")
local conds = require("luasnip.extras.conditions")
local conds_expand = require("luasnip.extras.conditions.expand")
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
-----------------
-- Lazy loader --
-----------------
require "luasnip.loaders.from_vscode".lazy_load { paths = { "./snippets" } }
require("luasnip.loaders.from_vscode").lazy_load { paths = { "./snippets" } }
----------
-- Init --
@ -42,11 +42,11 @@ ls.setup { update_events = { "TextChanged", "TextChangedI" } }
-- Typst --
-----------
local function show_date_typst_entry()
return os.date "(year: %Y, month: %m, day: %d, hour: %H, minute: %M, second: %S)"
return os.date("(year: %Y, month: %m, day: %d, hour: %H, minute: %M, second: %S)")
end
ls.add_snippets("typst", {
s("entry", {
t "#entry(",
t("#entry("),
f(show_date_typst_entry),
t { ")[", "" },
i(0),
@ -56,7 +56,7 @@ ls.add_snippets("typst", {
local function get_cms()
assert(vim.bo.commentstring ~= "", "comment string is not set")
local left = vim.bo.commentstring:gsub("%s*%%s.*", "")
local left = vim.bo.commentstring:gsub("%s*%%s.*", "")
local right = vim.bo.commentstring:gsub(".*%%s%s*", "")
if right == "" then right = left end
return { left = left, right = right }
@ -86,7 +86,9 @@ ls.add_snippets("all", {
s("banner", {
f(horizon, { 1 }),
t { "", "" },
f(left), i(1), f(right),
f(left),
i(1),
f(right),
t { "", "" },
f(horizon, { 1 }),
}),
@ -95,20 +97,28 @@ ls.add_snippets("all", {
------------
-- Ledger --
------------
local function show_date_ledger_entry()
return os.date "%Y-%m-%d"
end
local function show_date_ledger_entry() return os.date("%Y-%m-%d") end
-- shortcuts
ls.add_snippets("ledger", {
s("lessive", {
f(show_date_ledger_entry), t " ", t "Lave linge (CROUS)", cr(),
t "\texpenses 3,00 EUR", cr(),
t "\tassets:compte_courant -3,00 EUR", cr(),
f(show_date_ledger_entry),
t(" "),
t("Lave linge (CROUS)"),
cr(),
t("\texpenses 3,00 EUR"),
cr(),
t("\tassets:compte_courant -3,00 EUR"),
cr(),
}),
s("sechoir", {
f(show_date_ledger_entry), t " ", t "Sèche linge (CROUS)", cr(),
t "\texpenses 1,50 EUR", cr(),
t "\tassets:compte_courant -1,50 EUR", cr(),
f(show_date_ledger_entry),
t(" "),
t("Sèche linge (CROUS)"),
cr(),
t("\texpenses 1,50 EUR"),
cr(),
t("\tassets:compte_courant -1,50 EUR"),
cr(),
}),
})
@ -116,21 +126,43 @@ ls.add_snippets("ledger", {
local id = function(args) return args[1][1] end
ls.add_snippets("ledger", {
s("entry", {
f(show_date_ledger_entry), t " ", i(1), cr(),
t "\texpenses:", i(2), t " ", i(3), t " EUR", cr(),
t "\tassets:compte_courant -", f(id, { 3 }), t " EUR", cr(),
f(show_date_ledger_entry),
t(" "),
i(1),
cr(),
t("\texpenses:"),
i(2),
t(" "),
i(3),
t(" EUR"),
cr(),
t("\tassets:compte_courant -"),
f(id, { 3 }),
t(" EUR"),
cr(),
}),
s("date-entry", {
i(1), t " ", i(2), cr(),
t "\texpenses:", i(3), t " ", i(4), t " EUR", cr(),
t "\tassets:compte_courant -", f(id, { 4 }), t " EUR", cr(),
i(1),
t(" "),
i(2),
cr(),
t("\texpenses:"),
i(3),
t(" "),
i(4),
t(" EUR"),
cr(),
t("\tassets:compte_courant -"),
f(id, { 4 }),
t(" EUR"),
cr(),
}),
})
-------------
-- Haskell --
-------------
local haskell_snippets = require "haskell-snippets".all
local haskell_snippets = require("haskell-snippets").all
ls.add_snippets("haskell", haskell_snippets, { key = "haskell" })
---------------
@ -146,9 +178,7 @@ end
cmp.setup {
snippet = {
expand = function(args)
ls.lsp_expand(args.body)
end,
expand = function(args) ls.lsp_expand(args.body) end,
},
mapping = cmp.mapping.preset.insert {
["<Tab>"] = cmp.mapping(function(fallback) -- Next or jump
@ -183,7 +213,7 @@ cmp.setup {
cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
select = true,
} ()
}()
else
fallback()
end
@ -193,7 +223,7 @@ cmp.setup {
cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
} ()
}()
else
fallback()
end
@ -203,20 +233,18 @@ cmp.setup {
{ name = "luasnip" },
{ name = "nvim_lsp" },
{
name = "buffer", keyword_length = 10,
name = "buffer",
keyword_length = 10,
option = {
enable_in_context = function()
return of_filetype { "tex", "markdown", "typst" }
end,
enable_in_context = function() return of_filetype { "tex", "markdown", "typst" } end,
},
},
{
name = "spell", keyword_length = 10,
name = "spell",
keyword_length = 10,
option = {
keep_all_entries = true,
enable_in_context = function()
return of_filetype { "tex", "markdown", "typst" }
end,
keep_all_entries = true,
enable_in_context = function() return of_filetype { "tex", "markdown", "typst" } end,
},
},
},

View file

@ -1,19 +1,19 @@
local default = {
RGB = true, -- #RGB hex codes
RRGGBB = true, -- #RRGGBB hex codes
names = false, -- "Name" codes like Blue or blue
RRGGBBAA = false, -- #RRGGBBAA hex codes
AARRGGBB = false, -- 0xAARRGGBB hex codes
rgb_fn = false, -- CSS rgb() and rgba() functions
hsl_fn = false, -- CSS hsl() and hsla() functions
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
RGB = true, -- #RGB hex codes
RRGGBB = true, -- #RRGGBB hex codes
names = false, -- "Name" codes like Blue or blue
RRGGBBAA = false, -- #RRGGBBAA hex codes
AARRGGBB = false, -- 0xAARRGGBB hex codes
rgb_fn = false, -- CSS rgb() and rgba() functions
hsl_fn = false, -- CSS hsl() and hsla() functions
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
mode = "background",
mode = "background",
always_update = true,
}
require "colorizer".setup {
require("colorizer").setup {
filetypes = {
"*",
},

View file

@ -1,4 +1,4 @@
require "gitsigns".setup {
require("gitsigns").setup {
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
@ -17,8 +17,8 @@ require "gitsigns".setup {
map("n", "<leader>hu", gs.undo_stage_hunk)
map("n", "<leader>hr", gs.reset_hunk)
map("v", "<leader>hs", function() gs.stage_hunk { vim.fn.line ".", vim.fn.line "v" } end)
map("v", "<leader>hr", function() gs.reset_hunk { vim.fn.line ".", vim.fn.line "v" } end)
map("v", "<leader>hs", function() gs.stage_hunk { vim.fn.line("."), vim.fn.line("v") } end)
map("v", "<leader>hr", function() gs.reset_hunk { vim.fn.line("."), vim.fn.line("v") } end)
map("n", "<leader>hS", gs.stage_buffer)
map("n", "<leader>hR", gs.reset_buffer)
@ -28,7 +28,7 @@ require "gitsigns".setup {
map("n", "<leader>tb", gs.toggle_current_line_blame)
map("n", "<leader>hd", gs.diffthis)
map("n", "<leader>hD", function() gs.diffthis "~" end)
map("n", "<leader>hD", function() gs.diffthis("~") end)
map("n", "<leader>pd", gs.toggle_deleted)

View file

@ -1,5 +1,5 @@
local harpoon = require "harpoon"
local map = vim.keymap.set
local harpoon = require("harpoon")
local map = vim.keymap.set
harpoon:setup()

View file

@ -1,81 +1,69 @@
local map = vim.keymap.set
local map = vim.keymap.set
----------------------
-- Language servers --
----------------------
-- NOTE: put settings into `settings`
-- use another `on_attach` field if needed
local servers = {
bashls = {}, -- Bash
clangd = {}, -- C/CPP
cssls = {}, -- CSS
html = {}, -- HTML
jsonls = {}, -- JSON
lemminx = {}, -- XML
marksman = {}, -- Markdown
phpactor = {}, -- PHP
pylsp = {}, -- Python
pyright = {},
taplo = {}, -- TOML
texlab = {}, -- texlab
tsserver = {}, -- TypeScript
vimls = {}, -- Vim Script
ocamllsp = {}, -- OCaml
local servers = {
bashls = {}, -- Bash
clangd = {}, -- C/CPP
cssls = {}, -- CSS
html = {}, -- HTML
jsonls = {}, -- JSON
lemminx = {}, -- XML
marksman = {}, -- Markdown
phpactor = {}, -- PHP
pylsp = {}, -- Python
pyright = {},
taplo = {}, -- TOML
texlab = {}, -- texlab
tsserver = {}, -- TypeScript
vimls = {}, -- Vim Script
ocamllsp = {}, -- OCaml
typst_lsp = { -- Typst
typst_lsp = { -- Typst
settings = {
root_dir =
vim.fs.dirname(vim.fs.find({ ".git" }, { upward = true })[1])
or vim.loop.cwd(),
root_dir = vim.fs.dirname(vim.fs.find({ ".git" }, { upward = true })[1]) or vim.loop.cwd(),
exportPdf = "never",
},
on_attach = function(_, bufno)
map("n", "<leader>f", function()
vim.cmd ":w"
vim.cmd [[silent exec "!typstfmt %"]]
vim.cmd ":e"
vim.cmd(":w")
vim.cmd([[silent exec "!typstfmt %"]])
vim.cmd(":e")
end, { buffer = bufno })
end,
},
lua_ls = { -- Lua
settings = {
Lua = {
format = {
defaultConfig = {
-- Learn more:
-- https://github.com/CppCXY/EmmyLuaCodeStyle/blob/master/docs/format_config.md
indent_style = "space",
quote_style = "double",
call_arg_parentheses = "remove",
trailing_table_separator = "smart",
},
},
},
},
},
nil_ls = { -- Nix
lua_ls = { -- Lua
on_attach = function(_, bufno)
vim.api.nvim_buf_set_option(bufno, "omnifunc", "v:lua.vim.lsp.omnifunc")
map("n", "<leader>f",
function()
vim.cmd ":w"
vim.cmd [[silent exec "!alejandra %"]]
vim.cmd ":e"
end,
{ buffer = bufno })
map("n", "<leader>f", function()
vim.cmd(":w")
vim.cmd([[silent exec "!stylua %"]])
vim.cmd(":e")
end, { buffer = bufno })
end,
},
nil_ls = { -- Nix
on_attach = function(_, bufno)
vim.api.nvim_buf_set_option(bufno, "omnifunc", "v:lua.vim.lsp.omnifunc")
map("n", "<leader>f", function()
vim.cmd(":w")
vim.cmd([[silent exec "!alejandra %"]])
vim.cmd(":e")
end, { buffer = bufno })
end,
},
}
-------------
-- Helpers --
-------------
local on_attach = function(client, bufno)
local on_attach = function(client, bufno)
vim.api.nvim_buf_set_option(bufno, "omnifunc", "v:lua.vim.lsp.omnifunc")
local ts = require "telescope.builtin"
local ts = require("telescope.builtin")
local opts = { buffer = bufno }
map("n", "K", vim.lsp.buf.hover, opts)
@ -90,17 +78,19 @@ local on_attach = function(client, bufno)
map("n", "<leader>r", vim.lsp.buf.rename, opts)
map("n", "<leader>f", function() vim.lsp.buf.format { async = true } end, opts)
if client.server_capabilities.documentSymbolProvider then
require "nvim-navic".attach(client, bufno)
end
if client.server_capabilities.documentSymbolProvider then require("nvim-navic").attach(client, bufno) end
end
-- Helix style border
local border = {
{ " ", "FloatBorder" }, { " ", "FloatBorder" },
{ " ", "FloatBorder" }, { " ", "FloatBorder" },
{ " ", "FloatBorder" }, { " ", "FloatBorder" },
{ " ", "FloatBorder" }, { " ", "FloatBorder" },
local border = {
{ " ", "FloatBorder" },
{ " ", "FloatBorder" },
{ " ", "FloatBorder" },
{ " ", "FloatBorder" },
{ " ", "FloatBorder" },
{ " ", "FloatBorder" },
{ " ", "FloatBorder" },
{ " ", "FloatBorder" },
}
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
@ -113,7 +103,7 @@ end
vim.diagnostic.config { virtual_text = false, severity_sort = true }
-- Set log level
vim.lsp.set_log_level "off"
vim.lsp.set_log_level("off")
-- Gutter symbols setup
vim.fn.sign_define("DiagnosticSignError", { text = "E", texthl = "DiagnosticSignError", numhl = "DiagnosticSignError" })
@ -123,18 +113,18 @@ vim.fn.sign_define("DiagnosticSignInfo", { text = "·", texthl = "DiagnosticSign
-- Capabilities
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require "cmp_nvim_lsp".default_capabilities(capabilities)
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
----------
-- Init --
----------
require "fidget".setup()
require "neodev".setup()
require("fidget").setup()
require("neodev").setup()
-- Folding
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true,
lineFoldingOnly = true,
}
local handler = function(virtText, lnum, endLnum, width, truncate)
local newVirtText = {}
@ -163,13 +153,13 @@ local handler = function(virtText, lnum, endLnum, width, truncate)
table.insert(newVirtText, { suffix, "MoreMsg" })
return newVirtText
end
require "ufo".setup { fold_virt_text_handler = handler }
require("ufo").setup { fold_virt_text_handler = handler }
for k, v in pairs(servers) do
require "lspconfig"[k].setup {
require("lspconfig")[k].setup {
capabilities = capabilities,
settings = v.settings,
on_attach = function(client, bufno)
settings = v.settings,
on_attach = function(client, bufno)
on_attach(client, bufno)
v.on_attach(client, bufno)
end,
@ -187,26 +177,25 @@ local config = {
-- https://github.com/NixOS/nixpkgs/issues/232822#issuecomment-1564243667
-- `-data` argument is necessary
"jdtls",
"-data", vim.fn.expand "~/.cache/jdtls" .. vim.fn.expand "%:p:h",
"-data",
vim.fn.expand("~/.cache/jdtls") .. vim.fn.expand("%:p:h"),
},
root_dir = vim.fs.dirname(vim.fs.find({ "gradlew", ".git", "mvnw" }, { upward = true })[1]),
}
local jdtls_group = vim.api.nvim_create_augroup("jdtls", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
pattern = { "java" },
callback = function()
require "jdtls".start_or_attach(config)
end,
callback = function() require("jdtls").start_or_attach(config) end,
group = jdtls_group,
})
-- Scala
local metals = require "metals"
local metals = require("metals")
local metals_config = metals.bare_config()
metals_config.capabilities = capabilities
metals_config.settings.useGlobalExecutable = true
require "dap".configurations.scala = {
require("dap").configurations.scala = {
{
type = "scala",
request = "launch",
@ -226,22 +215,20 @@ metals_config.on_attach = function(client, bufnr)
map("n", "<leader>ws", metals.hover_worksheet)
map("n", "<leader>dc", require "dap".continue)
map("n", "<leader>dr", require "dap".repl.toggle)
map("n", "<leader>dK", require "dap.ui.widgets".hover)
map("n", "<leader>dt", require "dap".toggle_breakpoint)
map("n", "<leader>dso", require "dap".step_over)
map("n", "<leader>dsi", require "dap".step_into)
map("n", "<leader>dl", require "dap".run_last)
map("n", "<leader>dc", require("dap").continue)
map("n", "<leader>dr", require("dap").repl.toggle)
map("n", "<leader>dK", require("dap.ui.widgets").hover)
map("n", "<leader>dt", require("dap").toggle_breakpoint)
map("n", "<leader>dso", require("dap").step_over)
map("n", "<leader>dsi", require("dap").step_into)
map("n", "<leader>dl", require("dap").run_last)
on_attach(client, bufnr)
end
local nvim_metals_group = vim.api.nvim_create_augroup("nvim-metals", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
pattern = { "scala", "sbt" },
callback = function()
require "metals".initialize_or_attach(metals_config)
end,
callback = function() require("metals").initialize_or_attach(metals_config) end,
group = nvim_metals_group,
})
@ -256,7 +243,7 @@ vim.g.haskell_tools = {
},
hls = {
on_attach = function(client, bufnr)
local ht = require "haskell-tools"
local ht = require("haskell-tools")
local opts = { buffer = bufnr }
map("n", "<leader>hhe", ht.lsp.buf_eval_all, opts)
@ -268,7 +255,7 @@ vim.g.haskell_tools = {
end,
default_settings = {
haskell = {
formattingProvider = "fourmolu",
formattingProvider = "fourmolu",
cabalFormattingProvider = "cabal-fmt",
},
},

View file

@ -2,7 +2,7 @@ local function diagnostic_message()
local row, _ = unpack(vim.api.nvim_win_get_cursor(0))
local ds = vim.diagnostic.get(0, { lnum = row - 1 })
if #ds >= 1 then
return ds[1].message:gsub("%%", "%%%%");
return ds[1].message:gsub("%%", "%%%%")
else
return ""
end
@ -18,14 +18,13 @@ local grey = {
}
local curry_theme = {
normal = grey,
insert = grey,
visual = grey,
replace = grey,
normal = grey,
insert = grey,
visual = grey,
replace = grey,
inactive = grey,
}
local sections = {
lualine_a = {},
lualine_b = {
@ -42,29 +41,29 @@ local sections = {
lualine_z = { "progress", "branch" },
}
require "lualine".setup {
options = {
icons_enabled = true,
theme = curry_theme,
require("lualine").setup {
options = {
icons_enabled = true,
theme = curry_theme,
component_separators = {},
section_separators = {},
disabled_filetypes = {
section_separators = {},
disabled_filetypes = {
statusline = { "fugitive" },
winbar = { "fugitive" },
winbar = { "fugitive" },
},
ignore_focus = {},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
tabline = 1000,
winbar = 1000,
},
},
sections = sections,
sections = sections,
inactive_sections = sections,
winbar = {},
inactive_winbar = {},
tabline = {},
extensions = {},
winbar = {},
inactive_winbar = {},
tabline = {},
extensions = {},
}

View file

@ -1,4 +1,4 @@
require "no-neck-pain".setup {
require("no-neck-pain").setup {
width = 75,
buffers = {
right = { enabled = false },

View file

@ -1,32 +1,32 @@
require "oil".setup {
default_file_explorer = false,
columns = {
require("oil").setup {
default_file_explorer = false,
columns = {
-- "icon",
-- "permissions",
-- "size",
-- "mtime",
},
skip_confirm_for_simple_edits = true,
skip_confirm_for_simple_edits = true,
prompt_save_on_select_new_entry = false,
keymaps = {
["g?"] = "actions.show_help",
["<CR>"] = "actions.select",
keymaps = {
["g?"] = "actions.show_help",
["<CR>"] = "actions.select",
["<C-v>"] = "actions.select_vsplit",
["<C-x>"] = "actions.select_split",
["<C-t>"] = "actions.select_tab",
["<C-p>"] = "actions.preview",
["<C-c>"] = "actions.close",
["<C-l>"] = "actions.refresh",
["-"] = "actions.parent",
["_"] = "actions.open_cwd",
["`"] = "actions.cd",
["~"] = "actions.tcd",
["gs"] = "actions.change_sort",
["gx"] = "actions.open_external",
["g."] = "actions.toggle_hidden",
["g\\"] = "actions.toggle_trash",
["-"] = "actions.parent",
["_"] = "actions.open_cwd",
["`"] = "actions.cd",
["~"] = "actions.tcd",
["gs"] = "actions.change_sort",
["gx"] = "actions.open_external",
["g."] = "actions.toggle_hidden",
["g\\"] = "actions.toggle_trash",
},
view_options = {
view_options = {
show_hidden = true,
},
}

View file

@ -1,15 +1,15 @@
local ts = require "telescope"
local actions = require "telescope.actions"
local themes = require "telescope.themes"
local config = require "telescope.config"
local builtin = require "telescope.builtin"
local map = vim.keymap.set
local ts = require("telescope")
local actions = require("telescope.actions")
local themes = require("telescope.themes")
local config = require("telescope.config")
local builtin = require("telescope.builtin")
local map = vim.keymap.set
-- Clone the default Telescope configuration
local vimgrep_arguments = { unpack(config.values.vimgrep_arguments) }
table.insert(vimgrep_arguments, "--hidden") -- search hidden
table.insert(vimgrep_arguments, "--glob") -- ignore git
table.insert(vimgrep_arguments, "--glob") -- ignore git
table.insert(vimgrep_arguments, "!**/.git/*")
ts.setup {
@ -29,14 +29,9 @@ ts.setup {
}
-- Enable telescope fzf native, if installed
pcall(require "telescope".load_extension, "fzf")
pcall(require("telescope").load_extension, "fzf")
map("n", "<leader>/",
function()
builtin.current_buffer_fuzzy_find(themes.get_dropdown { previewer = false })
end
)
map("n", "<leader>/", function() builtin.current_buffer_fuzzy_find(themes.get_dropdown { previewer = false }) end)
map("n", "<leader>sf", builtin.find_files)
map("n", "<leader>gf", builtin.git_files)
map("n", "<leader>?", builtin.help_tags)

View file

@ -1,11 +1,11 @@
require "todo-comments".setup {
require("todo-comments").setup {
keywords = {
FIX = { icon = "", color = "error", alt = { "FIXME", "BUG", "FIXIT", "ISSUE" } },
FIX = { icon = "", color = "error", alt = { "FIXME", "BUG", "FIXIT", "ISSUE" } },
TODO = { icon = "", color = "info" },
HACK = { icon = "!", color = "warning", alt = { "DEBUG" } },
WARN = { icon = "!", color = "warning", alt = { "WARNING", "XXX" } },
NOTE = { icon = "·", color = "hint", alt = { "INFO" } },
TEST = { icon = "T", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
Q = { icon = "?", color = "warning" },
Q = { icon = "?", color = "warning" },
},
}

View file

@ -1,21 +1,19 @@
require "nvim-treesitter.configs".setup {
require("nvim-treesitter.configs").setup {
ensure_installed = {},
sync_install = false,
auto_install = true,
highlight = { enable = true },
sync_install = false,
auto_install = true,
highlight = { enable = true },
-- Disable for large files
disable = function(lang, buf)
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
if ok and stats and stats.size > max_filesize then return true end
end,
-- Text objets
textobjects = {
textobjects = {
select = {
enable = true,
lookahead = true,
@ -27,7 +25,7 @@ require "nvim-treesitter.configs".setup {
},
selection_modes = {
["@parameter.outer"] = "v", -- charwise
["@function.outer"] = "V", -- linewise
["@function.outer"] = "V", -- linewise
["@class.outer"] = "<c-v>", -- blockwise
},
include_surrounding_whitespace = true,
@ -44,13 +42,13 @@ require "nvim-treesitter.configs".setup {
},
}
require "treesitter-context".setup {
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
max_lines = 2, -- How many lines the window should span. Values < = 0 mean no limit.
min_window_height = 0, -- Minimum editor window height to enable context. Values < = 0 mean no limit.
line_numbers = true,
multiline_threshold = 20, -- Maximum number of lines to collapse for a single context line
trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
mode = "topline", -- Line used to calculate context. Choices: 'cursor', 'topline'
zindex = 20, -- The Z-index of the context window
require("treesitter-context").setup {
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
max_lines = 2, -- How many lines the window should span. Values < = 0 mean no limit.
min_window_height = 0, -- Minimum editor window height to enable context. Values < = 0 mean no limit.
line_numbers = true,
multiline_threshold = 20, -- Maximum number of lines to collapse for a single context line
trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
mode = "topline", -- Line used to calculate context. Choices: 'cursor', 'topline'
zindex = 20, -- The Z-index of the context window
}