Many things are working
This commit is contained in:
parent
c42f197307
commit
4582bd5469
20 changed files with 715 additions and 300 deletions
|
@ -2,6 +2,11 @@ return {
|
|||
"Pocco81/auto-save.nvim",
|
||||
event = "BufEnter",
|
||||
opts = {
|
||||
execution_message = {
|
||||
message = function()
|
||||
return ""
|
||||
end,
|
||||
},
|
||||
trigger_events = { "InsertLeave", "TextChanged", "TextChangedI", "BufLeave" },
|
||||
condition = function(buf)
|
||||
local disallowed_filetypes = { "TelescopePrompt", "quickfix", "terminal" }
|
||||
|
|
26
lua/plugins/editor_comments.lua
Normal file
26
lua/plugins/editor_comments.lua
Normal file
|
@ -0,0 +1,26 @@
|
|||
return {
|
||||
"preservim/nerdcommenter",
|
||||
dependencies = {
|
||||
{
|
||||
-- This will auto change the commentstring option in files that could have varying
|
||||
-- comment modes like in jsx/markdown/files with embedded languages
|
||||
"JoosepAlviste/nvim-ts-context-commentstring",
|
||||
init = function()
|
||||
-- skip backwards compatibility routines and speed up loading
|
||||
vim.g.skip_ts_context_commentstring_module = true
|
||||
end,
|
||||
config = function()
|
||||
require("ts_context_commentstring").setup({})
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
vim.g.NERDCreateDefaultMappings = 0
|
||||
vim.g.NERDDefaultAlign = "both"
|
||||
vim.g.NERDSpaceDelims = 1
|
||||
vim.cmd("filetype plugin on")
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>/", "<Plug>NERDCommenterToggle<cr>k", mode = { "n", "x" } },
|
||||
},
|
||||
}
|
|
@ -4,7 +4,5 @@ return {
|
|||
event = "VeryLazy",
|
||||
opts = {
|
||||
retirementAgeMins = 1,
|
||||
notificationOnAutoClose = true,
|
||||
-- deleteBufferWhenFileDeleted = true,
|
||||
},
|
||||
}
|
||||
|
|
127
lua/plugins/editor_lua_line.lua
Normal file
127
lua/plugins/editor_lua_line.lua
Normal file
|
@ -0,0 +1,127 @@
|
|||
-- TODO checkout https://github.com/nvim-lua/lsp-status.nvim
|
||||
local function lsp_clients()
|
||||
local clients = {}
|
||||
for _, client in pairs(vim.lsp.buf_get_clients(0)) do
|
||||
local name = client.name
|
||||
-- TODO revisit this doesn't work
|
||||
if not client.initialized then
|
||||
name = name .. " (loading)"
|
||||
end
|
||||
clients[#clients + 1] = name
|
||||
end
|
||||
|
||||
table.sort(clients)
|
||||
return table.concat(clients, " • "), " "
|
||||
end
|
||||
|
||||
local function langs()
|
||||
local l = {}
|
||||
for _, client in pairs(vim.lsp.buf_get_clients(0)) do
|
||||
local out = nil
|
||||
if client.name == "pyright" then
|
||||
out = vim.fn.system({ "python", "-V" })
|
||||
elseif client.name == "tsserver" then
|
||||
out = "node " .. vim.fn.system({ "node", "--version" })
|
||||
end
|
||||
if out ~= nil and out ~= "" then
|
||||
l[#l + 1] = vim.trim(out)
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(l)
|
||||
return table.concat(l, " • "), " "
|
||||
end
|
||||
|
||||
local function latest_message()
|
||||
return U.safeRequire("noice", function(n)
|
||||
return n.api.status.message.get_hl
|
||||
end, U.fnEmptyStr)
|
||||
end
|
||||
|
||||
local function latest_message_cond()
|
||||
return U.safeRequire("noice", function(n)
|
||||
return n.api.status.message.has
|
||||
end, U.fnFalse)
|
||||
end
|
||||
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { { "folke/noice.nvim", optional = true } },
|
||||
lazy = false,
|
||||
opts = function()
|
||||
return {
|
||||
options = {
|
||||
theme = "codedark",
|
||||
section_separators = { left = "", right = "" },
|
||||
component_separators = "|",
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diff", "diagnostics" },
|
||||
lualine_c = {
|
||||
{ "filename", separator = { right = "" } },
|
||||
{ "reg_recording", icon = { "" }, color = { fg = "#D37676" } },
|
||||
{ latest_message, cond = latest_message_cond },
|
||||
},
|
||||
lualine_x = {
|
||||
lsp_clients,
|
||||
langs,
|
||||
"encoding",
|
||||
"filetype",
|
||||
"filesize",
|
||||
},
|
||||
lualine_y = { "searchcount", "selectioncount" },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
winbar = {
|
||||
lualine_a = {
|
||||
{
|
||||
"filename",
|
||||
symbols = {
|
||||
modified = "", -- Text to show when the file is modified.
|
||||
readonly = "[-]", -- Text to show when the file is non-modifiable or readonly.
|
||||
unnamed = "[No Name]", -- Text to show for unnamed buffers.
|
||||
newfile = "[New]", -- Text to show for newly created file before first write
|
||||
},
|
||||
},
|
||||
},
|
||||
lualine_b = {
|
||||
"mode",
|
||||
},
|
||||
},
|
||||
inactive_winbar = {
|
||||
lualine_a = {
|
||||
{
|
||||
"filename",
|
||||
symbols = {
|
||||
modified = "", -- Text to show when the file is modified.
|
||||
readonly = "[-]", -- Text to show when the file is non-modifiable or readonly.
|
||||
unnamed = "[No Name]", -- Text to show for unnamed buffers.
|
||||
newfile = "[New]", -- Text to show for newly created file before first write
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("lualine").setup(opts)
|
||||
|
||||
local ref = function()
|
||||
require("lualine").refresh({
|
||||
place = { "statusline" },
|
||||
})
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("RecordingEnter", {
|
||||
callback = ref,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("RecordingLeave", {
|
||||
callback = function()
|
||||
local timer = vim.loop.new_timer()
|
||||
timer:start(50, 0, vim.schedule_wrap(ref))
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
|
@ -2,12 +2,12 @@ return {
|
|||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
cmdline = {
|
||||
format = {
|
||||
conceal = {
|
||||
pattern = "^noh"
|
||||
},
|
||||
},
|
||||
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**
|
||||
|
|
|
@ -1,27 +1,12 @@
|
|||
return {
|
||||
"rcarriga/nvim-notify",
|
||||
-- dependencies = { "nvim-telescope/telescope.nvim", optional = true },
|
||||
lazy = false,
|
||||
priority = 999,
|
||||
priority = 150,
|
||||
opts = {
|
||||
top_down = false,
|
||||
timeout = 3000,
|
||||
timeout = 5000,
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("notify").setup(opts)
|
||||
vim.notify = require("notify")
|
||||
|
||||
-- TODO move to telescope instead...
|
||||
-- if package.loaded["telescope"] then
|
||||
-- require("telescope").load_extension("notify")
|
||||
-- require("util").keymaps({
|
||||
-- {
|
||||
-- "<leader>fn",
|
||||
-- "<cmd>Telescope notify<cr>",
|
||||
-- desc = "Telescope search notifications",
|
||||
-- mode = { "n", "v", "x" },
|
||||
-- },
|
||||
-- })
|
||||
-- end
|
||||
end,
|
||||
}
|
||||
|
|
32
lua/plugins/editor_whichkey.lua
Normal file
32
lua/plugins/editor_whichkey.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
return {
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 250
|
||||
end,
|
||||
opts = {
|
||||
window = {
|
||||
border = "single",
|
||||
winblend = 10,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local wk = require("which-key")
|
||||
wk.setup(opts)
|
||||
wk.register({
|
||||
["<leader>b"] = { name = "Buffers" },
|
||||
["<leader>t"] = { name = "Tabs" },
|
||||
-- ["<leader>,"] = { name = "Miscellaneous Tools" },
|
||||
-- ["<leader>c"] = { name = "Copilot" },
|
||||
["<leader>f"] = { name = "Find [Telescope]" },
|
||||
-- ["<leader>fs"] = { name = "Find in Scratches [Telescope]" },
|
||||
-- ["<leader>g"] = { name = "Git" },
|
||||
["<leader>l"] = { name = "LSP" },
|
||||
["<leader>lf"] = { name = "LSP Find" },
|
||||
-- ["<leader>Q"] = { name = "+Q Quit and remove session" },
|
||||
-- ["<leader>s"] = { name = "Scratch Files" },
|
||||
-- ["<leader>x"] = { name = "Generative AI, Ollama" },
|
||||
})
|
||||
end,
|
||||
}
|
154
lua/plugins/telescope.lua
Normal file
154
lua/plugins/telescope.lua
Normal file
|
@ -0,0 +1,154 @@
|
|||
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")
|
||||
|
||||
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>fj",
|
||||
function()
|
||||
require("telescope.builtin").current_buffer_fuzzy_find()
|
||||
end,
|
||||
desc = "Fuzzy find/search in current buffer fuzzy.",
|
||||
},
|
||||
{
|
||||
"<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 Commands",
|
||||
},
|
||||
{
|
||||
"<leader>fb",
|
||||
function()
|
||||
require("telescope.builtin").buffers()
|
||||
end,
|
||||
desc = "Find Commands",
|
||||
},
|
||||
{
|
||||
"<leader>lfr",
|
||||
function()
|
||||
require("telescope.builtin").lsp_references()
|
||||
end,
|
||||
desc = "Find References",
|
||||
mode = { "n", "v", "x" },
|
||||
},
|
||||
},
|
||||
}
|
56
lua/plugins/treesitter.lua
Normal file
56
lua/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,56 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
dependencies = { "windwp/nvim-ts-autotag", "JoosepAlviste/nvim-ts-context-commentstring" },
|
||||
init = function()
|
||||
U.cmd_executable("tree-sitter", {
|
||||
[false] = function()
|
||||
vim.notify("tree-sitter not installed, code syntax will be broken.", 2)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
event = "BufRead",
|
||||
cmd = {
|
||||
"TSBufDisable",
|
||||
"TSBufEnable",
|
||||
"TSBufToggle",
|
||||
"TSDisable",
|
||||
"TSEnable",
|
||||
"TSToggle",
|
||||
"TSInstall",
|
||||
"TSInstallInfo",
|
||||
"TSInstallSync",
|
||||
"TSModuleInfo",
|
||||
"TSUninstall",
|
||||
"TSUpdate",
|
||||
"TSUpdateSync",
|
||||
},
|
||||
opts = function()
|
||||
local nonNixOpts = {}
|
||||
if not NIX then
|
||||
nonNixOpts = {
|
||||
ensure_installed = "all",
|
||||
}
|
||||
end
|
||||
return U.assign({
|
||||
highlight = {
|
||||
enable = true,
|
||||
use_languagetree = true,
|
||||
disable = function(_, bufnr)
|
||||
return vim.api.nvim_buf_line_count(bufnr) > 10000
|
||||
end,
|
||||
-- additional_vim_regex_highlighting = false,
|
||||
},
|
||||
incremental_selection = { enable = true },
|
||||
ident = { enable = true },
|
||||
autotag = { enable = true },
|
||||
rainbow = {
|
||||
enable = true,
|
||||
extended_mode = true,
|
||||
max_file_lines = nil,
|
||||
},
|
||||
}, nonNixOpts)
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
end,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue