diff --git a/config/linux-dev/nvim/init.lua b/config/linux-dev/nvim/init.lua index 38f9d43..15366d3 100644 --- a/config/linux-dev/nvim/init.lua +++ b/config/linux-dev/nvim/init.lua @@ -20,7 +20,7 @@ require('config.keymaps') require('config.autocmds') require('config.clipboard') require('config.terminal') - +require('custom.navigation') require('lazy').setup({ spec = { { import = 'plugins' } }, change_detection = { notify = false }, diff --git a/config/linux-dev/nvim/lazy-lock.json b/config/linux-dev/nvim/lazy-lock.json index a0b0854..390743e 100644 --- a/config/linux-dev/nvim/lazy-lock.json +++ b/config/linux-dev/nvim/lazy-lock.json @@ -1,12 +1,12 @@ { "conform.nvim": { "branch": "master", "commit": "fbcb4fa7f34bfea9be702ffff481a8e336ebf6ed" }, "fzf-lua": { "branch": "main", "commit": "58ebb27333bd12cb497f27b7da07a677116bc0ef" }, - "invero.nvim": { "branch": "main", "commit": "ff1b124ef709686965afdf338d989142e5e60602" }, "lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" }, "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, "nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" }, "nvim-lint": { "branch": "master", "commit": "9da1fb942dd0668d5182f9c8dee801b9c190e2bb" }, "nvim-tree.lua": { "branch": "master", "commit": "321bc61580fd066b76861c32de3319c3a6d089e7" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" } + "nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" }, + "rose-pine": { "branch": "main", "commit": "72a04c4065345b51b56aed4859ea1d884f734097" } } diff --git a/config/linux-dev/nvim/lua/config/options.lua b/config/linux-dev/nvim/lua/config/options.lua index f91d67a..7dfa038 100644 --- a/config/linux-dev/nvim/lua/config/options.lua +++ b/config/linux-dev/nvim/lua/config/options.lua @@ -25,7 +25,7 @@ vim.g.have_nerd_font = true vim.opt.termguicolors = false vim.opt.textwidth = 100 -vim.opt.colorcolumn = '+0' +-- vim.opt.colorcolumn = '+0' vim.opt.signcolumn = 'no' vim.opt.number = true @@ -33,8 +33,14 @@ vim.opt.relativenumber = true vim.opt.cursorline = true vim.opt.guicursor = 'n-v-i-c:block' -vim.opt.statusline = '%F%m%r%h%w%=%l,%c %P ' +-- vim.opt.statusline = ' %f %h%w%m%r%= ' +vim.opt.statusline = '> %f %h%w%m%r %= %l,%c - %L ' +vim.opt.fillchars:append({ stl = '─', stlnc = '─' }) + vim.opt.winborder = 'rounded' +vim.opt.laststatus = 3 +vim.opt.showcmd = false +-- vim.opt.cmdheight = 0 -- Wrap vim.opt.wrap = false @@ -59,7 +65,7 @@ vim.opt.mouse = 'a' -- Enable mouse support vim.opt.ignorecase = true vim.opt.smartcase = true -- Override ignorecase if search contains upper case chars vim.opt.inccommand = 'split' -- Live substitution preview -vim.opt.completeopt = { 'menuone' } +vim.opt.completeopt = { 'menu,menuone,noselect' } -- Splits vim.opt.splitright = true diff --git a/config/linux-dev/nvim/lua/custom/navigation.lua b/config/linux-dev/nvim/lua/custom/navigation.lua new file mode 100644 index 0000000..ae15f0c --- /dev/null +++ b/config/linux-dev/nvim/lua/custom/navigation.lua @@ -0,0 +1,162 @@ +vim.keymap.set('n', 'f', function() + vim.cmd('FuzzyLive') +end, { desc = 'Open fuzzy file finder' }) + +-- Minimal realtime fuzzy finder in pure Neovim Lua (no plugins) +local Fuzzy = {} + +function Fuzzy.open() + if Fuzzy.active then + Fuzzy.close() + end + Fuzzy.active = true + + -- Collect all files once (cached for speed) + Fuzzy.files = vim.fn.globpath('.', '**/*', 0, 1) + Fuzzy.matches = Fuzzy.files + Fuzzy.cursor = 1 + + -- Create input and result buffers + Fuzzy.input_buf = vim.api.nvim_create_buf(false, true) + Fuzzy.result_buf = vim.api.nvim_create_buf(false, true) + + -- Floating window sizes + local width = math.floor(vim.o.columns * 0.6) + local height = 15 + local row = math.floor((vim.o.lines - height) / 2) + local col = math.floor((vim.o.columns - width) / 2) + + -- Input window (top) + Fuzzy.input_win = vim.api.nvim_open_win(Fuzzy.input_buf, true, { + relative = 'editor', + row = row, + col = col, + width = width, + height = 1, + style = 'minimal', + border = 'rounded', + }) + vim.api.nvim_buf_set_option(Fuzzy.input_buf, 'buftype', 'prompt') + vim.fn.prompt_setprompt(Fuzzy.input_buf, 'Search: ') + + -- Results window (below) + Fuzzy.result_win = vim.api.nvim_open_win(Fuzzy.result_buf, false, { + relative = 'editor', + row = row + 2, + col = col, + width = width, + height = height - 2, + style = 'minimal', + border = 'single', + }) + + -- Draw initial result list + Fuzzy:update_results('') + + ------------------------------------------------------------------ + -- 🟢 Real-time fuzzy filtering + ------------------------------------------------------------------ + vim.api.nvim_create_autocmd({ 'TextChangedI', 'TextChangedP' }, { + buffer = Fuzzy.input_buf, + callback = function() + local text = vim.fn.getline('.') + text = text:gsub('^Search:%s*', '') + Fuzzy:update_results(text) + end, + }) + + ------------------------------------------------------------------ + -- 🟢 Keybindings in input window + ------------------------------------------------------------------ + vim.keymap.set('i', '', function() + if not Fuzzy.matches or #Fuzzy.matches == 0 then + return + end + Fuzzy.cursor = math.min(Fuzzy.cursor + 1, #Fuzzy.matches) + Fuzzy:highlight_selection() + end, { buffer = Fuzzy.input_buf }) + + vim.keymap.set('i', '', function() + if not Fuzzy.matches or #Fuzzy.matches == 0 then + return + end + Fuzzy.cursor = math.max(Fuzzy.cursor - 1, 1) + Fuzzy:highlight_selection() + end, { buffer = Fuzzy.input_buf }) + + vim.keymap.set('i', '', function() + local choice = Fuzzy.matches[Fuzzy.cursor] + if choice then + Fuzzy.close() + vim.cmd('edit ' .. vim.fn.fnameescape(choice)) + end + end, { buffer = Fuzzy.input_buf }) + + vim.keymap.set('i', '', function() + Fuzzy.close() + end, { buffer = Fuzzy.input_buf }) + + vim.cmd('startinsert') +end + +-------------------------------------------------------------------- +-- 🔵 Core update + display logic +-------------------------------------------------------------------- +function Fuzzy:update_results(text) + if text == '' then + Fuzzy.matches = Fuzzy.files + else + Fuzzy.matches = vim.fn.matchfuzzy(Fuzzy.files, text) + end + + if #Fuzzy.matches == 0 then + vim.api.nvim_buf_set_lines(Fuzzy.result_buf, 0, -1, false, { '-- no matches --' }) + Fuzzy.cursor = 1 + return + end + + -- Limit to first 50 results for performance + local display = {} + for i = 1, math.min(#Fuzzy.matches, 50) do + table.insert(display, Fuzzy.matches[i]) + end + + vim.api.nvim_buf_set_lines(Fuzzy.result_buf, 0, -1, false, display) + Fuzzy.cursor = 1 + Fuzzy:highlight_selection() +end + +-------------------------------------------------------------------- +-- 🔵 Highlight the selected file +-------------------------------------------------------------------- +function Fuzzy:highlight_selection() + if not Fuzzy.result_buf then + return + end + vim.api.nvim_buf_clear_namespace(Fuzzy.result_buf, 0, 0, -1) + if Fuzzy.matches and Fuzzy.matches[Fuzzy.cursor] then + vim.api.nvim_buf_add_highlight(Fuzzy.result_buf, 0, 'Visual', Fuzzy.cursor - 1, 0, -1) + end +end + +-------------------------------------------------------------------- +-- 🔴 Clean up +-------------------------------------------------------------------- +function Fuzzy.close() + if Fuzzy.input_win and vim.api.nvim_win_is_valid(Fuzzy.input_win) then + vim.api.nvim_win_close(Fuzzy.input_win, true) + end + if Fuzzy.result_win and vim.api.nvim_win_is_valid(Fuzzy.result_win) then + vim.api.nvim_win_close(Fuzzy.result_win, true) + end + Fuzzy.active = false +end + +-------------------------------------------------------------------- +-- 🧩 Command to launch +-------------------------------------------------------------------- +vim.api.nvim_create_user_command('FuzzyLive', function() + Fuzzy.open() +end, {}) + +return Fuzzy diff --git a/config/linux-dev/nvim/lua/plugins/colorscheme.lua b/config/linux-dev/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..9b22884 --- /dev/null +++ b/config/linux-dev/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,66 @@ +-- return { +-- 'rose-pine/neovim', +-- name = 'rose-pine', +-- config = function() +-- vim.cmd('colorscheme rose-pine-dawn') +-- end, +-- } +return { + 'triimdev/invero.nvim', + lazy = false, + priority = 1000, + dev = true, + config = function() + vim.api.nvim_create_user_command('ReloadInvero', function() + require('invero').invalidate_cache() + vim.cmd('Lazy reload invero.nvim') + end, {}) + + require('invero').setup({ + highlights = function(c, tool) + c.bg_float = tool(152) + return { + -- Normal = { fg = c.text, bg = c.base }, + -- StatusLine = { fg = tool(231), bg = c.outline, bold = false }, -- Active statusline (where filename) + -- StatusLineNC = { fg = c.surface, bg = c.outline, bold = false }, -- Active statusline (where filename) + -- NormalFloat = { fg = c.text, bg = c.none }, + + -- FzfLuaFzfGutter = { bg = c.base }, + -- FzfLuaBorder = { fg = c.outline, bg = c.bg_float }, + -- FzfLuaCursor = 'IncSearch', + -- FzfLuaDirPart = { fg = c.muted }, + -- FzfLuaFilePart = 'FzfLuaFzfNormal', + -- FzfLuaFzfCursorLine = 'Visual', + -- FzfLuaFzfNormal = { fg = c.text }, + -- FzfLuaFzfPointer = { fg = c.magenta }, + -- FzfLuaFzfSeparator = { fg = c.orange, bg = c.bg_float }, + -- -- FzfLuaHeaderBind = '@punctuation.special', + -- FzfLuaHeaderBind = { fg = c.green, bg = c.base }, + -- FzfLuaHeaderText = 'Title', + -- FzfLuaNormal = { fg = c.text, bg = c.bg_float }, + -- FzfLuaPath = 'Directory', + -- FzfLuaPreviewTitle = { fg = c.surface, bg = c.bg_float }, + -- FzfLuaTitle = { fg = c.orange, bg = c.bg_float }, + + -- FzfLuaBorder = { fg = c.border_highlight, bg = c.bg_float }, + -- FzfLuaCursor = 'IncSearch', + -- FzfLuaDirPart = { fg = c.fg_dark }, + -- FzfLuaFilePart = 'FzfLuaFzfNormal', + -- FzfLuaFzfCursorLine = 'Visual', + -- FzfLuaFzfNormal = { fg = c.fg }, + -- FzfLuaFzfPointer = { fg = c.magenta2 }, + -- FzfLuaFzfSeparator = { fg = c.orange, bg = c.bg_float }, + -- FzfLuaHeaderBind = '@punctuation.special', + -- FzfLuaHeaderText = 'Title', + -- FzfLuaNormal = { fg = c.fg, bg = c.bg_float }, + -- FzfLuaPath = 'Directory', + -- FzfLuaPreviewTitle = { fg = c.border_highlight, bg = c.bg_float }, + -- FzfLuaTitle = { fg = c.orange, bg = c.bg_float }, + } + end, + }) + + vim.o.background = 'light' + vim.cmd.colorscheme('invero') + end, +} diff --git a/config/linux-dev/nvim/lua/plugins/miscellaneous.lua b/config/linux-dev/nvim/lua/plugins/miscellaneous.lua deleted file mode 100644 index 14b762a..0000000 --- a/config/linux-dev/nvim/lua/plugins/miscellaneous.lua +++ /dev/null @@ -1,26 +0,0 @@ -return { - { 'windwp/nvim-ts-autotag', config = true }, - { 'windwp/nvim-autopairs', event = 'InsertEnter', config = true }, - { - 'triimdev/invero.nvim', - lazy = false, - priority = 1000, - config = function() - vim.api.nvim_create_user_command('ReloadInvero', function() - require('invero').invalidate_cache() - vim.cmd('Lazy reload invero.nvim') - end, {}) - - -- require('invero').setup({ - -- highlights = function(C, tool) - -- return { - -- -- Statement = { fg = C.none, italic = true }, - -- } - -- end, - -- }) - - vim.o.background = 'light' - vim.cmd.colorscheme('invero') - end, - }, -} diff --git a/config/linux-dev/nvim/lua/plugins/navigation.lua b/config/linux-dev/nvim/lua/plugins/navigation.lua deleted file mode 100644 index 8684725..0000000 --- a/config/linux-dev/nvim/lua/plugins/navigation.lua +++ /dev/null @@ -1,52 +0,0 @@ -return { - 'ibhagwan/fzf-lua', - opts = {}, -} --- return { --- 'nvim-telescope/telescope.nvim', --- event = 'VimEnter', --- branch = '0.1.x', --- dependencies = { --- 'nvim-lua/plenary.nvim', --- { --- 'nvim-telescope/telescope-fzf-native.nvim', --- build = 'make', --- cond = function() --- return vim.fn.executable('make') == 1 --- end, --- }, --- { 'nvim-telescope/telescope-ui-select.nvim' }, --- }, --- config = function() --- require('telescope').setup({ --- defaults = { --- layout_strategy = 'vertical', --- layout_config = { --- width = { 0.95, max = 100 }, --- height = 0.95, --- preview_cutoff = 1, --- preview_height = 0.7, --- }, --- mappings = { --- n = { --- ['d'] = 'delete_buffer', --- }, --- }, --- }, --- }) --- --- pcall(require('telescope').load_extension, 'fzf') --- pcall(require('telescope').load_extension, 'ui-select') --- --- local builtin = require('telescope.builtin') --- vim.keymap.set('n', 'sk', builtin.keymaps) --- vim.keymap.set('n', 'sf', builtin.find_files) --- vim.keymap.set('n', 'sw', builtin.grep_string) --- vim.keymap.set('n', 'ss', builtin.current_buffer_fuzzy_find) --- vim.keymap.set('n', 'sg', builtin.live_grep) --- vim.keymap.set('n', 'sd', builtin.diagnostics) --- vim.keymap.set('n', 'sr', builtin.lsp_references) --- vim.keymap.set('n', 's.', builtin.oldfiles) --- vim.keymap.set('n', '', builtin.buffers) --- end, --- } diff --git a/config/linux-dev/nvim/lua/plugins/syntax.lua b/config/linux-dev/nvim/lua/plugins/syntax.lua index 7c01bb1..95fb676 100644 --- a/config/linux-dev/nvim/lua/plugins/syntax.lua +++ b/config/linux-dev/nvim/lua/plugins/syntax.lua @@ -23,6 +23,9 @@ vim.lsp.enable({ 'json_ls' }) return { { 'mason-org/mason.nvim', config = true }, + { 'windwp/nvim-ts-autotag', config = true }, + { 'windwp/nvim-autopairs', event = 'InsertEnter', config = true }, + -- { 'saghen/blink.cmp', version = '1.*' }, { 'nvim-treesitter/nvim-treesitter',