Add null-ls, mac settings, zoomwin

This commit is contained in:
Tyler Hallada 2023-12-01 15:26:00 -05:00
parent 372cb6defd
commit 4b1ee0e5eb
6 changed files with 64 additions and 8 deletions

View File

@ -347,6 +347,14 @@ return require('packer').startup(function(use)
require('plugins.gui-font-resize-nvim') require('plugins.gui-font-resize-nvim')
end, end,
} }
use {
"jose-elias-alvarez/null-ls.nvim",
config = function()
require("plugins.null-ls-nvim")
end,
requires = { "nvim-lua/plenary.nvim" },
}
use 'vim-scripts/ZoomWin'
-- Automatically set up your configuration after cloning packer.nvim -- Automatically set up your configuration after cloning packer.nvim
-- Put this at the end after all plugins -- Put this at the end after all plugins

View File

@ -18,7 +18,8 @@ local on_attach = function(_, bufnr)
print(vim.inspect(vim.lsp.buf.list_workspace_folders())) print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, bufopts) end, bufopts)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, 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', '<leader>a', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('v', '<leader>a', vim.lsp.buf.range_code_action, bufopts)
vim.keymap.set('n', 'ga', vim.lsp.buf.code_action, bufopts) vim.keymap.set('n', 'ga', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', '<leader>f', function() vim.lsp.buf.format { async = true } end, bufopts) vim.keymap.set('n', '<leader>f', function() vim.lsp.buf.format { async = true } end, bufopts)
-- vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) -- vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)

View File

@ -0,0 +1,33 @@
local null_ls = require('null-ls')
null_ls.setup({
sources = {
-- Linter
null_ls.builtins.diagnostics.eslint_d,
null_ls.builtins.diagnostics.jsonlint,
null_ls.builtins.diagnostics.markdownlint,
null_ls.builtins.diagnostics.stylelint,
null_ls.builtins.diagnostics.tidy,
null_ls.builtins.diagnostics.todo_comments,
null_ls.builtins.diagnostics.tsc,
-- Formatter
null_ls.builtins.formatting.eslint_d,
null_ls.builtins.formatting.markdownlint,
null_ls.builtins.formatting.prettierd,
null_ls.builtins.formatting.sqlfluff.with({
extra_args = { "--dialect", "postgres" },
}),
null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.rustfmt,
null_ls.builtins.formatting.tidy,
null_ls.builtins.formatting.taplo,
-- Refactoring
null_ls.builtins.code_actions.refactoring,
-- Shells
null_ls.builtins.diagnostics.fish,
-- Git
null_ls.builtins.code_actions.gitsigns,
-- Spelling
null_ls.builtins.diagnostics.codespell,
},
})

View File

@ -16,20 +16,20 @@ rt.setup({
capabilities = nvim_cmp_capabilities, capabilities = nvim_cmp_capabilities,
on_attach = function(client, bufnr) on_attach = function(client, bufnr)
lsp_on_attach(client, bufnr) lsp_on_attach(client, bufnr)
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr }) vim.keymap.set('n', '<C-space>', rt.hover_actions.hover_actions, { buffer = bufnr })
-- Code action groups -- Code action groups
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr }) vim.keymap.set('n', '<Leader>a', rt.code_action_group.code_action_group, { buffer = bufnr })
vim.keymap.set("n", "<leader>rc", rt.open_cargo_toml.open_cargo_toml, { buffer = bufnr }) vim.keymap.set('n', '<leader>rc', rt.open_cargo_toml.open_cargo_toml, { buffer = bufnr })
vim.keymap.set("n", "<leader>rp", rt.parent_module.parent_module, { buffer = bufnr }) vim.keymap.set('n', '<leader>rp', rt.parent_module.parent_module, { buffer = bufnr })
vim.keymap.set("n", "<leader>rm", rt.expand_macro.expand_macro, { buffer = bufnr }) vim.keymap.set('n', '<leader>rm', rt.expand_macro.expand_macro, { buffer = bufnr })
end, end,
settings = { settings = {
-- to enable rust-analyzer settings visit: -- to enable rust-analyzer settings visit:
-- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc -- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc
["rust-analyzer"] = { ['rust-analyzer'] = {
-- enable clippy on save -- enable clippy on save
checkOnSave = { checkOnSave = {
command = "clippy" command = 'clippy'
}, },
} }
}, },

View File

@ -19,6 +19,12 @@ vim.keymap.set('n', '<leader>v', [[<Cmd>:e ~/.config/nvim/init.lua<CR>]], { sile
-- URL handling (since I disabled netrw) -- URL handling (since I disabled netrw)
-- source: https://sbulav.github.io/vim/neovim-opening-urls/ -- source: https://sbulav.github.io/vim/neovim-opening-urls/
if vim.fn.has('mac') == 1 then if vim.fn.has('mac') == 1 then
vim.keymap.set('n', '<D-v>', '"+p')
vim.keymap.set('n', '<D-s-v>', '"+p')
vim.keymap.set('i', '<D-v>', '<C-r>*')
vim.keymap.set('i', '<D-s-v>', '<C-r>*')
vim.keymap.set('t', '<D-v>', '<C-\\><C-n>"+pi')
vim.keymap.set('t', '<D-s-v>', '<C-\\><C-n>"+pi')
vim.keymap.set('', 'gx', [[<Cmd>call jobstart(['open', expand('<cfile>')], { 'detach': v:true })<CR>]], { noremap = true, silent = true }) vim.keymap.set('', 'gx', [[<Cmd>call jobstart(['open', expand('<cfile>')], { 'detach': v:true })<CR>]], { noremap = true, silent = true })
elseif vim.fn.has("unix") == 1 then elseif vim.fn.has("unix") == 1 then
vim.keymap.set('', 'gx', [[<Cmd>call jobstart(['xdg-open', expand('<cfile>')], { 'detach': v:true })<CR>]], { noremap = true, silent = true }) vim.keymap.set('', 'gx', [[<Cmd>call jobstart(['xdg-open', expand('<cfile>')], { 'detach': v:true })<CR>]], { noremap = true, silent = true })

View File

@ -65,5 +65,13 @@ vim.o.shortmess = vim.o.shortmess .. 'c'
-- Python -- Python
vim.g.python3_host_prog = '/usr/bin/python3' vim.g.python3_host_prog = '/usr/bin/python3'
--Shell
vim.opt.shell = 'fish'
-- Format options -- Format options
vim.cmd([[set formatoptions+=wantrqlc]]) vim.cmd([[set formatoptions+=wantrqlc]])
-- Neovide settings
vim.g.neovide_scroll_animation_length = 0.3 -- default: 0.3
vim.g.neovide_cursor_animation_length = 0.06
vim.g.neovide_cursor_trail_size = 0.2 -- default: 0.8