mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-22 20:25:38 +00:00
move some lua text to separate files
This commit is contained in:
parent
3438446347
commit
7a39acef1a
10
modules/neovim/plugins/lsp.lua
Normal file
10
modules/neovim/plugins/lsp.lua
Normal file
@ -0,0 +1,10 @@
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition)
|
||||
vim.keymap.set("n", "gT", vim.lsp.buf.type_definition)
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation)
|
||||
vim.keymap.set("n", "gh", vim.lsp.buf.hover)
|
||||
-- vim.keymap.set("n", "gr", telescope.lsp_references)
|
||||
vim.keymap.set("n", "<Leader>R", vim.lsp.buf.rename)
|
||||
vim.keymap.set("n", "]e", vim.diagnostic.goto_next)
|
||||
vim.keymap.set("n", "[e", vim.diagnostic.goto_prev)
|
||||
vim.keymap.set("n", "<Leader>de", vim.diagnostic.open_float)
|
||||
vim.keymap.set("n", "<Leader>E", vim.lsp.buf.code_action)
|
@ -51,32 +51,22 @@
|
||||
# };
|
||||
|
||||
lua = ''
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition)
|
||||
vim.keymap.set("n", "gT", vim.lsp.buf.type_definition)
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation)
|
||||
vim.keymap.set("n", "gh", vim.lsp.buf.hover)
|
||||
-- vim.keymap.set("n", "gr", telescope.lsp_references)
|
||||
vim.keymap.set("n", "<Leader>R", vim.lsp.buf.rename)
|
||||
vim.keymap.set("n", "]e", vim.diagnostic.goto_next)
|
||||
vim.keymap.set("n", "[e", vim.diagnostic.goto_prev)
|
||||
vim.keymap.set("n", "<Leader>de", vim.diagnostic.open_float)
|
||||
vim.keymap.set("n", "<Leader>E", vim.lsp.buf.code_action)
|
||||
|
||||
${builtins.readFile ./lsp.lua}
|
||||
|
||||
require("null-ls").setup({
|
||||
sources = {
|
||||
require('null-ls').builtins.formatting.stylua.with({ command = "${pkgs.stylua}/bin/stylua" }),
|
||||
require('null-ls').builtins.formatting.black.with({ command = "${pkgs.black}/bin/black" }),
|
||||
require('null-ls').builtins.diagnostics.flake8.with({ command = "${pkgs.python310Packages.flake8}/bin/flake8" }),
|
||||
require('null-ls').builtins.formatting.fish_indent.with({ command = "${pkgs.fish}/bin/fish_indent" }),
|
||||
require('null-ls').builtins.formatting.nixfmt.with({ command = "${pkgs.nixfmt}/bin/nixfmt" }),
|
||||
require('null-ls').builtins.formatting.rustfmt.with({ command = "${pkgs.rustfmt}/bin/rustfmt" }),
|
||||
require('null-ls').builtins.diagnostics.shellcheck.with({ command = "${pkgs.shellcheck}/bin/shellcheck" }),
|
||||
require('null-ls').builtins.formatting.shfmt.with({
|
||||
require("null-ls").builtins.formatting.stylua.with({ command = "${pkgs.stylua}/bin/stylua" }),
|
||||
require("null-ls").builtins.formatting.black.with({ command = "${pkgs.black}/bin/black" }),
|
||||
require("null-ls").builtins.diagnostics.flake8.with({ command = "${pkgs.python310Packages.flake8}/bin/flake8" }),
|
||||
require("null-ls").builtins.formatting.fish_indent.with({ command = "${pkgs.fish}/bin/fish_indent" }),
|
||||
require("null-ls").builtins.formatting.nixfmt.with({ command = "${pkgs.nixfmt}/bin/nixfmt" }),
|
||||
require("null-ls").builtins.formatting.rustfmt.with({ command = "${pkgs.rustfmt}/bin/rustfmt" }),
|
||||
require("null-ls").builtins.diagnostics.shellcheck.with({ command = "${pkgs.shellcheck}/bin/shellcheck" }),
|
||||
require("null-ls").builtins.formatting.shfmt.with({
|
||||
command = "${pkgs.shfmt}/bin/shfmt",
|
||||
extra_args = { '-i', '4', '-ci' },
|
||||
extra_args = { "-i", "4", "-ci" },
|
||||
}),
|
||||
require('null-ls').builtins.formatting.terraform_fmt.with({ command = "${pkgs.terraform}/bin/terraform" }),
|
||||
require("null-ls").builtins.formatting.terraform_fmt.with({ command = "${pkgs.terraform}/bin/terraform" }),
|
||||
},
|
||||
|
||||
on_attach = function(client, bufnr)
|
||||
@ -90,7 +80,7 @@
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
'';
|
||||
|
||||
|
69
modules/neovim/plugins/telescope.lua
Normal file
69
modules/neovim/plugins/telescope.lua
Normal file
@ -0,0 +1,69 @@
|
||||
local telescope = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<Leader>k", telescope.keymaps)
|
||||
vim.keymap.set("n", "<Leader>/", telescope.live_grep)
|
||||
vim.keymap.set("n", "<Leader>ff", telescope.find_files)
|
||||
vim.keymap.set("n", "<Leader>fp", telescope.git_files)
|
||||
vim.keymap.set("n", "<Leader>fw", telescope.grep_string)
|
||||
vim.keymap.set("n", "<Leader>b", telescope.buffers)
|
||||
vim.keymap.set("n", "<Leader>hh", telescope.help_tags)
|
||||
vim.keymap.set("n", "<Leader>fr", telescope.oldfiles)
|
||||
vim.keymap.set("n", "<Leader>cc", telescope.commands)
|
||||
vim.keymap.set("n", "<Leader>gc", telescope.git_commits)
|
||||
vim.keymap.set("n", "<Leader>gf", telescope.git_bcommits)
|
||||
vim.keymap.set("n", "<Leader>gb", telescope.git_branches)
|
||||
vim.keymap.set("n", "<Leader>gs", telescope.git_status)
|
||||
vim.keymap.set("n", "<Leader>s", telescope.current_buffer_fuzzy_find)
|
||||
|
||||
vim.keymap.set("n", "<Leader>N", function()
|
||||
local opts = {
|
||||
prompt_title = "Search Notes",
|
||||
cwd = "$NOTES_PATH",
|
||||
}
|
||||
telescope.live_grep(opts)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<Leader>fN", function()
|
||||
local opts = {
|
||||
prompt_title = "Find Notes",
|
||||
cwd = "$NOTES_PATH",
|
||||
}
|
||||
telescope.find_files(opts)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<Leader>cr", function()
|
||||
local opts = require("telescope.themes").get_ivy({
|
||||
layout_config = {
|
||||
bottom_pane = {
|
||||
height = 15,
|
||||
},
|
||||
},
|
||||
})
|
||||
telescope.command_history(opts)
|
||||
end)
|
||||
|
||||
-- Zoxide
|
||||
vim.keymap.set("n", "<Leader>fz", require("telescope").extensions.zoxide.list)
|
||||
|
||||
-- Project
|
||||
require("telescope").load_extension("project")
|
||||
vim.keymap.set("n", "<C-p>", function()
|
||||
local opts = require("telescope.themes").get_ivy({
|
||||
layout_config = {
|
||||
bottom_pane = {
|
||||
height = 10,
|
||||
},
|
||||
},
|
||||
})
|
||||
require("telescope").extensions.project.project(opts)
|
||||
end)
|
||||
|
||||
-- File browser
|
||||
require("telescope").load_extension("file_browser")
|
||||
vim.keymap.set("n", "<Leader>fa", require("telescope").extensions.file_browser.file_browser)
|
||||
vim.keymap.set("n", "<Leader>fD", function()
|
||||
local opts = {
|
||||
prompt_title = "Find Downloads",
|
||||
cwd = "~/downloads",
|
||||
}
|
||||
require("telescope").extensions.file_browser.file_browser(opts)
|
||||
end)
|
@ -29,76 +29,6 @@
|
||||
};
|
||||
};
|
||||
|
||||
lua = ''
|
||||
local telescope = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<Leader>k", telescope.keymaps)
|
||||
vim.keymap.set("n", "<Leader>/", telescope.live_grep)
|
||||
vim.keymap.set("n", "<Leader>ff", telescope.find_files)
|
||||
vim.keymap.set("n", "<Leader>fp", telescope.git_files)
|
||||
vim.keymap.set("n", "<Leader>fw", telescope.grep_string)
|
||||
vim.keymap.set("n", "<Leader>b", telescope.buffers)
|
||||
vim.keymap.set("n", "<Leader>hh", telescope.help_tags)
|
||||
vim.keymap.set("n", "<Leader>fr", telescope.oldfiles)
|
||||
vim.keymap.set("n", "<Leader>cc", telescope.commands)
|
||||
vim.keymap.set("n", "<Leader>gc", telescope.git_commits)
|
||||
vim.keymap.set("n", "<Leader>gf", telescope.git_bcommits)
|
||||
vim.keymap.set("n", "<Leader>gb", telescope.git_branches)
|
||||
vim.keymap.set("n", "<Leader>gs", telescope.git_status)
|
||||
vim.keymap.set("n", "<Leader>s", telescope.current_buffer_fuzzy_find)
|
||||
|
||||
vim.keymap.set("n", "<Leader>N", function()
|
||||
local opts = {
|
||||
prompt_title = "Search Notes",
|
||||
cwd = "$NOTES_PATH",
|
||||
}
|
||||
telescope.live_grep(opts)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<Leader>fN", function()
|
||||
local opts = {
|
||||
prompt_title = "Find Notes",
|
||||
cwd = "$NOTES_PATH",
|
||||
}
|
||||
telescope.find_files(opts)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<Leader>cr", function()
|
||||
local opts = require("telescope.themes").get_ivy({
|
||||
layout_config = {
|
||||
bottom_pane = {
|
||||
height = 15,
|
||||
},
|
||||
},
|
||||
})
|
||||
telescope.command_history(opts)
|
||||
end)
|
||||
|
||||
-- zoxide
|
||||
vim.keymap.set("n", "<Leader>fz", require("telescope").extensions.zoxide.list)
|
||||
|
||||
-- project
|
||||
require("telescope").load_extension("project")
|
||||
vim.keymap.set("n", "<C-p>", function()
|
||||
local opts = require("telescope.themes").get_ivy({
|
||||
layout_config = {
|
||||
bottom_pane = {
|
||||
height = 10,
|
||||
},
|
||||
},
|
||||
})
|
||||
require("telescope").extensions.project.project(opts)
|
||||
end)
|
||||
|
||||
-- file browser
|
||||
require("telescope").load_extension("file_browser")
|
||||
vim.keymap.set("n", "<Leader>fa", require("telescope").extensions.file_browser.file_browser)
|
||||
vim.keymap.set("n", "<Leader>fD", function()
|
||||
local opts = {
|
||||
prompt_title = "Find Downloads",
|
||||
cwd = "~/downloads",
|
||||
}
|
||||
require("telescope").extensions.file_browser.file_browser(opts)
|
||||
end)
|
||||
'';
|
||||
lua = builtins.readFile ./telescope.lua;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user