improvements, installed ollama gen
This commit is contained in:
parent
f2f93acdb8
commit
6b2b0c377a
11 changed files with 151 additions and 161 deletions
|
@ -184,7 +184,7 @@ return {
|
|||
build = ":MasonUpdate",
|
||||
opts = {},
|
||||
},
|
||||
{ "folke/neodev.nvim", opts = {} }, -- lua stuff
|
||||
{ "folke/neodev.nvim", opts = {} }, -- lua stuff
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
},
|
||||
|
@ -264,6 +264,7 @@ return {
|
|||
["<esc>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.abort()
|
||||
fallback()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
|
@ -286,11 +287,11 @@ return {
|
|||
-- TODO I am getting lag sometimes I think this may be the cause, limiting to 100 for a while to see what happens
|
||||
{ name = "nvim_lsp", priority = 8, max_item_count = 100 },
|
||||
-- This source integrates with LuaSnip, a snippet engine for Neovim. It suggests snippets that you can insert into your code
|
||||
{ name = "luasnip", priority = 7 },
|
||||
{ name = "luasnip", priority = 7 },
|
||||
-- This source provides file path completions, helping you to complete file paths in your code
|
||||
{ name = "path", priority = 7 },
|
||||
{ name = "path", priority = 7 },
|
||||
-- This source provides completion items from the current buffer, meaning it suggests words that have already been typed in the same file.
|
||||
{ name = "buffer", priority = 6 },
|
||||
{ name = "buffer", priority = 6 },
|
||||
-- Rust crates.io integration
|
||||
{ name = "crates" },
|
||||
},
|
||||
|
|
|
@ -1,24 +1,10 @@
|
|||
local function prereqs()
|
||||
local output_cspell = vim.fn.system({
|
||||
"which",
|
||||
"cspell",
|
||||
})
|
||||
if output_cspell == nil or output_cspell == "" or output_cspell == "cspell not found" then
|
||||
print("Installing cspell globally with npm")
|
||||
vim.fn.system({
|
||||
"npm",
|
||||
"install",
|
||||
"-g",
|
||||
"cspell",
|
||||
})
|
||||
end
|
||||
end
|
||||
local U = require("util")
|
||||
local cspell = U.cmd_executable("cspell")
|
||||
|
||||
return {
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
dependencies = { "williamboman/mason.nvim" },
|
||||
build = prereqs,
|
||||
opts = function(_, config)
|
||||
-- config variable is the default definitions table for the setup function call
|
||||
local null_ls = require("null-ls")
|
||||
|
@ -74,30 +60,41 @@ return {
|
|||
null_ls.builtins.formatting.prettier, -- typescript/javascript
|
||||
null_ls.builtins.formatting.stylua.with({
|
||||
extra_args = { "--indent-type", "spaces", "--indent-width", "2" },
|
||||
}), -- lua
|
||||
}), -- lua
|
||||
--null_ls.builtins.formatting.rustfmt, -- rust
|
||||
rust_formatter_genemichaels, -- order matters, run genemichaels first then rustfmt
|
||||
rust_formatter_rustfmt,
|
||||
-- rust_formatter_sqlx, -- see tools/sqlx-format.lua
|
||||
null_ls.builtins.formatting.black, -- python
|
||||
-- null_ls.builtins.code_actions.proselint, -- TODO looks interesting
|
||||
null_ls.builtins.code_actions.cspell.with({
|
||||
config = {
|
||||
find_json = function()
|
||||
return vim.fn.findfile("cspell.json", vim.fn.environ().HOME .. "/.config/nvim/;")
|
||||
end,
|
||||
},
|
||||
}),
|
||||
null_ls.builtins.diagnostics.cspell.with({
|
||||
extra_args = { "--config", "~/.config/nvim/cspell.json" },
|
||||
diagnostics_postprocess = function(diagnostic)
|
||||
-- vim.notify(vim.inspect(diagnostic))
|
||||
diagnostic.message = diagnostic.user_data.misspelled
|
||||
diagnostic.severity = vim.diagnostic.severity.HINT
|
||||
end,
|
||||
}),
|
||||
}
|
||||
|
||||
if cspell then
|
||||
table.insert(
|
||||
config.sources,
|
||||
null_ls.builtins.code_actions.cspell.with({
|
||||
config = {
|
||||
find_json = function()
|
||||
return vim.fn.findfile("cspell.json", vim.fn.environ().HOME .. "/.config/nvim/;")
|
||||
end,
|
||||
},
|
||||
})
|
||||
)
|
||||
table.insert(
|
||||
config.sources,
|
||||
null_ls.builtins.diagnostics.cspell.with({
|
||||
extra_args = { "--config", "~/.config/nvim/cspell.json" },
|
||||
diagnostics_postprocess = function(diagnostic)
|
||||
-- vim.notify(vim.inspect(diagnostic))
|
||||
diagnostic.message = diagnostic.user_data.misspelled
|
||||
diagnostic.severity = vim.diagnostic.severity.HINT
|
||||
end,
|
||||
})
|
||||
)
|
||||
else
|
||||
vim.notify("cspell is missing, spelling suggestions will not work", 2)
|
||||
end
|
||||
|
||||
config.update_in_insert = true
|
||||
config.debug = true
|
||||
|
||||
|
|
|
@ -1,17 +1,4 @@
|
|||
local function prereqs()
|
||||
local output = vim.fn.system({
|
||||
"which",
|
||||
"rg",
|
||||
})
|
||||
if output == nil or output == "" or string.find(output, "not installed for the toolchain") then
|
||||
print("Installing ripgrep globally with rtx")
|
||||
vim.fn.system({
|
||||
"rtx",
|
||||
"global",
|
||||
"ripgrep@latest",
|
||||
})
|
||||
end
|
||||
end
|
||||
local U = require("util")
|
||||
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
|
@ -21,7 +8,13 @@ return {
|
|||
{ "nvim-telescope/telescope-fzf-native.nvim", enabled = vim.fn.executable("make") == 1, build = "make" },
|
||||
{ "nvim-telescope/telescope-ui-select.nvim" },
|
||||
},
|
||||
build = prereqs,
|
||||
init = function()
|
||||
U.cmd_executable("rg", {
|
||||
[false] = function()
|
||||
vim.notify("rg not installed, live grep will not function.", 2)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
cmd = "Telescope",
|
||||
keys = {
|
||||
{ "<leader>f", "<Nop>", desc = "Find ..." },
|
||||
|
@ -53,11 +46,15 @@ return {
|
|||
{
|
||||
"<leader>fw",
|
||||
function()
|
||||
if vim.fn.executable("rg") == 0 then
|
||||
vim.notify("rg not installed, live grep will not function.", 3)
|
||||
end
|
||||
require("telescope.builtin").live_grep({
|
||||
hidden = true,
|
||||
U.cmd_executable("rg", {
|
||||
function()
|
||||
require("telescope.builtin").live_grep({
|
||||
hidden = true,
|
||||
})
|
||||
end,
|
||||
function()
|
||||
vim.notify("rg not installed, live grep will not function.", 3)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
desc = "Find Words",
|
||||
|
|
|
@ -1,12 +1,3 @@
|
|||
local auto = true
|
||||
local output = vim.fn.system({
|
||||
"which",
|
||||
"tree-sitter",
|
||||
})
|
||||
if output == nil or output == "" then
|
||||
auto = false
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
|
@ -67,7 +58,6 @@ return {
|
|||
"vue",
|
||||
"yaml",
|
||||
},
|
||||
-- auto_install = auto,
|
||||
highlight = {
|
||||
enable = true,
|
||||
use_languagetree = true,
|
||||
|
|
|
@ -26,6 +26,7 @@ return {
|
|||
["<leader>Q"] = { name = "+Q Quit and remove session" },
|
||||
["<leader>s"] = { name = "Scratch Files" },
|
||||
["<leader>t"] = { name = "Tabs" },
|
||||
["<leader>x"] = { name = "Generative AI, Ollama" },
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
return {
|
||||
"m4xshen/autoclose.nvim",
|
||||
opts = {},
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"simrat39/rust-tools.nvim",
|
||||
event = "BufEnter *.rs",
|
||||
dependencies = { "mason-lspconfig.nvim", "lvimuser/lsp-inlayhints.nvim" },
|
||||
opts = {},
|
||||
},
|
||||
{ "Saecki/crates.nvim", tag = "v0.3.0", dependencies = { "nvim-lua/plenary.nvim" }, opts = {} },
|
||||
}
|
|
@ -6,72 +6,81 @@ local scratch = function(extension)
|
|||
vim.cmd("execute 'edit " .. filepath .. "'")
|
||||
end
|
||||
|
||||
require("util").keymaps_old({
|
||||
n = {
|
||||
["<leader>fsw"] = {
|
||||
function()
|
||||
require("telescope.builtin").live_grep({
|
||||
search_dirs = { "~/dev/scratches/" },
|
||||
})
|
||||
end,
|
||||
desc = "Find Words in Scratches",
|
||||
},
|
||||
["<leader>fsf"] = {
|
||||
function()
|
||||
require("telescope.builtin").find_files({
|
||||
search_dirs = { "~/dev/scratches/" },
|
||||
})
|
||||
end,
|
||||
desc = "Find Scratches",
|
||||
},
|
||||
["<leader>s"] = { "<Nop>", desc = "Scratch File" },
|
||||
["<leader>ss"] = {
|
||||
function()
|
||||
scratch(".txt")
|
||||
end,
|
||||
desc = "New [t]e[xt] scratch file",
|
||||
},
|
||||
["<leader>sn"] = {
|
||||
function()
|
||||
scratch(".json")
|
||||
end,
|
||||
desc = "New json scratch file",
|
||||
},
|
||||
["<leader>sm"] = {
|
||||
function()
|
||||
scratch(".md")
|
||||
end,
|
||||
desc = "New [m]ark[d]own scratch file",
|
||||
},
|
||||
["<leader>sq"] = {
|
||||
function()
|
||||
scratch(".sql")
|
||||
end,
|
||||
desc = "New sql scratch file",
|
||||
},
|
||||
["<leader>st"] = {
|
||||
function()
|
||||
scratch(".ts")
|
||||
end,
|
||||
desc = "New [t]ype[s]cript scratch file",
|
||||
},
|
||||
["<leader>sb"] = {
|
||||
function()
|
||||
scratch(".sh")
|
||||
end,
|
||||
desc = "New [sh]ell scratch file",
|
||||
},
|
||||
["<leader>sj"] = {
|
||||
function()
|
||||
scratch(".js")
|
||||
end,
|
||||
desc = "New [j]ava[s]cript scratch file",
|
||||
},
|
||||
["<leader>sr"] = {
|
||||
function()
|
||||
scratch(".rs")
|
||||
end,
|
||||
desc = "New [r]u[s]t scratch file",
|
||||
},
|
||||
local U = require("util")
|
||||
|
||||
U.keymaps({
|
||||
{
|
||||
"<leader>fsw",
|
||||
function()
|
||||
require("telescope.builtin").live_grep({
|
||||
search_dirs = { "~/dev/scratches/" },
|
||||
})
|
||||
end,
|
||||
desc = "Find Words in Scratches",
|
||||
},
|
||||
{
|
||||
"<leader>fsf",
|
||||
function()
|
||||
require("telescope.builtin").find_files({
|
||||
search_dirs = { "~/dev/scratches/" },
|
||||
})
|
||||
end,
|
||||
desc = "Find Scratches",
|
||||
},
|
||||
{ "<leader>s", "<Nop>", desc = "Scratch File" },
|
||||
["<leader>ss"] = {
|
||||
function()
|
||||
scratch(".txt")
|
||||
end,
|
||||
desc = "New text scratch file",
|
||||
},
|
||||
{
|
||||
"<leader>sn",
|
||||
function()
|
||||
scratch(".json")
|
||||
end,
|
||||
desc = "New json scratch file",
|
||||
},
|
||||
{
|
||||
"<leader>sm",
|
||||
function()
|
||||
scratch(".md")
|
||||
end,
|
||||
desc = "New markdown scratch file",
|
||||
},
|
||||
{
|
||||
"<leader>sq",
|
||||
function()
|
||||
scratch(".sql")
|
||||
end,
|
||||
desc = "New sql scratch file",
|
||||
},
|
||||
{
|
||||
"<leader>st",
|
||||
function()
|
||||
scratch(".ts")
|
||||
end,
|
||||
desc = "New typescript scratch file",
|
||||
},
|
||||
{
|
||||
"<leader>sb",
|
||||
function()
|
||||
scratch(".sh")
|
||||
end,
|
||||
desc = "New shell scratch file",
|
||||
},
|
||||
{
|
||||
"<leader>sj",
|
||||
function()
|
||||
scratch(".js")
|
||||
end,
|
||||
desc = "New javascript scratch file",
|
||||
},
|
||||
{
|
||||
"<leader>sr",
|
||||
function()
|
||||
scratch(".rs")
|
||||
end,
|
||||
desc = "New rust scratch file",
|
||||
},
|
||||
})
|
||||
|
|
35
lua/util.lua
35
lua/util.lua
|
@ -1,23 +1,30 @@
|
|||
local M = {}
|
||||
|
||||
function M.keymaps_old(mappings)
|
||||
for mode, maps in pairs(mappings) do
|
||||
for keymap, options in pairs(maps) do
|
||||
if options then
|
||||
local cmd = options
|
||||
local keymap_opts = {}
|
||||
if type(options) == "table" then
|
||||
cmd = options[1]
|
||||
keymap_opts = vim.tbl_deep_extend("force", keymap_opts, options)
|
||||
keymap_opts[1] = nil
|
||||
end
|
||||
function M.cmd_executable(cmd, callback)
|
||||
local executable = vim.fn.executable(cmd) == 1
|
||||
-- Check if a callback is provided and it is a function
|
||||
if executable and callback and type(callback) == "function" then
|
||||
callback()
|
||||
end
|
||||
|
||||
if mode and keymap and cmd and keymap_opts then
|
||||
vim.keymap.set(mode, keymap, cmd, keymap_opts)
|
||||
end
|
||||
-- Check if a callback is provided and it is a table
|
||||
if type(callback) == "table" then
|
||||
if executable and (callback[1] or callback[true]) then
|
||||
-- Call the function associated with key 1 or true if the command is executable
|
||||
local func = callback[1] or callback[true]
|
||||
if type(func) == "function" then
|
||||
func()
|
||||
end
|
||||
elseif not executable and (callback[2] or callback[false]) then
|
||||
-- Call the function associated with key 2 or false if the command is not executable
|
||||
local func = callback[2] or callback[false]
|
||||
if type(func) == "function" then
|
||||
func()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return executable
|
||||
end
|
||||
|
||||
-- [1]: (string) lhs (required)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue