mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-06-15 01:39:25 +02:00
port more nvim stuff to fennel
This commit is contained in:
parent
bf4a37cfdb
commit
ce299b3660
47
mzte-nv/conf/lua/pluginconf/lspconf.fnl
Normal file
47
mzte-nv/conf/lua/pluginconf/lspconf.fnl
Normal file
|
@ -0,0 +1,47 @@
|
|||
(local lspc (require :lspconfig))
|
||||
|
||||
(macro setup [conf args]
|
||||
(var args args)
|
||||
(when (not args)
|
||||
(set args {}))
|
||||
(tset args :capabilities `caps)
|
||||
`((. lspc ,conf :setup) ,args))
|
||||
|
||||
(var caps
|
||||
((. (require :cmp_nvim_lsp) :default_capabilities) (vim.lsp.protocol.make_client_capabilities)))
|
||||
|
||||
(tset caps :textDocument :foldingRange
|
||||
{:dynamicRegistration false :lineFoldingOnly true})
|
||||
|
||||
(fn disable-formatter [client _]
|
||||
(tset client :server_capabilities :documentFormattingRangeProvider false))
|
||||
|
||||
(setup :clangd {:on_attach disable-formatter})
|
||||
(setup :cssls)
|
||||
(setup :elixirls {:cmd [:elixir-ls]})
|
||||
(setup :eslint)
|
||||
(setup :haxe_language_server)
|
||||
(setup :html)
|
||||
(setup :jsonls)
|
||||
(setup :lua_ls {:settings {:Lua {:runtime {:version :LuaJIT
|
||||
:path (do
|
||||
(var p
|
||||
(vim.split package.path
|
||||
";"))
|
||||
(table.insert p :lua/?.lua)
|
||||
(table.insert p
|
||||
:lua/?/init.lua))}
|
||||
:diagnostics {:globals [:vim]}
|
||||
:workspace [(vim.api.nvim_get_runtime_file ""
|
||||
true)]
|
||||
:telemetry {:enable false}}}})
|
||||
|
||||
(setup :ocamllsp)
|
||||
(setup :prosemd_lsp)
|
||||
(setup :racket_langserver)
|
||||
(setup :rust_analyzer
|
||||
{:settings {:rust-analyzer {:checkOnSave {:command :clippy}}}})
|
||||
|
||||
(setup :taplo)
|
||||
(setup :yamlls)
|
||||
(setup :zls)
|
|
@ -1,65 +0,0 @@
|
|||
local lspc = require "lspconfig"
|
||||
local caps = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
caps.textDocument.foldingRange = {
|
||||
dynamicRegistration = false,
|
||||
lineFoldingOnly = true,
|
||||
}
|
||||
|
||||
local function disableFormatter(client, _)
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
end
|
||||
|
||||
local lua_runtime_path = vim.split(package.path, ";")
|
||||
table.insert(lua_runtime_path, "lua/?.lua")
|
||||
table.insert(lua_runtime_path, "lua/?/init.lua")
|
||||
|
||||
lspc.clangd.setup {
|
||||
capabilities = caps,
|
||||
on_attach = disableFormatter,
|
||||
}
|
||||
lspc.cssls.setup { capabilities = caps }
|
||||
lspc.elixirls.setup {
|
||||
capabilities = caps,
|
||||
cmd = { "elixir-ls" },
|
||||
}
|
||||
lspc.eslint.setup { capabilities = caps }
|
||||
lspc.haxe_language_server.setup { capabilities = caps }
|
||||
lspc.html.setup { capabilities = caps }
|
||||
lspc.jsonls.setup { capabilities = caps }
|
||||
lspc.lua_ls.setup {
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = "LuaJIT",
|
||||
path = lua_runtime_path,
|
||||
},
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
lspc.ocamllsp.setup { capabilities = caps }
|
||||
lspc.prosemd_lsp.setup { capabilities = caps }
|
||||
lspc.racket_langserver.setup { capabilities = caps }
|
||||
lspc.rust_analyzer.setup {
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
checkOnSave = {
|
||||
command = "clippy",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
lspc.taplo.setup { capabilities = caps }
|
||||
lspc.yamlls.setup { capabilities = caps }
|
||||
lspc.zls.setup { capabilities = caps }
|
34
mzte-nv/conf/lua/pluginconf/nvim_cmp.fnl
Normal file
34
mzte-nv/conf/lua/pluginconf/nvim_cmp.fnl
Normal file
|
@ -0,0 +1,34 @@
|
|||
(local (cmp luasnip mztenv)
|
||||
(values (require :cmp) (require :luasnip) (require :mzte_nv)))
|
||||
|
||||
(local sources {:buffer " "
|
||||
:crates " "
|
||||
:luasnip " "
|
||||
:nvim_lsp " "
|
||||
:path " "
|
||||
:treesitter " "})
|
||||
|
||||
(cmp.setup {:snippet {:expand #(luasnip.lsp_expand (. $1 :body))}
|
||||
:mapping {:<C-b> (cmp.mapping (cmp.mapping.scroll_docs -4) [:i :c])
|
||||
:<C-f> (cmp.mapping (cmp.mapping.scroll_docs 4) [:i :c])
|
||||
:<C-Space> (cmp.mapping (cmp.mapping.complete) [:i :c])
|
||||
:<Tab> (cmp.mapping mztenv.cmp.onTab [:i :s])
|
||||
:<S-Tab> (cmp.mapping (cmp.mapping.select_prev_item))
|
||||
:<CR> (cmp.mapping.confirm {:select true})}
|
||||
:sources (cmp.config.sources (icollect [n _ (pairs sources)]
|
||||
{:name n}))
|
||||
:formatting {:format (fn [entry vim-item]
|
||||
(tset vim-item :menu
|
||||
(. sources entry.source.name))
|
||||
vim-item)}})
|
||||
|
||||
(cmp.setup.cmdline "/" {:sources {:name :buffer}})
|
||||
(cmp.setup.cmdline ":"
|
||||
{:sources (cmp.config.sources [{:name :path}]
|
||||
[{:name :cmdline}])})
|
||||
|
||||
(local signs {:Error " " :Warn " " :Hint " " :Info " "})
|
||||
|
||||
(each [k v (pairs signs)]
|
||||
(let [hl (.. :DiagnosticSign k)]
|
||||
(vim.fn.sign_define hl {:text v :texthl hl :numhl hl})))
|
|
@ -1,72 +0,0 @@
|
|||
local cmp = require "cmp"
|
||||
local luasnip = require "luasnip"
|
||||
local mztenv = require "mzte_nv"
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
|
||||
mapping = {
|
||||
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
|
||||
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||
["<Tab>"] = cmp.mapping(mztenv.cmp.onTab, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(cmp.mapping.select_prev_item()),
|
||||
["<CR>"] = cmp.mapping.confirm { select = true },
|
||||
},
|
||||
|
||||
sources = cmp.config.sources {
|
||||
{ name = "buffer" },
|
||||
{ name = "crates" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "path" },
|
||||
{ name = "treesitter" },
|
||||
},
|
||||
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
vim_item.menu = ({
|
||||
buffer = " ",
|
||||
crates = " ",
|
||||
luasnip = " ",
|
||||
nvim_lsp = " ",
|
||||
path = " ",
|
||||
rg = " ",
|
||||
treesitter = " ",
|
||||
})[entry.source.name]
|
||||
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
cmp.setup.cmdline("/", {
|
||||
sources = {
|
||||
{ name = "buffer" },
|
||||
},
|
||||
})
|
||||
|
||||
cmp.setup.cmdline(":", {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
||||
|
||||
-- define signs
|
||||
local signs = {
|
||||
Error = " ",
|
||||
Warn = " ",
|
||||
Hint = " ",
|
||||
Info = " ",
|
||||
}
|
||||
|
||||
for k, v in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. k
|
||||
vim.fn.sign_define(hl, { text = v, texthl = hl, numhl = hl })
|
||||
end
|
5
mzte-nv/conf/lua/pluginconf/nvim_neogit.fnl
Normal file
5
mzte-nv/conf/lua/pluginconf/nvim_neogit.fnl
Normal file
|
@ -0,0 +1,5 @@
|
|||
(local ngit (require :neogit))
|
||||
|
||||
(ngit.setup {})
|
||||
|
||||
(vim.api.nvim_create_user_command :Neogit ngit.open {:nargs 0})
|
|
@ -1,5 +0,0 @@
|
|||
local ngit = require "neogit"
|
||||
|
||||
ngit.setup {}
|
||||
|
||||
vim.api.nvim_create_user_command("Neogit", ngit.open, { nargs = 0 })
|
8
mzte-nv/conf/lua/pluginconf/nvim_noice.fnl
Normal file
8
mzte-nv/conf/lua/pluginconf/nvim_noice.fnl
Normal file
|
@ -0,0 +1,8 @@
|
|||
(local noice (require :noice))
|
||||
|
||||
(local overrides [:vim.lsp.util.convert_input_to_markdown_lines
|
||||
:vim.lsp.util.stylize_markdown
|
||||
:cmp.entry.get_documentation])
|
||||
|
||||
(noice.setup {:message {:view :mini}
|
||||
:override (collect [_ o (ipairs overrides)] (values o true))})
|
|
@ -1,12 +0,0 @@
|
|||
local noice = require "noice"
|
||||
|
||||
noice.setup {
|
||||
messages = {
|
||||
view = "mini",
|
||||
},
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
}
|
4
mzte-nv/conf/lua/pluginconf/nvim_recorder.fnl
Normal file
4
mzte-nv/conf/lua/pluginconf/nvim_recorder.fnl
Normal file
|
@ -0,0 +1,4 @@
|
|||
((. (require :recorder) :setup) {:mapping {;; this would conflict with search keybind (default is #)
|
||||
:addBreakPoint nil}
|
||||
;; clear all existing macros on startup
|
||||
:clear true})
|
|
@ -1,8 +0,0 @@
|
|||
require("recorder").setup {
|
||||
mapping = {
|
||||
-- this would conflict with search keybind (default is #)
|
||||
addBreakPoint = nil,
|
||||
},
|
||||
-- clear all existing macros on startup
|
||||
clear = true,
|
||||
}
|
22
mzte-nv/conf/lua/pluginconf/nvimtree.fnl
Normal file
22
mzte-nv/conf/lua/pluginconf/nvimtree.fnl
Normal file
|
@ -0,0 +1,22 @@
|
|||
(local nvtree (require :nvim-tree))
|
||||
|
||||
(nvtree.setup {:actions {:change_dir {:global true}}
|
||||
:view {:adaptive_size true}
|
||||
:diagnostics {:enable true}
|
||||
:git {;; don't hide .gitignored files
|
||||
:ignore false}
|
||||
:renderer {:indent_markers {:enable true} :group_empty true}})
|
||||
|
||||
;; open on startup
|
||||
(fn on-enter [data]
|
||||
(local is-no-name (and (= data.file "") (= (. vim :bo data.buf :buftype) "")))
|
||||
(local is-dir (= (vim.fn.isdirectory data.file) 1))
|
||||
(when is-dir
|
||||
(vim.cmd.cd data.file))
|
||||
(when (or is-no-name is-dir)
|
||||
((. (require :nvim-tree.api) :tree :open))))
|
||||
|
||||
(vim.api.nvim_create_autocmd [:VimEnter] {:callback on-enter})
|
||||
|
||||
(vim.keymap.set :n :TT #((. (require :nvim-tree.api) :tree :toggle))
|
||||
{:noremap true :silent true})
|
|
@ -1,39 +0,0 @@
|
|||
local map = vim.api.nvim_set_keymap
|
||||
|
||||
require("nvim-tree").setup {
|
||||
actions = {
|
||||
change_dir = {
|
||||
global = true,
|
||||
},
|
||||
},
|
||||
view = {
|
||||
adaptive_size = true,
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
},
|
||||
git = {
|
||||
ignore = false,
|
||||
},
|
||||
renderer = {
|
||||
indent_markers = { enable = true },
|
||||
group_empty = true,
|
||||
},
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd({ "VimEnter" }, {
|
||||
callback = function(data)
|
||||
local is_no_name = data.file == "" and vim.bo[data.buf].buftype == ""
|
||||
local is_dir = vim.fn.isdirectory(data.file) == 1
|
||||
|
||||
if is_dir then
|
||||
vim.cmd.cd(data.file)
|
||||
end
|
||||
|
||||
if is_no_name or is_dir then
|
||||
require("nvim-tree.api").tree.open()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
map("n", "TT", [[<cmd>NvimTreeToggle<CR>]], { noremap = true, silent = true })
|
4
mzte-nv/conf/lua/pluginconf/rust_tools.fnl
Normal file
4
mzte-nv/conf/lua/pluginconf/rust_tools.fnl
Normal file
|
@ -0,0 +1,4 @@
|
|||
(local rust-tools (require :rust-tools))
|
||||
|
||||
(rust-tools.setup {})
|
||||
(rust-tools.inlay_hints.enable)
|
|
@ -1,4 +0,0 @@
|
|||
local rust_tools = require "rust-tools"
|
||||
|
||||
rust_tools.setup {}
|
||||
rust_tools.inlay_hints.enable();
|
16
mzte-nv/conf/lua/pluginconf/treesitter.fnl
Normal file
16
mzte-nv/conf/lua/pluginconf/treesitter.fnl
Normal file
|
@ -0,0 +1,16 @@
|
|||
(local (configs parsers)
|
||||
(values (require :nvim-treesitter.configs)
|
||||
(require :nvim-treesitter.parsers)))
|
||||
|
||||
(var parser-config (parsers.get_parser_configs))
|
||||
|
||||
(tset parser-config :haxe {:install_info {:url "https://github.com/vantreeseba/tree-sitter-haxe"
|
||||
:files [:src/parser.c]
|
||||
:branch :main}
|
||||
:filetype :haxe})
|
||||
|
||||
(configs.setup {:highlight {:enable true}
|
||||
:autotag {:enable true}
|
||||
:indent {:enable true}
|
||||
:rainbow {:enable true
|
||||
:hlgroups (fcollect [i 1 6] (.. :TSRainbow i))}})
|
|
@ -1,41 +0,0 @@
|
|||
local configs = require "nvim-treesitter.configs"
|
||||
local parsers = require "nvim-treesitter.parsers"
|
||||
|
||||
local parser_config = parsers.get_parser_configs()
|
||||
|
||||
parser_config.haxe = {
|
||||
install_info = {
|
||||
url = "https://github.com/vantreeseba/tree-sitter-haxe",
|
||||
files = { "src/parser.c" },
|
||||
branch = "main",
|
||||
},
|
||||
filetype = "haxe",
|
||||
}
|
||||
|
||||
configs.setup {
|
||||
ensure_installed = { "haxe" },
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
autotag = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
rainbow = {
|
||||
enable = true,
|
||||
|
||||
hlgroups = {
|
||||
"TSRainbow1",
|
||||
"TSRainbow2",
|
||||
"TSRainbow3",
|
||||
"TSRainbow4",
|
||||
"TSRainbow5",
|
||||
"TSRainbow6",
|
||||
},
|
||||
},
|
||||
}
|
15
mzte-nv/conf/lua/pluginconf/ts-context.fnl
Normal file
15
mzte-nv/conf/lua/pluginconf/ts-context.fnl
Normal file
|
@ -0,0 +1,15 @@
|
|||
(local tsc (require :treesitter-context))
|
||||
|
||||
(tsc.setup {:patterns {:zig [:block
|
||||
:FnProto
|
||||
:function
|
||||
:TopLevelDecl
|
||||
:Statement
|
||||
:IfStatement
|
||||
:WhileStatement
|
||||
:WhileExpr
|
||||
:ForStatement
|
||||
:ForExpr
|
||||
:WhileStatement
|
||||
:WhileExpr]
|
||||
:html [:element]}})
|
|
@ -1,23 +0,0 @@
|
|||
local tsc = require "treesitter-context"
|
||||
tsc.setup {
|
||||
patterns = {
|
||||
zig = {
|
||||
"block",
|
||||
"FnProto",
|
||||
"function",
|
||||
"TopLevelDecl",
|
||||
"Statement",
|
||||
"IfStatement",
|
||||
"WhileStatement",
|
||||
"WhileExpr",
|
||||
"ForStatement",
|
||||
"ForExpr",
|
||||
"WhileStatement",
|
||||
"WhileExpr",
|
||||
},
|
||||
|
||||
html = {
|
||||
"element",
|
||||
}
|
||||
},
|
||||
}
|
4
mzte-nv/conf/lua/pluginconf/tsrainbow2.fnl
Normal file
4
mzte-nv/conf/lua/pluginconf/tsrainbow2.fnl
Normal file
|
@ -0,0 +1,4 @@
|
|||
(local colors ["#ff00be" "#ff7e00" "#64d200" "#00e6b6" "#00e1ff" "#9598ff"])
|
||||
|
||||
(each [i c (ipairs colors)]
|
||||
(vim.api.nvim_set_hl 0 (.. :TSRainbow i) {:fg c}))
|
|
@ -1,12 +0,0 @@
|
|||
local colors = {
|
||||
"#ff00be",
|
||||
"#ff7e00",
|
||||
"#64d200",
|
||||
"#00e6b6",
|
||||
"#00e1ff",
|
||||
"#9598ff",
|
||||
}
|
||||
|
||||
for i, c in ipairs(colors) do
|
||||
vim.api.nvim_set_hl(0, "TSRainbow" .. i, { fg = c })
|
||||
end
|
3
mzte-nv/conf/lua/pluginconf/tterm.fnl
Normal file
3
mzte-nv/conf/lua/pluginconf/tterm.fnl
Normal file
|
@ -0,0 +1,3 @@
|
|||
(local tterm (require :toggleterm))
|
||||
|
||||
(tterm.setup {:size 64 :open_mapping :<C-t> :direction :vertical})
|
|
@ -1,7 +0,0 @@
|
|||
local tterm = require "toggleterm"
|
||||
|
||||
tterm.setup {
|
||||
size = 64,
|
||||
open_mapping = [[<C-t>]],
|
||||
direction = "vertical",
|
||||
}
|
11
mzte-nv/conf/lua/pluginconf/web_devicons.fnl
Normal file
11
mzte-nv/conf/lua/pluginconf/web_devicons.fnl
Normal file
|
@ -0,0 +1,11 @@
|
|||
(local wdi (require :nvim-web-devicons))
|
||||
|
||||
(local racket-icon {:icon "λ" :color "#9f1d20" :cterm_color 88 :name :Racket})
|
||||
|
||||
(wdi.setup {:override {:rkt racket-icon
|
||||
:rktl racket-icon
|
||||
:rktd racket-icon
|
||||
:scm {:icon "λ"
|
||||
:color "#3e5ba9"
|
||||
:cterm_color 61
|
||||
:name :Scheme}}})
|
|
@ -1,22 +0,0 @@
|
|||
local wdi = require "nvim-web-devicons"
|
||||
|
||||
local racket_icon = {
|
||||
icon = "λ",
|
||||
color = "#9f1d20",
|
||||
cterm_color = 88,
|
||||
name = "Racket",
|
||||
}
|
||||
|
||||
wdi.setup {
|
||||
override = {
|
||||
rkt = racket_icon,
|
||||
rktl = racket_icon,
|
||||
rktd = racket_icon,
|
||||
scm = {
|
||||
icon = "λ",
|
||||
color = "#3e5ba9",
|
||||
cterm_color = 61,
|
||||
name = "Scheme",
|
||||
},
|
||||
},
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
local zigtools = require "zig-tools"
|
||||
|
||||
zigtools.setup()
|
Loading…
Reference in a new issue