lsp hists
This commit is contained in:
@@ -14,6 +14,8 @@ require("coderun")
|
||||
require("pluginSettings")
|
||||
require("lspConfig")
|
||||
require("cmpConf")
|
||||
require("noneLs")
|
||||
require("treeSitter")
|
||||
|
||||
--############
|
||||
-- # Autorun #
|
||||
|
||||
@@ -66,3 +66,12 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
buf_map("n", "<F11>", ":w<CR>:FloatermNew --disposable --autoclose=0 zig run %<CR>")
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "rust",
|
||||
callback = function()
|
||||
buf_map("n", "<F10>", ":w<CR>:!cargo run %<CR>")
|
||||
buf_map("i", "<F10>", "<Esc>:w<CR>:!cargo run %<CR>")
|
||||
buf_map("n", "<F11>", ":w<CR>:FloatermNew --disposable --autoclose=0 cargo run %<CR>")
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -48,7 +48,7 @@ local lsp_attach = function(client, bufnr)
|
||||
end, "Toggle inlay hints")
|
||||
|
||||
-- Turn inlay hints on automatically, but only for these filetypes
|
||||
local inlay_hint_filetypes = { go = true, cpp = true }
|
||||
local inlay_hint_filetypes = { go = true, cpp = true, rust = true }
|
||||
if client:supports_method("textDocument/inlayHint") and inlay_hint_filetypes[vim.bo[bufnr].filetype] then
|
||||
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
||||
end
|
||||
@@ -65,7 +65,6 @@ local servers = {
|
||||
"stimulus_ls",
|
||||
"cssls",
|
||||
"yamlls",
|
||||
"zls",
|
||||
}
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
@@ -81,6 +80,33 @@ for _, server in ipairs(servers) do
|
||||
vim.lsp.enable(server)
|
||||
end
|
||||
|
||||
-- rust
|
||||
vim.lsp.config("rust_analyzer", {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach,
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
inlayHints = {
|
||||
bindingModeHints = { enable = false },
|
||||
chainingHints = { enable = true },
|
||||
closingBraceHints = { enable = true, minLines = 25 },
|
||||
closureReturnTypeHints = { enable = "never" },
|
||||
lifetimeElisionHints = { enable = "never", useParameterNames = false },
|
||||
maxLength = 25,
|
||||
parameterHints = { enable = true },
|
||||
reborrowHints = { enable = "never" },
|
||||
renderColons = true,
|
||||
typeHints = {
|
||||
enable = true,
|
||||
hideClosureInitialization = false,
|
||||
hideNamedConstructor = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
vim.lsp.enable("rust_analyzer")
|
||||
|
||||
-- GOPLS
|
||||
vim.lsp.config("gopls", {
|
||||
capabilities = capabilities,
|
||||
@@ -181,95 +207,3 @@ vim.lsp.config("lua_ls", {
|
||||
})
|
||||
|
||||
vim.lsp.enable("lua_ls")
|
||||
|
||||
--''''''''''''''''Non-ls/null-ls''''''''''''''''
|
||||
local null_ls = require("null-ls")
|
||||
local helpers = require("null-ls.helpers")
|
||||
local methods = require("null-ls.methods")
|
||||
|
||||
local ruff_format = helpers.make_builtin({
|
||||
name = "ruff_format",
|
||||
method = methods.internal.FORMATTING,
|
||||
filetypes = { "python" },
|
||||
generator_opts = {
|
||||
command = "ruff",
|
||||
args = { "format", "--stdin-filename", "$FILENAME", "-" },
|
||||
to_stdin = true,
|
||||
},
|
||||
factory = helpers.formatter_factory,
|
||||
})
|
||||
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.diagnostics.djlint,
|
||||
null_ls.builtins.diagnostics.cppcheck,
|
||||
null_ls.builtins.diagnostics.codespell,
|
||||
null_ls.builtins.diagnostics.hadolint,
|
||||
null_ls.builtins.formatting.prettierd.with({ extra_args = { "--single-quote" } }),
|
||||
null_ls.builtins.formatting.gofumpt,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
ruff_format,
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
if client:supports_method("textDocument/formatting") then -- run formatters on save
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
--"'''''''''''''''''''Tree sitter highlight''''''''''''''''''''''''''''''
|
||||
require("nvim-treesitter").install({ "lua", "yaml", "bash", "python", "typescript", "javascript", "go" })
|
||||
|
||||
local ts_indent_langs = { "html", "javascript", "tsx", "go", "lua" }
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
callback = function(ev)
|
||||
pcall(vim.treesitter.start)
|
||||
if vim.tbl_contains(ts_indent_langs, ev.match) then
|
||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
require("nvim-treesitter-textobjects").setup({
|
||||
select = {
|
||||
lookahead = true,
|
||||
selection_modes = {
|
||||
["@parameter.outer"] = "v",
|
||||
["@function.outer"] = "V",
|
||||
["@class.outer"] = "<c-v>",
|
||||
},
|
||||
include_surrounding_whitespace = false,
|
||||
},
|
||||
move = { set_jumps = true },
|
||||
})
|
||||
|
||||
local select = require("nvim-treesitter-textobjects.select")
|
||||
local move = require("nvim-treesitter-textobjects.move")
|
||||
|
||||
vim.keymap.set({ "x", "o" }, "af", function()
|
||||
select.select_textobject("@function.outer", "textobjects")
|
||||
end)
|
||||
vim.keymap.set({ "x", "o" }, "if", function()
|
||||
select.select_textobject("@function.inner", "textobjects")
|
||||
end)
|
||||
vim.keymap.set({ "x", "o" }, "ac", function()
|
||||
select.select_textobject("@class.outer", "textobjects")
|
||||
end)
|
||||
vim.keymap.set({ "x", "o" }, "ic", function()
|
||||
select.select_textobject("@class.inner", "textobjects")
|
||||
end)
|
||||
vim.keymap.set({ "x", "o" }, "as", function()
|
||||
select.select_textobject("@local.scope", "locals")
|
||||
end)
|
||||
|
||||
vim.keymap.set({ "n", "x", "o" }, "<C-f>", function()
|
||||
move.goto_next_start("@function.outer", "textobjects")
|
||||
end)
|
||||
vim.keymap.set({ "n", "x", "o" }, "<A-f>", function()
|
||||
move.goto_previous_start("@function.outer", "textobjects")
|
||||
end)
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
--''''''''''''''''Non-ls/null-ls''''''''''''''''
|
||||
local null_ls = require("null-ls")
|
||||
local helpers = require("null-ls.helpers")
|
||||
local methods = require("null-ls.methods")
|
||||
|
||||
local ruff_format = helpers.make_builtin({
|
||||
name = "ruff_format",
|
||||
method = methods.internal.FORMATTING,
|
||||
filetypes = { "python" },
|
||||
generator_opts = {
|
||||
command = "ruff",
|
||||
args = { "format", "--stdin-filename", "$FILENAME", "-" },
|
||||
to_stdin = true,
|
||||
},
|
||||
factory = helpers.formatter_factory,
|
||||
})
|
||||
|
||||
local rustfmt_format = helpers.make_builtin({
|
||||
name = "rustfmt_format",
|
||||
method = methods.internal.FORMATTING,
|
||||
filetypes = { "rust" },
|
||||
generator_opts = {
|
||||
command = "rustfmt",
|
||||
to_stdin = true,
|
||||
},
|
||||
factory = helpers.formatter_factory,
|
||||
})
|
||||
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.diagnostics.djlint,
|
||||
null_ls.builtins.diagnostics.cppcheck,
|
||||
null_ls.builtins.diagnostics.codespell,
|
||||
null_ls.builtins.diagnostics.hadolint,
|
||||
null_ls.builtins.formatting.prettierd.with({ extra_args = { "--single-quote" } }),
|
||||
null_ls.builtins.formatting.gofumpt,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
ruff_format,
|
||||
rustfmt_format,
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
if client:supports_method("textDocument/formatting") then -- run formatters on save
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
@@ -0,0 +1,50 @@
|
||||
require("nvim-treesitter").install({ "lua", "yaml", "bash", "python", "typescript", "javascript", "go", "rust" })
|
||||
|
||||
local ts_indent_langs = { "html", "javascript", "tsx", "go", "lua" }
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
callback = function(ev)
|
||||
pcall(vim.treesitter.start)
|
||||
if vim.tbl_contains(ts_indent_langs, ev.match) then
|
||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
require("nvim-treesitter-textobjects").setup({
|
||||
select = {
|
||||
lookahead = true,
|
||||
selection_modes = {
|
||||
["@parameter.outer"] = "v",
|
||||
["@function.outer"] = "V",
|
||||
["@class.outer"] = "<c-v>",
|
||||
},
|
||||
include_surrounding_whitespace = false,
|
||||
},
|
||||
move = { set_jumps = true },
|
||||
})
|
||||
|
||||
local select = require("nvim-treesitter-textobjects.select")
|
||||
local move = require("nvim-treesitter-textobjects.move")
|
||||
|
||||
vim.keymap.set({ "x", "o" }, "af", function()
|
||||
select.select_textobject("@function.outer", "textobjects")
|
||||
end)
|
||||
vim.keymap.set({ "x", "o" }, "if", function()
|
||||
select.select_textobject("@function.inner", "textobjects")
|
||||
end)
|
||||
vim.keymap.set({ "x", "o" }, "ac", function()
|
||||
select.select_textobject("@class.outer", "textobjects")
|
||||
end)
|
||||
vim.keymap.set({ "x", "o" }, "ic", function()
|
||||
select.select_textobject("@class.inner", "textobjects")
|
||||
end)
|
||||
vim.keymap.set({ "x", "o" }, "as", function()
|
||||
select.select_textobject("@local.scope", "locals")
|
||||
end)
|
||||
|
||||
vim.keymap.set({ "n", "x", "o" }, "<C-f>", function()
|
||||
move.goto_next_start("@function.outer", "textobjects")
|
||||
end)
|
||||
vim.keymap.set({ "n", "x", "o" }, "<A-f>", function()
|
||||
move.goto_previous_start("@function.outer", "textobjects")
|
||||
end)
|
||||
@@ -24,7 +24,7 @@ fi
|
||||
term_cmd='thunderbird'
|
||||
file_cmd='flatpak run io.github.flattool.Warehouse'
|
||||
text_cmd='flatpak run md.obsidian.Obsidian'
|
||||
web_cmd='firefox -no-remote -P School'
|
||||
web_cmd='flatpak run net.waterfox.waterfox -no-remote -p school'
|
||||
music_cmd='flatpak run com.discordapp.DiscordCanary'
|
||||
setting_cmd='env QT_SCALE_FACTOR=2 GDK_SCALE=2 steam'
|
||||
|
||||
@@ -32,7 +32,7 @@ setting_cmd='env QT_SCALE_FACTOR=2 GDK_SCALE=2 steam'
|
||||
layout=`cat ${theme} | grep 'USE_ICON' | cut -d'=' -f2`
|
||||
if [[ "$layout" == 'NO' ]]; then
|
||||
option_1=" Thunderbird<span weight='light' size='small'></span>"
|
||||
option_2=" Flatpak <span weight='light' size='small'></span>"
|
||||
option_2=" Warehouse <span weight='light' size='small'></span>"
|
||||
option_3=" Obsidian<span weight='light' size='small'></span>"
|
||||
option_4=" School<span weight='light' size='small'></span>"
|
||||
option_5=" Discord <span weight='light' size='small'></span>"
|
||||
|
||||
Reference in New Issue
Block a user