diff --git a/after/plugin/highlight.vim b/after/plugin/highlight.vim index 5f3e3dd..caaf8a3 100644 --- a/after/plugin/highlight.vim +++ b/after/plugin/highlight.vim @@ -10,3 +10,5 @@ " GuiGua selected item (navigator etc ) au BufEnter * hi GuihuaListSelHl gui=underline guibg=bg +au BufEnter * hi TabLineFill NONE +au BufEnter * hi TabLine NONE diff --git a/after/plugin/theme.lua b/after/plugin/theme.lua index cdc565a..8497498 100644 --- a/after/plugin/theme.lua +++ b/after/plugin/theme.lua @@ -17,6 +17,10 @@ local highlights = { Comment = { fg = c.change_hex_lightness(colors["one_bg"], 20), }, + St_file_sep_rev = { + fg = colors.statusline_bg, + bg = colors.lightbg, + } } function set_hl() diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index 9b1a7b9..5f32322 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -89,6 +89,7 @@ M.general = { --{{{ ["d"] = { "DelayTrainToggle", "disable delay train" }, + ["dgH"] = { ":lua require'spike.diagnostics'.set_diagnostics_level(-1)", "hide all diagnostics"}, ["dge"] = { ":lua require'spike.diagnostics'.set_diagnostics_level(1)", "diagnostic severity level error"}, ["dgw"] = { ":lua require'spike.diagnostics'.set_diagnostics_level(2)", "diagnostic severity level warning"}, ["dgi"] = { ":lua require'spike.diagnostics'.set_diagnostics_level(3)", "diagnostic severity level info"}, @@ -971,7 +972,9 @@ M["todo-comments"] = { plugin = true, n = { ["]t"] = { " lua require'todo-comments'.jump_next()", "jump to next todo" }, - ["[t"] = { " lua require'todo-comments'.jump_prev()", "jump to prev todo" } + ["[t"] = { " lua require'todo-comments'.jump_prev()", "jump to prev todo" }, + ["qt"] = { " TodoQuickFix ", "todo quickfix" }, + ["ft"] = { " TodoTelescope ", "todo telescope" }, } } diff --git a/lua/core/options.lua b/lua/core/options.lua index 90ca694..cec405e 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -19,6 +19,8 @@ if g.vim_version < 8 then end opt.laststatus = 3 -- global statusline +-- for statusline format see lua/custom/plugins/nvchadui.lua +opt.cmdheight = 1 opt.showmode = false opt.title = true @@ -60,6 +62,9 @@ opt.iskeyword:remove(".") opt.iskeyword:remove("#") opt.iskeyword:remove("-") +-- remove `=` from is fname +opt.isfname:remove("=") + -- -- folding with tree sitter -- opt.foldmethod=expr diff --git a/lua/custom/chadrc.lua b/lua/custom/chadrc.lua index c390e59..3fca461 100644 --- a/lua/custom/chadrc.lua +++ b/lua/custom/chadrc.lua @@ -7,6 +7,8 @@ local colors = { flashred = "#ff4848", } +local highlights = require "custom.highlights" + -- make sure you maintain the structure of `core/default_config.lua` here, -- example of changing theme: -- @@ -16,118 +18,9 @@ local colors = { M.ui = { theme = "gruvbox_material", theme_toggle = { "gruvbox_material", "gruvbox_light" }, - hl_override = { - IndentBlanklineContextChar = { - fg = "yellow", - nocombine = true, - }, - Comment = { - fg = "light_grey" - }, - CursorLine = { - bg = "one_bg3" - }, - DiagnosticWarn = { - fg = "yellow", - italic = true, - }, - St_LspWarning = { - fg = "yellow" - }, - DiagnosticHint = { - fg = "purple", - italic = true, - }, - St_LspHints = { - fg = "pruple", - }, - DiagnosticError = { - italic = true, - }, - St_LspInfo = { - fg = "white" - }, - }, - hl_add = { - Visual = { - bg = "blue", - fg = "black", - }, - BookmarkSign = { - fg = "blue", - }, - BookmarkAnnotationSign = { - fg = "yellow", - }, - BookmarkAnnotationLine = { - fg = "black", - bg = "yellow" - }, - DiagnosticInfo = { -- nvchad uses DiagnosticInformation wrong hi group for lsp - fg = "white", - italic = true, - }, - DiagnosticFloatingInfo = { - fg = "white", - italic = true, - }, - DiagnosticUnderlineError = { - fg = "black", - bg = "pink", - }, - -- Code Lens related colors - LspCodeLens = { - fg = "vibrant_green", - underline = true, - }, - LspDiagnosticsSignHint = { -- LspDiagnostics Code Action - fg = "vibrant_green", - italic = true, - }, - -- end of code lens colors - DiffText = { - bg = "vigrant_green" - }, - St_DapMode = { - fg = "black2", - bg = "baby_pink", - }, - St_DapModeSep = { - fg = "baby_pink", - bg = "one_bg3", - }, - St_DapModeSep2 = { - fg = "grey", - bg = "baby_pink", - }, - DapBreakpoint = { - fg = "green" - }, - DapStopped = { - fg = "#ff4848" - }, - DapLogPoint = { - fg = "vibrant_green" - }, - DapBreakpointCondition = { - fg = "cyan" - }, - DapBreakpointRejected = { - fg = "purple" - }, - LuaSnipChoice = { - fg = "yellow", - bg = "one_bg3", - }, - LuaSnipInsert = { - fg = "teal", - -- bg = "one_bg3", - }, - NvimDapVirtualText = { - fg = '#f99540' - } - - }, + transparency = true, + hl_override = highlights.override, + hl_add = highlights.add, -- hl_override = { -- CursorLine = { -- underline = 1 @@ -155,6 +48,9 @@ M.plugins = { overriden_modules = function() return require "custom.plugins.nvchadui" end + }, + tabufline = { + enabled = false, } diff --git a/lua/custom/highlights.lua b/lua/custom/highlights.lua new file mode 100644 index 0000000..41f4961 --- /dev/null +++ b/lua/custom/highlights.lua @@ -0,0 +1,125 @@ +local M = {} + +M.override = { + IndentBlanklineContextChar = { + fg = "yellow", + nocombine = true, + }, + Comment = { + fg = "light_grey" + }, + CursorLine = { + bg = "#3b2a41" + }, + ColorColumn = { + bg = "#3b2a41" + }, + DiagnosticWarn = { + fg = "yellow", + italic = true, + }, + St_LspWarning = { + fg = "yellow" + }, + DiagnosticHint = { + fg = "purple", + italic = true, + }, + St_LspHints = { + fg = "pruple", + }, + DiagnosticError = { + italic = true, + }, + St_LspInfo = { + fg = "white" + }, + } + +M.add = { + Visual = { + bg = "blue", + fg = "black", + }, + BookmarkSign = { + fg = "blue", + }, + BookmarkAnnotationSign = { + fg = "yellow", + }, + BookmarkAnnotationLine = { + fg = "black", + bg = "yellow" + }, + DiagnosticInfo = { -- nvchad uses DiagnosticInformation wrong hi group for lsp + fg = "white", + italic = true, + }, + DiagnosticFloatingInfo = { + fg = "white", + italic = true, + }, + DiagnosticUnderlineError = { + fg = "black", + bg = "pink", + }, + -- Code Lens related colors + LspCodeLens = { + fg = "vibrant_green", + underline = true, + }, + LspDiagnosticsSignHint = { -- LspDiagnostics Code Action + fg = "vibrant_green", + italic = true, + }, + -- end of code lens colors + DiffText = { + bg = "vigrant_green" + }, + St_DapMode = { + fg = "black2", + bg = "baby_pink", + }, + St_DapModeSep = { + fg = "baby_pink", + bg = "one_bg3", + }, + St_DapModeSep2 = { + fg = "grey", + bg = "baby_pink", + }, + DapBreakpoint = { + fg = "green" + }, + DapStopped = { + fg = "#ff4848" + }, + DapLogPoint = { + fg = "vibrant_green" + }, + DapBreakpointCondition = { + fg = "cyan" + }, + DapBreakpointRejected = { + fg = "purple" + }, + LuaSnipChoice = { + fg = "yellow", + bg = "one_bg3", + }, + LuaSnipInsert = { + fg = "teal", + -- bg = "one_bg3", + }, + NvimDapVirtualText = { + fg = '#f99540' + }, + TabLineSel = { + fg = "white", + bold = true + }, + + } + + +return M diff --git a/lua/custom/plugins/configs/navigator.lua b/lua/custom/plugins/configs/navigator.lua index 7eb3314..0e50432 100644 --- a/lua/custom/plugins/configs/navigator.lua +++ b/lua/custom/plugins/configs/navigator.lua @@ -151,7 +151,7 @@ local config = { -- disable auto start of lsp per language -- set global default on lspconfig (see lspconfig doc) gopls = { - cmd = { "nc", "localhost", "9999" }, + -- cmd = { "nc", "localhost", "9999" }, -- cmd = {"socat", "-" ,"tcp:localhost:4444"}, -- on_attach = require("spike.lsp.go").custom_attach, on_attach = require("spike.lsp.go").gopls_onattach, diff --git a/lua/custom/plugins/configs/todo-comments.lua b/lua/custom/plugins/configs/todo-comments.lua index 98bf200..1944f4e 100644 --- a/lua/custom/plugins/configs/todo-comments.lua +++ b/lua/custom/plugins/configs/todo-comments.lua @@ -14,11 +14,12 @@ local config = { }, LEARN = { color = "hint" }, WIP = { color = "default"}, - NOTE = { alt = { "TIP", "INFO", "TRICK" }}, - DEBUG = {} + NOTE = { alt = { "TIP", "INFO", "TRICK", "RELEASE"}}, + DEBUG = {}, }, colors = { - info = {"#2563EB"}, + -- info = {"#2563EB"}, + info = {"#dddddd"}, hint = {"#10B981"}, default = {"#8C3AED" }, }, diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index b34fd5e..5a073d0 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -54,6 +54,7 @@ return { -- treesitter ["nvim-treesitter/nvim-treesitter"] = { -- {{{ + commit = "4f8b2480", -- pin to latest working commit -- custom config in chadrc -> custom.configs.treesitter setup = function() require("core.lazy_load").on_file_open "nvim-treesitter" @@ -147,6 +148,11 @@ return { }, -- }}} -- text formatting + -- + ["dhruvasagar/vim-table-mode"] = { + opt = true, + cmd = {"TableModeToggle"}, + }, ["folke/todo-comments.nvim"] = { -- {{{ -- commit = "6124066", diff --git a/lua/custom/plugins/nvchadui.lua b/lua/custom/plugins/nvchadui.lua index 5dc6d7f..cd82a2b 100644 --- a/lua/custom/plugins/nvchadui.lua +++ b/lua/custom/plugins/nvchadui.lua @@ -1,5 +1,8 @@ -- called in chadrc --- + +-- statusline=%!v:lua.require('nvchad_ui').statusline() +-- vim.o.statusline="%.40(%{expand('%:p:h:t')}/%t%)" + local fn = vim.fn local sep_style = vim.g.statusline_sep_style local separators = (type(sep_style) == "table" and sep_style) @@ -45,7 +48,7 @@ end return { mode = function() local m = vim.api.nvim_get_mode().mode - local current_mode = "%#" .. modes[m][2] .. "#" .. "  " .. modes[m][1] + local current_mode = "%#" .. modes[m][2] .. "# " .. modes[m][1] local mode_sep1 = "%#" .. modes[m][2] .. "Sep" .. "#" .. sep_r if is_dapmode() then @@ -58,7 +61,9 @@ return { fileInfo = function() local icon = "  " - local filename = (fn.expand "%" == "" and "Empty ") or fn.expand "%:t" + local filepath = fn.expand "%:p:h:t" .. '/%t' + local filetype = '%y ' + local filename = (fn.expand "%" == "" and "Empty ") or filepath local modified = (vim.bo[0].modified and "+ ") or "" if filename ~= "Empty " then @@ -69,10 +74,10 @@ return { icon = (ft_icon ~= nil and " " .. ft_icon) or "" end - filename = " " .. filename .. " " + filename = " " .. filetype .. filename .. " " end - return "%#St_file_info#" .. icon .. filename .. "[%n] " .. modified .. "%#St_file_sep#" .. sep_r + return "%#St_file_info#" .. icon .. filename .. "[%n] " .. modified .. "%#St_file_sep#" .. sep_r end, LSP_Diagnostics = function() @@ -141,9 +146,16 @@ return { end, cwd = function() - local dir_icon = "%#St_cwd_icon#" .. " " - local dir_name = "%#St_cwd_text#" .. " " .. fn.fnamemodify(fn.getcwd(), ":p:~") .. " " - return (vim.o.columns > 85 and ("%#St_cwd_sep#" .. sep_l .. dir_icon .. dir_name)) or "" + local dir_icon = "%#St_cwd_icon#" .. " " + local dir_name = "%#St_cwd_text#" .. " " .. fn.fnamemodify(fn.getcwd(), ":p:~") .. " " + return (vim.o.columns > 85 and ("%#St_file_sep_rev#" .. sep_r .. dir_name)) or "" end, + cursor_position = function() + + text = '%l,%c%V%\\ %p%%' + + return "%#St_pos_text#" .. " " .. text .. " " + end + } diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 6450a78..9b8a71c 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -27,6 +27,7 @@ local plugins = { ["NvChad/ui"] = { lock = true, + disable = false, after = "base46", config = function() require("plugins.configs.others").nvchad_ui() diff --git a/lua/spike/diagnostics.lua b/lua/spike/diagnostics.lua index 14f594d..b7f1fab 100644 --- a/lua/spike/diagnostics.lua +++ b/lua/spike/diagnostics.lua @@ -19,6 +19,7 @@ local ns = vim.api.nvim_create_namespace("my_diagnostics") local filter_diagnostics = function(diagnostics, level) local filtered_diag = {} + if level == -1 then return {} end for _, d in ipairs(diagnostics) do if d.severity <= level then table.insert(filtered_diag, 1, d) diff --git a/notes/TODO b/notes/TODO index 76486e7..940973a 100644 --- a/notes/TODO +++ b/notes/TODO @@ -1,3 +1,4 @@ +* [ ] check project.nvim [link](https://github.com/ahmedkhalf/project.nvim) - [ ] Replacement to asyncrun ! - Event when command is over to close quickfix window - [ ] setup task runner overseer.nvim diff --git a/plugin/spike/autocmd.vim b/plugin/spike/autocmd.vim index 3903aa9..13d5572 100644 --- a/plugin/spike/autocmd.vim +++ b/plugin/spike/autocmd.vim @@ -1,6 +1,6 @@ " DWM augroup DWM - au BufWritePost */suckless/*/{*.c,*.h} :AsyncRun! make && doas make install + au BufWritePost */suckless/*/{*.c,*.h} :AsyncRun make && doas make install " au BufWritePost */suckless/*/{*.h,*.c} :AsyncRun! make clean && make && doas make install" augroup END diff --git a/plugin/spike/fzf-marks.lua b/plugin/spike/fzf-marks.lua deleted file mode 100644 index 2368d32..0000000 --- a/plugin/spike/fzf-marks.lua +++ /dev/null @@ -1,71 +0,0 @@ -local fzf = require("fzf-lua") - -local M = {} - -local function fzf_display_bookmarks(bookmarks) - P(bookmarks) - - local fzf_exec_opts = { - previewer = "builtin", - fzf_opts = { - ['--preview'] = fzf.shell.action(function(items) - local contents = {} - vim.tbl_map(function (x) - table.insert(contents, x) - end, items) - return contents - end) - } - } - - fzf.fzf_exec(function(fzf_cb) - for _, bookmark in ipairs(bookmarks) do - -- P(bookmark.text) - local entry_text = string.gsub(bookmark.text, "\t", "") - entry_text = string.format("%-40s", entry_text) - fzf_cb(entry_text) - fzf_cb() - end - end, fzf_exec_opts) -end - -local function get_bookmarks(files, opts) - opts = opts or {} - local bookmarks = {} - - for _,file in ipairs(files) do - for _,line in ipairs(vim.fn['bm#all_lines'](file)) do - local bookmark = vim.fn['bm#get_bookmark_by_line'](file, line) - - local text = bookmark.annotation ~= "" and "Annotation: " .. bookmark.annotation or bookmark.content - if text == "" then - text = "(empty line)" - end - - local only_annotated = opts.only_annotated or false - - P(only_annotated) - if not (only_annotated and bookmark.annotation == "") then - table.insert(bookmarks, { - filename = file, - lnum = tonumber(line), - col=1, - text = text, - sign_idx = bookmark.sign_idx, - }) - end - end - end - - return bookmarks -end - -M.all = function(opts) - opts = opts or {} - local files = vim.fn['bm#all_files']() - bookmarks = get_bookmarks(files) - fzf_display_bookmarks(bookmarks) -end - --- M.all() --- return M diff --git a/plugin/spike/fzf-marks.lua.disabled b/plugin/spike/fzf-marks.lua.disabled new file mode 100644 index 0000000..51a1792 --- /dev/null +++ b/plugin/spike/fzf-marks.lua.disabled @@ -0,0 +1,75 @@ + local ok, fzf = pcall(require, 'fzf-lua') + if not ok then + vim.notify("missing module fzf-lua", vim.log.levels.WARN) + return + end + + local M = {} + + local function fzf_display_bookmarks(bookmarks) + P(bookmarks) + + local fzf_exec_opts = { + previewer = "builtin", + fzf_opts = { + ['--preview'] = fzf.shell.action(function(items) + local contents = {} + vim.tbl_map(function (x) + table.insert(contents, x) + end, items) + return contents + end) + } + } + + fzf.fzf_exec(function(fzf_cb) + for _, bookmark in ipairs(bookmarks) do + -- P(bookmark.text) + local entry_text = string.gsub(bookmark.text, "\t", "") + entry_text = string.format("%-40s", entry_text) + fzf_cb(entry_text) + fzf_cb() + end + end, fzf_exec_opts) + end + + local function get_bookmarks(files, opts) + opts = opts or {} + local bookmarks = {} + + for _,file in ipairs(files) do + for _,line in ipairs(vim.fn['bm#all_lines'](file)) do + local bookmark = vim.fn['bm#get_bookmark_by_line'](file, line) + + local text = bookmark.annotation ~= "" and "Annotation: " .. bookmark.annotation or bookmark.content + if text == "" then + text = "(empty line)" + end + + local only_annotated = opts.only_annotated or false + + P(only_annotated) + if not (only_annotated and bookmark.annotation == "") then + table.insert(bookmarks, { + filename = file, + lnum = tonumber(line), + col=1, + text = text, + sign_idx = bookmark.sign_idx, + }) + end + end + end + + return bookmarks + end + + M.all = function(opts) + opts = opts or {} + local files = vim.fn['bm#all_files']() + bookmarks = get_bookmarks(files) + fzf_display_bookmarks(bookmarks) + end + + -- M.all() + -- return M