null ls to conform
This commit is contained in:
parent
df40f2fdbc
commit
c34c21fbba
5 changed files with 44 additions and 39 deletions
|
@ -37,23 +37,6 @@ autocmd({ "BufWritePre" }, {
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
autocmd("LspAttach", {
|
|
||||||
group = TsousaGroup,
|
|
||||||
callback = function(e)
|
|
||||||
local bufopts = {buffer = e.buf }
|
|
||||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
|
||||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
|
||||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
|
||||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
|
||||||
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
|
|
||||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
|
||||||
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
|
|
||||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
|
||||||
vim.keymap.set('n', '<leader>fo', function() vim.lsp.buf.format { async = true } end, bufopts)
|
|
||||||
vim.keymap.set('i', '<C-h>', vim.lsp.buf.signature_help, bufopts)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.g.netrw_browse_split = 0
|
vim.g.netrw_browse_split = 0
|
||||||
vim.g.netrw_banner = 0
|
vim.g.netrw_banner = 0
|
||||||
vim.g.netrw_winsize = 25
|
vim.g.netrw_winsize = 25
|
||||||
|
|
32
.config/nvim/lua/tsousa/plugins/formatter.lua
Normal file
32
.config/nvim/lua/tsousa/plugins/formatter.lua
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
return {
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
config = function()
|
||||||
|
require("conform").setup({
|
||||||
|
lua = { "stylua" },
|
||||||
|
python = { "isort", "blue" },
|
||||||
|
javascript = { "prettierd" },
|
||||||
|
typescript = { "prettierd" },
|
||||||
|
html = { "prettierd" },
|
||||||
|
json = { "prettierd" },
|
||||||
|
yaml = { "prettierd" },
|
||||||
|
markdown = { "prettierd" },
|
||||||
|
})
|
||||||
|
-- vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
-- pattern = "*",
|
||||||
|
-- callback = function(args)
|
||||||
|
-- require("conform").format { bufnr = args.buf, lsp_fallback = true }
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
-- local null_ls = require("null-ls")
|
||||||
|
-- null_ls.setup({
|
||||||
|
-- sources = {
|
||||||
|
-- null_ls.builtins.formatting.rustfmt,
|
||||||
|
-- null_ls.builtins.formatting.blue,
|
||||||
|
-- null_ls.builtins.formatting.shfmt,
|
||||||
|
-- null_ls.builtins.formatting.prettierd.with({
|
||||||
|
-- filetypes = { "html", "json", "yaml", "markdown" },
|
||||||
|
-- }),
|
||||||
|
-- }
|
||||||
|
-- })
|
||||||
|
end
|
||||||
|
}
|
|
@ -188,6 +188,7 @@ return {
|
||||||
vim.keymap.set('n', '<leader>vd', vim.diagnostic.open_float)
|
vim.keymap.set('n', '<leader>vd', vim.diagnostic.open_float)
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||||
|
vim.keymap.set('n', '<leader>ve', vim.diagnostic.setloclist)
|
||||||
|
|
||||||
-- external (non mason) lsps
|
-- external (non mason) lsps
|
||||||
lspconfig.rust_analyzer.setup({
|
lspconfig.rust_analyzer.setup({
|
||||||
|
@ -212,7 +213,9 @@ return {
|
||||||
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
|
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
|
||||||
vim.keymap.set('n', '<leader>wss', vim.lsp.buf.workspace_symbol, bufopts)
|
vim.keymap.set('n', '<leader>wss', vim.lsp.buf.workspace_symbol, bufopts)
|
||||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||||
vim.keymap.set('n', '<leader>fo', function() vim.lsp.buf.format { async = true } end, bufopts)
|
-- vim.keymap.set('n', '<leader>fo', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||||
|
vim.keymap.set('n', '<leader>fo',
|
||||||
|
function() require("conform").format({ lsp_fallback = true }) end, bufopts)
|
||||||
vim.keymap.set('i', '<C-s>', vim.lsp.buf.signature_help, bufopts)
|
vim.keymap.set('i', '<C-s>', vim.lsp.buf.signature_help, bufopts)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
return {
|
|
||||||
"nvimtools/none-ls.nvim",
|
|
||||||
config = function()
|
|
||||||
local null_ls = require("null-ls")
|
|
||||||
|
|
||||||
null_ls.setup({
|
|
||||||
sources = {
|
|
||||||
null_ls.builtins.formatting.rustfmt,
|
|
||||||
null_ls.builtins.formatting.blue,
|
|
||||||
null_ls.builtins.formatting.shfmt,
|
|
||||||
null_ls.builtins.formatting.prettierd.with({
|
|
||||||
filetypes = { "html", "json", "yaml", "markdown" },
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
||||||
}
|
|
|
@ -1,4 +1,5 @@
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||||||
|
|
||||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||||
|
@ -10,10 +11,8 @@ vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||||
vim.keymap.set("n", "n", "nzzzv")
|
vim.keymap.set("n", "n", "nzzzv")
|
||||||
vim.keymap.set("n", "N", "Nzzzv")
|
vim.keymap.set("n", "N", "Nzzzv")
|
||||||
|
|
||||||
-- greatest remap ever
|
|
||||||
vim.keymap.set("x", "<leader>p", "\"_dP")
|
vim.keymap.set("x", "<leader>p", "\"_dP")
|
||||||
|
|
||||||
-- next greatest remap ever : asbjornHaland
|
|
||||||
vim.keymap.set("n", "<leader>y", "\"+y")
|
vim.keymap.set("n", "<leader>y", "\"+y")
|
||||||
vim.keymap.set("v", "<leader>y", "\"+y")
|
vim.keymap.set("v", "<leader>y", "\"+y")
|
||||||
vim.keymap.set("n", "<leader>Y", "\"+Y")
|
vim.keymap.set("n", "<leader>Y", "\"+Y")
|
||||||
|
@ -21,8 +20,13 @@ vim.keymap.set("n", "<leader>Y", "\"+Y")
|
||||||
vim.keymap.set("n", "<leader>d", "\"_d")
|
vim.keymap.set("n", "<leader>d", "\"_d")
|
||||||
vim.keymap.set("v", "<leader>d", "\"_d")
|
vim.keymap.set("v", "<leader>d", "\"_d")
|
||||||
|
|
||||||
-- This is going to get me cancelled
|
|
||||||
vim.keymap.set("n", "Q", "<nop>")
|
vim.keymap.set("n", "Q", "<nop>")
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>s", ":%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>")
|
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
|
||||||
|
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
|
||||||
|
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
|
||||||
|
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>s", ":%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>")
|
||||||
|
--vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue