several small updates

This commit is contained in:
RingOfStorms (Joshua Bell) 2024-05-02 23:51:15 -05:00
parent 545b3d492f
commit b0c61768db
9 changed files with 432 additions and 415 deletions

View file

@ -70,6 +70,7 @@ return {
-- completions whenever it has completion options available.
["<C-c>"] = cmp.mapping.complete({}),
-- TODO remove these or make them soemthing else, this collided with my normal movements in insert mode
-- Think of <c-l> as moving to the right of your snippet expansion.
-- So if you have a snippet that's like:
-- function $name($args)
@ -78,16 +79,16 @@ return {
--
-- <c-l> will move you to the right of each of the expansion locations.
-- <c-h> is similar, except moving you backwards.
["<C-l>"] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
end
end, { "i", "s" }),
["<C-h>"] = cmp.mapping(function()
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
end
end, { "i", "s" }),
-- ["<C-l>"] = cmp.mapping(function()
-- if luasnip.expand_or_locally_jumpable() then
-- luasnip.expand_or_jump()
-- end
-- end, { "i", "s" }),
-- ["<C-h>"] = cmp.mapping(function()
-- if luasnip.locally_jumpable(-1) then
-- luasnip.jump(-1)
-- end
-- end, { "i", "s" }),
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps

View file

@ -1,36 +1,37 @@
return {
"folke/noice.nvim",
dependencies = {
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
{ "nvim-telescope/telescope.nvim", optional = true },
},
event = "VeryLazy",
opts = {
routes = {
-- I want telescope-ui-select to trigger here not noice
{ filter = { event = "lsp", kind = "search_count" }, opts = { skip = true } },
},
messages = {
view = "mini", -- default view for messages
view_error = "notify", -- view for errors
view_warn = "mini", -- view for warnings
view_history = "messages", -- view for :messages
view_search = false, -- view for search count messages. Set to `false` to disable
},
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
},
},
},
config = function(_, opts)
require("noice").setup(opts)
U.safeRequire("telescope", function(t)
t.load_extension("noice")
end)
end,
"folke/noice.nvim",
dependencies = {
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
{ "nvim-telescope/telescope.nvim", optional = true },
},
event = "VeryLazy",
opts = {
routes = {
-- I want telescope-ui-select to trigger here not noice
{ filter = { event = "lsp", kind = "search_count" }, opts = { skip = true } },
{ filter = { event = "lsp" }, opts = { skip = true } }, -- TODO come back to this, im having weird issues with insert mode getting broken.
},
messages = {
view = "mini", -- default view for messages
view_error = "notify", -- view for errors
view_warn = "mini", -- view for warnings
view_history = "messages", -- view for :messages
view_search = false, -- view for search count messages. Set to `false` to disable
},
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
},
},
},
config = function(_, opts)
require("noice").setup(opts)
U.safeRequire("telescope", function(t)
t.load_extension("noice")
end)
end,
}

View file

@ -1,30 +1,38 @@
return {
"stevearc/conform.nvim",
opts = {
-- https://github.com/stevearc/conform.nvim?tab=readme-ov-file#setup
notify_on_error = true,
formatters_by_ft = {
lua = { "stylua" },
typescript = { { "prettierd", "prettier" } },
typescriptreact = { { "prettierd", "prettier" } },
javascript = { { "prettierd", "prettier" } },
javascriptreact = { { "prettierd", "prettier" } },
},
},
keys = {
{
"<leader>l<leader>",
function()
require("conform").format({ async = true, lsp_fallback = true }, function(err, edited)
if edited then
print("Formatted!")
else
print("Nothing to format!")
end
end)
end,
mode = { "n", "v", "x" },
desc = "Format buffer",
},
},
"stevearc/conform.nvim",
opts = {
-- https://github.com/stevearc/conform.nvim?tab=readme-ov-file#setup
notify_on_error = true,
-- Note that all these need to be available at runtime, add them to flake.nix#runtimeDependencies
formatters_by_ft = {
lua = { "stylua" },
nix = { "nixfmt" },
typescript = { { "prettierd", "prettier" } },
typescriptreact = { { "prettierd", "prettier" } },
javascript = { { "prettierd", "prettier" } },
javascriptreact = { { "prettierd", "prettier" } },
-- TODO revisit these I'd like to use them but they are not in nixpkgs yet
-- https://nixos.org/guides/nix-pills/
-- markdown = { "mdslw", "mdsf"},
markdown = { "markdownlint-cli2" },
},
},
keys = {
{
"<leader>l<leader>",
function()
require("conform").format({ async = true, lsp_fallback = true }, function(err, edited)
if edited then
print("Formatted!")
elseif err then
print(err)
else
print("Nothing to format!")
end
end)
end,
mode = { "n", "v", "x" },
desc = "Format buffer",
},
},
}

View file

@ -1,163 +1,169 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = {
{ "nvim-lua/plenary.nvim" },
{ "nvim-telescope/telescope-fzf-native.nvim" },
{ "nvim-telescope/telescope-ui-select.nvim" },
},
init = function()
U.cmd_executable("rg", {
[false] = function()
vim.notify("rg not installed, live grep will not function.", 2)
end,
})
end,
cmd = "Telescope",
opts = function()
return {
pickers = {
buffers = {
sort_lastused = true,
},
find_files = {
hidden = true,
sort_lastused = true,
},
live_grep = {
hidden = true,
},
},
defaults = {
file_ignore_patterns = { "node_modules", "package-lock.json", "target", ".git" },
mappings = {
i = {
["<C-j>"] = "move_selection_next",
["<C-k>"] = "move_selection_previous",
},
},
vimgrep_arguments = {
"rg",
"--hidden",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
},
extensions = {
["ui-select"] = {
require("telescope.themes").get_cursor(),
},
["notify"] = {},
},
}
end,
config = function(_, opts)
local ts = require("telescope")
ts.setup(opts)
ts.load_extension("ui-select")
"nvim-telescope/telescope.nvim",
dependencies = {
{ "nvim-lua/plenary.nvim" },
{ "nvim-telescope/telescope-fzf-native.nvim" },
{ "nvim-telescope/telescope-ui-select.nvim" },
},
init = function()
U.cmd_executable("rg", {
[false] = function()
vim.notify("rg not installed, live grep will not function.", 2)
end,
})
end,
cmd = "Telescope",
opts = function()
return {
pickers = {
buffers = {
sort_lastused = true,
},
find_files = {
hidden = true,
sort_lastused = true,
},
live_grep = {
hidden = true,
},
},
defaults = {
file_ignore_patterns = { "node_modules", "package-lock.json", "target", ".git" },
mappings = {
i = {
["<C-j>"] = "move_selection_next",
["<C-k>"] = "move_selection_previous",
["<C-h>"] = false,
["<C-l>"] = false,
["<up>"] = false,
["<down>"] = false,
["<left>"] = false,
["<right>"] = false,
},
},
vimgrep_arguments = {
"rg",
"--hidden",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
},
extensions = {
["ui-select"] = {
require("telescope.themes").get_cursor(),
},
["notify"] = {},
},
}
end,
config = function(_, opts)
local ts = require("telescope")
ts.setup(opts)
ts.load_extension("ui-select")
if package.loaded["notify"] then
ts.load_extension("notify")
U.keymaps({
{
"<leader>fn",
"<cmd>Telescope notify<cr>",
desc = "Telescope search notifications",
mode = { "n", "v", "x" },
},
})
end
end,
-- https://github.com/nvim-telescope/telescope.nvim?tab=readme-ov-file#pickers
keys = {
{
"<leader>fr",
function()
require("telescope.builtin").resume()
end,
desc = "Resume last telescope",
},
{
"<leader>f/",
function()
require("telescope.builtin").current_buffer_fuzzy_find(
require("telescope.themes").get_dropdown({ winblend = 10, previewer = false })
)
end,
desc = "Fuzzy find/search in current buffer fuzzy.",
},
{
"<leader>fh",
function()
require("telescope.builtin").help_tags()
end,
desc = "Find help",
},
{
"<leader>ff",
function()
require("telescope.builtin").find_files({
hidden = true,
})
end,
desc = "Find Files",
},
{
"<leader>fg",
function()
require("telescope.builtin").git_files({
hidden = true,
})
end,
desc = "Find Git only Files",
},
{
"<leader>fw",
function()
U.cmd_executable("rg", {
function()
require("telescope.builtin").live_grep({
hidden = true,
})
end,
function()
vim.notify("rg not installed, find words will not function.", 3)
end,
})
end,
desc = "Find Words",
},
{
"<leader>fc",
function()
require("telescope.builtin").commands()
end,
desc = "Find Commands",
},
{
"<leader>fk",
function()
require("telescope.builtin").keymaps()
end,
desc = "Find Keymap",
},
{
"<leader>fb",
function()
require("telescope.builtin").buffers()
end,
desc = "Find Buffer",
},
{
"<leader>lfr",
function()
require("telescope.builtin").lsp_references()
end,
desc = "Find LSP References",
mode = { "n", "v", "x" },
},
},
if package.loaded["notify"] then
ts.load_extension("notify")
U.keymaps({
{
"<leader>fn",
"<cmd>Telescope notify<cr>",
desc = "Telescope search notifications",
mode = { "n", "v", "x" },
},
})
end
end,
-- https://github.com/nvim-telescope/telescope.nvim?tab=readme-ov-file#pickers
keys = {
{
"<leader>fr",
function()
require("telescope.builtin").resume()
end,
desc = "Resume last telescope",
},
{
"<leader>f/",
function()
require("telescope.builtin").current_buffer_fuzzy_find(
require("telescope.themes").get_dropdown({ winblend = 10, previewer = false })
)
end,
desc = "Fuzzy find/search in current buffer fuzzy.",
},
{
"<leader>fh",
function()
require("telescope.builtin").help_tags()
end,
desc = "Find help",
},
{
"<leader>ff",
function()
require("telescope.builtin").find_files({
hidden = true,
})
end,
desc = "Find Files",
},
{
"<leader>fg",
function()
require("telescope.builtin").git_files({
hidden = true,
})
end,
desc = "Find Git only Files",
},
{
"<leader>fw",
function()
U.cmd_executable("rg", {
function()
require("telescope.builtin").live_grep({
hidden = true,
})
end,
function()
vim.notify("rg not installed, find words will not function.", 3)
end,
})
end,
desc = "Find Words",
},
{
"<leader>fc",
function()
require("telescope.builtin").commands()
end,
desc = "Find Commands",
},
{
"<leader>fk",
function()
require("telescope.builtin").keymaps()
end,
desc = "Find Keymap",
},
{
"<leader>fb",
function()
require("telescope.builtin").buffers()
end,
desc = "Find Buffer",
},
{
"<leader>lfr",
function()
require("telescope.builtin").lsp_references()
end,
desc = "Find LSP References",
mode = { "n", "v", "x" },
},
},
}

View file

@ -10,7 +10,7 @@ return {
{
"<leader>,c",
function()
if next(vim.lsp.buf_get_clients()) ~= nil then
if next(vim.lsp.get_active_clients()) ~= nil then
-- TODO test that this works
vim.cmd("TextCaseOpenTelescopeLSPChange")
else
@ -19,7 +19,6 @@ return {
end,
desc = "Change case of selection",
mode = { "n", "v", "x" },
silent = true, -- TODO add this to most things....
},
},
}