Everything but LSP is finished!
This commit is contained in:
parent
78f04bda73
commit
e54f6ee975
23 changed files with 530 additions and 100 deletions
|
@ -9,44 +9,25 @@ vim.api.nvim_create_autocmd("TextYankPost", {
|
|||
end,
|
||||
})
|
||||
|
||||
--function isEmpty()
|
||||
--return vim.api.nvim_buf_get_name(0) == ""
|
||||
--or vim.fn.filereadable(vim.api.nvim_buf_get_name(0)) == 0
|
||||
--or vim.fn.line("$") == 1 and vim.fn.col("$") == 1
|
||||
--end
|
||||
|
||||
--vim.api.nvim_create_autocmd({ "VimEnter" }, {
|
||||
-- callback = function()
|
||||
-- if isEmpty() then
|
||||
-- require('telescope.builtin').find_files()
|
||||
-- end
|
||||
-- end
|
||||
--})
|
||||
|
||||
-- TODO is there a better way for these?
|
||||
vim.api.nvim_create_autocmd("BufRead", {
|
||||
pattern = ".env*",
|
||||
command = "set filetype=sh",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufRead", {
|
||||
pattern = ".*rc",
|
||||
command = "set filetype=sh",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufRead", {
|
||||
pattern = "Dockerfile.*",
|
||||
command = "set filetype=dockerfile",
|
||||
})
|
||||
vim.api.nvim_create_autocmd("BufRead", {
|
||||
pattern = "*.http",
|
||||
command = "set filetype=http",
|
||||
})
|
||||
|
||||
if vim.fn.exists(":CccHighlighterEnable") ~= 0 then
|
||||
vim.api.nvim_create_autocmd("BufRead", {
|
||||
callback = function()
|
||||
vim.cmd.CccHighlighterEnable()
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- AUto exit insert mode whenever we switch screens
|
||||
-- Auto exit insert mode whenever we switch screens
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||
callback = function()
|
||||
if vim.bo.filetype ~= "TelescopePrompt" and vim.bo.filetype ~= nil and vim.bo.filetype ~= "" then
|
||||
|
@ -55,18 +36,6 @@ vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
|||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter" }, {
|
||||
pattern = "*.http",
|
||||
command = "set filetype=http",
|
||||
})
|
||||
|
||||
--vim.api.nvim_create_autocmd('BufEnter', {
|
||||
-- callback = function ()
|
||||
-- local ts_avail, parsers = pcall(require, "nvim-treesitter.parsers")
|
||||
-- if ts_avail and parsers.has_parser() then vim.cmd.TSBufEnable "highlight" end
|
||||
-- end,
|
||||
--})
|
||||
|
||||
vim.api.nvim_create_autocmd("VimLeavePre", {
|
||||
callback = function()
|
||||
vim.cmd("NvimTreeClose")
|
||||
|
|
|
@ -22,23 +22,23 @@ U.keymaps({
|
|||
{ ";", ":", desc = "No shift to enter command mode with semicolon. Alias ; to :", mode = nvx },
|
||||
{ "<leader>Q", "<nop>", mode = nvx }, -- don't do normal Q quit
|
||||
{ "<leader>a", "<esc>ggVG", desc = "Select all", mode = nvx },
|
||||
{ "Q", "<cmd>qa<CR>", desc = "Quit all", mode = nvx },
|
||||
{ "Q", "<cmd>SessionSave<cr><cmd>qa!<cr>", desc = "Quit all", mode = nvx },
|
||||
{ "<leader>y", '"+y', desc = "Copy to system clipboard", mode = nvx },
|
||||
{ "<leader>p", '"+p', desc = "Paste from system clipboard", mode = nvx },
|
||||
{ "<esc>", "<cmd>nohlsearch<CR><esc>", desc = "Clear search on escape" },
|
||||
{ "<return>", "<cmd>nohlsearch<CR><return>", desc = "Clear search on return" },
|
||||
{ "<esc>", "<cmd>nohlsearch<cr><esc>", desc = "Clear search on escape" },
|
||||
{ "<return>", "<cmd>nohlsearch<cr><return>", desc = "Clear search on return" },
|
||||
{ "|", "<cmd>vsplit<cr>", desc = "Vertical Split" },
|
||||
{ "\\", "<cmd>split<cr>", desc = "Horizontal Split" },
|
||||
{ "<S-Tab>", "<C-o>", desc = "Go back <C-o>" },
|
||||
{
|
||||
"J",
|
||||
":m '>+1<CR>gv=gv",
|
||||
":m '>+1<cr>gv=gv",
|
||||
desc = "Visually move block down",
|
||||
mode = "v",
|
||||
},
|
||||
{
|
||||
"K",
|
||||
":m '<-2<CR>gv=gv",
|
||||
":m '<-2<cr>gv=gv",
|
||||
desc = "Visually move block up",
|
||||
mode = "v",
|
||||
},
|
||||
|
@ -53,7 +53,7 @@ U.keymaps({
|
|||
-- * if non empty buffer, we will simply open a new empty buffer unless
|
||||
-- it is in the close always list
|
||||
-- * if empty buffer, then we will quit this buffer
|
||||
local close_always = { "quickfix", "help", "nofile" }
|
||||
local close_always = { "quickfix", "help", "nofile", "httpResult" }
|
||||
if
|
||||
U.table_contains(close_always, vim.bo.buftype)
|
||||
or (vim.api.nvim_buf_line_count(0) == 1 and vim.api.nvim_buf_get_lines(0, 0, 1, -1)[1] == "")
|
||||
|
|
|
@ -27,6 +27,9 @@ vim.opt.hlsearch = false
|
|||
-- Wrap lines in files
|
||||
vim.opt.wrap = true
|
||||
|
||||
-- Keep signcolumn on by default
|
||||
vim.opt.signcolumn = "yes"
|
||||
|
||||
-- preseve indentation of virtual wrapped lines
|
||||
vim.opt.breakindent = true
|
||||
|
||||
|
@ -49,7 +52,7 @@ vim.opt.undofile = true
|
|||
-- See `:help 'list'`
|
||||
-- and `:help 'listchars'`
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
|
||||
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣", eol = "↴" }
|
||||
-- TODO REVISIT IF I WANT THESE
|
||||
|
||||
-- Search settings
|
||||
|
|
16
lua/plugins/color_picker.lua
Normal file
16
lua/plugins/color_picker.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
"uga-rosa/ccc.nvim",
|
||||
event = "BufEnter",
|
||||
opts = { auto_enable = true, lsp = true, point_char = "" },
|
||||
config = function(_, opts)
|
||||
require("ccc").setup(opts)
|
||||
vim.api.nvim_create_autocmd("BufRead", {
|
||||
callback = function()
|
||||
vim.cmd.CccHighlighterEnable()
|
||||
end,
|
||||
})
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>,p", "<cmd>CccPick<cr>", desc = "Color Picker", mode = { "n", "v", "x" } },
|
||||
},
|
||||
}
|
|
@ -21,6 +21,6 @@ return {
|
|||
vim.cmd("filetype plugin on")
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>/", "<Plug>NERDCommenterToggle<cr>k", mode = { "n", "x" } },
|
||||
{ "<leader>/", "<Plug>NERDCommenterToggle<cr>k", mode = { "n", "x" }, desc = "Toggle comments on line/selection" },
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
-- TODO checkout https://github.com/nvim-lua/lsp-status.nvim
|
||||
-- https://www.reddit.com/r/neovim/comments/o4bguk/comment/h2kcjxa/
|
||||
local function lsp_clients()
|
||||
local clients = {}
|
||||
for _, client in pairs(vim.lsp.buf_get_clients(0)) do
|
||||
|
@ -32,16 +33,23 @@ local function langs()
|
|||
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 last_blame = nil
|
||||
local last_blame_time = vim.loop.now()
|
||||
local function gitblame()
|
||||
local d = vim.b.gitsigns_blame_line_dict
|
||||
|
||||
local function latest_message_cond()
|
||||
return U.safeRequire("noice", function(n)
|
||||
return n.api.status.message.has
|
||||
end, U.fnFalse)
|
||||
if d then
|
||||
last_blame = d
|
||||
last_blame_time = vim.loop.now()
|
||||
elseif vim.loop.now() - last_blame_time <= 2000 then
|
||||
d = last_blame
|
||||
end
|
||||
|
||||
if d then
|
||||
local ok, res = pcall(os.date, "%d %b %y", d.committer_time)
|
||||
return d.committer .. " - " .. (ok and res or d.committer_time)
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
return {
|
||||
|
@ -61,7 +69,7 @@ return {
|
|||
lualine_c = {
|
||||
{ "filename", separator = { right = "" } },
|
||||
{ "reg_recording", icon = { "" }, color = { fg = "#D37676" } },
|
||||
{ latest_message, cond = latest_message_cond },
|
||||
{ gitblame, color = { fg = "#696969" } },
|
||||
},
|
||||
lualine_x = {
|
||||
lsp_clients,
|
||||
|
|
12
lua/plugins/floatterm.lua
Normal file
12
lua/plugins/floatterm.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
return {
|
||||
"voldikss/vim-floaterm",
|
||||
cmd = { "FloatermToggle" },
|
||||
keys = {
|
||||
{
|
||||
"<C-x>",
|
||||
"<cmd>FloatermToggle<cr>",
|
||||
desc = "Toggle float terminal",
|
||||
mode = { "n", "i", "v", "x", "c", "t" },
|
||||
},
|
||||
},
|
||||
}
|
53
lua/plugins/git_diff.lua
Normal file
53
lua/plugins/git_diff.lua
Normal file
|
@ -0,0 +1,53 @@
|
|||
return {
|
||||
"sindrets/diffview.nvim",
|
||||
opts = {
|
||||
diff_binaries = false,
|
||||
enhanced_diff_hl = true,
|
||||
git_cmd = { "git" },
|
||||
use_icons = true,
|
||||
icons = {
|
||||
folder_closed = "",
|
||||
folder_open = "",
|
||||
},
|
||||
signs = {
|
||||
fold_closed = "",
|
||||
fold_open = "",
|
||||
},
|
||||
view = {
|
||||
merge_tool = {
|
||||
layout = "diff3_mixed",
|
||||
disable_diagnostics = true,
|
||||
},
|
||||
},
|
||||
file_panel = {
|
||||
listing_style = "tree",
|
||||
tree_options = {
|
||||
flatten_dirs = true,
|
||||
folder_statuses = "only_folded",
|
||||
},
|
||||
win_config = {
|
||||
position = "left",
|
||||
width = 35,
|
||||
},
|
||||
},
|
||||
file_history_panel = {
|
||||
log_options = {
|
||||
git = {
|
||||
single_file = {
|
||||
diff_merges = "combined",
|
||||
},
|
||||
multi_file = {
|
||||
diff_merges = "first-parent",
|
||||
},
|
||||
},
|
||||
},
|
||||
win_config = {
|
||||
position = "bottom",
|
||||
height = 16,
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>gd", "<cmd>DiffviewOpen<cr>", desc = "Opens git diff view." },
|
||||
},
|
||||
}
|
35
lua/plugins/git_signs.lua
Normal file
35
lua/plugins/git_signs.lua
Normal file
|
@ -0,0 +1,35 @@
|
|||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = "BufEnter",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = function()
|
||||
local highlight = U.highlight
|
||||
highlight("GitGutterAdd", { fg = "#688066", gui = "nocombine" })
|
||||
highlight("GitGutterUntracked", { fg = "#688066", gui = "nocombine" })
|
||||
highlight("GitGutterChange", { fg = "#666f80", gui = "nocombine" })
|
||||
highlight("GitGutterDelete", { fg = "#806666", gui = "nocombine" })
|
||||
highlight("GitGutterChangeDelete", { fg = "#806666", gui = "nocombine" })
|
||||
|
||||
return {
|
||||
watch_gitdir = {
|
||||
interval = 100,
|
||||
},
|
||||
signs = {
|
||||
add = { hl = "GitGutterAdd" },
|
||||
change = { hl = "GitGutterChange" },
|
||||
delete = { hl = "GitGutterDelete" },
|
||||
topdelete = { hl = "GitGutterDelete" },
|
||||
changedelete = { hl = "GitGutterChangeDelete" },
|
||||
untracked = { hl = "GitGutterUntracked" },
|
||||
},
|
||||
current_line_blame = true,
|
||||
current_line_blame_opts = {
|
||||
delay = 0,
|
||||
virt_text = false,
|
||||
},
|
||||
}
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("gitsigns").setup(opts)
|
||||
end,
|
||||
}
|
9
lua/plugins/github_open.lua
Normal file
9
lua/plugins/github_open.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
"Almo7aya/openingh.nvim",
|
||||
cmd = { "OpenInGHFile", "OpenInGHFileLines" },
|
||||
keys = {
|
||||
{ "<leader>gf", "<cmd>OpenInGHFile<CR>", desc = "Open in git" },
|
||||
{ "<leader>gf", ":OpenInGHFileLines<CR>", desc = "Open in git", mode = { "v", "x" } },
|
||||
},
|
||||
}
|
||||
|
9
lua/plugins/illuminate.lua
Normal file
9
lua/plugins/illuminate.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
-- This plugin will smartly highlight the token under the cursor.
|
||||
return {
|
||||
"RRethy/vim-illuminate",
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
config = function(_, opts)
|
||||
require("illuminate").configure(opts)
|
||||
end,
|
||||
}
|
49
lua/plugins/indent_indicators.lua
Normal file
49
lua/plugins/indent_indicators.lua
Normal file
|
@ -0,0 +1,49 @@
|
|||
return {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
scope = {
|
||||
enabled = true,
|
||||
char = "┊",
|
||||
show_start = false,
|
||||
show_end = false,
|
||||
highlight = {
|
||||
"IndentBlanklineScope1",
|
||||
"IndentBlanklineScope2",
|
||||
"IndentBlanklineScope3",
|
||||
"IndentBlanklineScope4",
|
||||
"IndentBlanklineScope5",
|
||||
},
|
||||
},
|
||||
indent = {
|
||||
char = "│",
|
||||
highlight = {
|
||||
"IndentBlanklineIndent1",
|
||||
"IndentBlanklineIndent2",
|
||||
"IndentBlanklineIndent3",
|
||||
"IndentBlanklineIndent4",
|
||||
"IndentBlanklineIndent5",
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
U.highlight("NonText", { fg = "#303030", gui = "nocombine" })
|
||||
|
||||
local hooks = require("ibl.hooks")
|
||||
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
|
||||
vim.api.nvim_set_hl(0, "IndentBlanklineIndent1", { fg = "#915053" })
|
||||
vim.api.nvim_set_hl(0, "IndentBlanklineIndent2", { fg = "#A27F3E" })
|
||||
vim.api.nvim_set_hl(0, "IndentBlanklineIndent3", { fg = "#6B7F6E" })
|
||||
vim.api.nvim_set_hl(0, "IndentBlanklineIndent4", { fg = "#5a74aa" })
|
||||
vim.api.nvim_set_hl(0, "IndentBlanklineIndent5", { fg = "#6B6282" })
|
||||
|
||||
vim.api.nvim_set_hl(0, "IndentBlanklineScope1", { fg = "#CB5D60" })
|
||||
vim.api.nvim_set_hl(0, "IndentBlanklineScope2", { fg = "#DEA93F" })
|
||||
vim.api.nvim_set_hl(0, "IndentBlanklineScope3", { fg = "#89B790" })
|
||||
vim.api.nvim_set_hl(0, "IndentBlanklineScope4", { fg = "#6289E5" })
|
||||
vim.api.nvim_set_hl(0, "IndentBlanklineScope5", { fg = "#917DC0" })
|
||||
end)
|
||||
|
||||
require("ibl").setup(opts)
|
||||
end,
|
||||
}
|
10
lua/plugins/markdown_glow.lua
Normal file
10
lua/plugins/markdown_glow.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
"lnc3l0t/glow.nvim",
|
||||
opts = {
|
||||
default_type = "keep",
|
||||
},
|
||||
cmd = "Glow",
|
||||
keys = {
|
||||
{ "<leader>,m", "<cmd>Glow<cr>", desc = "Markdown preview" },
|
||||
},
|
||||
}
|
|
@ -2,7 +2,7 @@ return {
|
|||
"rmagatti/auto-session",
|
||||
lazy = false,
|
||||
init = function()
|
||||
vim.o.sessionoptions = "blank,buffers,curdir,folds,tabpages,winsize,winpos,terminal,localoptions"
|
||||
vim.o.sessionoptions = "blank,buffers,curdir,folds,tabpages,winsize,winpos,terminal"
|
||||
end,
|
||||
opts = {
|
||||
auto_session_use_git_branch = true,
|
||||
|
|
4
lua/plugins/surround.lua
Normal file
4
lua/plugins/surround.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
"tpope/vim-surround",
|
||||
event = "VeryLazy",
|
||||
}
|
25
lua/plugins/text_case.lua
Normal file
25
lua/plugins/text_case.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
return {
|
||||
"johmsalas/text-case.nvim",
|
||||
dependencies = { "nvim-telescope/telescope.nvim" },
|
||||
cmd = "TextCaseOpenTelescope",
|
||||
config = function(_, opts)
|
||||
require("textcase").setup(opts)
|
||||
require("telescope").load_extension("textcase")
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<leader>,c",
|
||||
function()
|
||||
if next(vim.lsp.buf_get_clients()) ~= nil then
|
||||
-- TODO test that this works
|
||||
vim.cmd("TextCaseOpenTelescopeLSPChange")
|
||||
else
|
||||
vim.cmd("TextCaseOpenTelescope")
|
||||
end
|
||||
end,
|
||||
desc = "Change case of selection",
|
||||
mode = { "n", "v", "x" },
|
||||
silent = true, -- TODO add this to most things....
|
||||
},
|
||||
},
|
||||
}
|
6
lua/plugins/undotree.lua
Normal file
6
lua/plugins/undotree.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
"mbbill/undotree",
|
||||
keys = {
|
||||
{ "<leader>u", vim.cmd.UndotreeToggle, desc = "Undo Tree Toggle" },
|
||||
},
|
||||
}
|
|
@ -15,15 +15,15 @@ return {
|
|||
local wk = require("which-key")
|
||||
wk.setup(opts)
|
||||
wk.register({
|
||||
["<leader>b"] = { name = "Buffers" },
|
||||
["<leader>t"] = { name = "Tabs" },
|
||||
-- ["<leader>,"] = { name = "Miscellaneous Tools" },
|
||||
["<leader>b"] = { name = "Buffers", mode = { "n", "x", "v", "c" } },
|
||||
["<leader>t"] = { name = "Tabs", mode = { "n", "x", "v", "c" } },
|
||||
["<leader>,"] = { name = "Miscellaneous Tools", mode = { "n", "x", "v", "c" } },
|
||||
-- ["<leader>c"] = { name = "Copilot" },
|
||||
["<leader>f"] = { name = "Find [Telescope]" },
|
||||
["<leader>f"] = { name = "Find [Telescope]", mode = { "n", "x", "v", "c" } },
|
||||
-- ["<leader>fs"] = { name = "Find in Scratches [Telescope]" },
|
||||
-- ["<leader>g"] = { name = "Git" },
|
||||
["<leader>l"] = { name = "LSP" },
|
||||
["<leader>lf"] = { name = "LSP Find" },
|
||||
["<leader>g"] = { name = "Git", mode = { "n", "x", "v", "c" } },
|
||||
["<leader>l"] = { name = "LSP", mode = { "n", "x", "v", "c" } },
|
||||
["<leader>lf"] = { name = "LSP Find", mode = { "n", "x", "v", "c" } },
|
||||
-- ["<leader>Q"] = { name = "+Q Quit and remove session" },
|
||||
-- ["<leader>s"] = { name = "Scratch Files" },
|
||||
-- ["<leader>x"] = { name = "Generative AI, Ollama" },
|
||||
|
|
12
lua/util.lua
12
lua/util.lua
|
@ -128,6 +128,18 @@ function M.safeRequire(module, func, errorFunc)
|
|||
return nil
|
||||
end
|
||||
|
||||
-- TODO remove if not needed
|
||||
-- local startup_time = vim.loop.now()
|
||||
-- function M.delayFromStartup(delay, func)
|
||||
-- local current_time = vim.loop.now()
|
||||
-- local diff = current_time - startup_time
|
||||
-- if diff >= delay then
|
||||
-- func()
|
||||
-- else
|
||||
-- vim.defer_fn(func, (delay - diff))
|
||||
-- end
|
||||
-- end
|
||||
|
||||
function M.fnFalse()
|
||||
return false
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue