From cc9545d408211c7d8c5a8eb1130ea7d087a9b98b Mon Sep 17 00:00:00 2001 From: Greg Date: Tue, 12 May 2026 20:55:44 +0300 Subject: [PATCH] . --- .config/fish/fish_plugins | 2 + .config/fish/functions/fish_prompt.fish | 97 ++++--------------------- .config/nvim/lua/autocmd.lua | 9 +++ .config/nvim/lua/keymaps.lua | 2 + .config/nvim/lua/options.lua | 18 +++++ .config/nvim/lua/plugins/cursor.lua | 2 +- .config/nvim/lua/plugins/session.lua | 10 +++ .config/nvim/lua/plugins/snacks.lua | 7 ++ .config/nvim/lua/plugins/treesitter.lua | 65 ++++++++++------- .config/nvim/nvim-pack-lock.json | 4 + 10 files changed, 105 insertions(+), 111 deletions(-) diff --git a/.config/fish/fish_plugins b/.config/fish/fish_plugins index 89b2fda..8969b38 100644 --- a/.config/fish/fish_plugins +++ b/.config/fish/fish_plugins @@ -3,3 +3,5 @@ jhillyerd/plugin-git jorgebucaran/nvm.fish wfxr/forgit berk-karaal/loadenv.fish +pure-fish/pure +franciscolourenco/done diff --git a/.config/fish/functions/fish_prompt.fish b/.config/fish/functions/fish_prompt.fish index 8b1d19c..6f467be 100644 --- a/.config/fish/functions/fish_prompt.fish +++ b/.config/fish/functions/fish_prompt.fish @@ -1,90 +1,21 @@ +# a called to `_pure_prompt_new_line` is triggered by an event function fish_prompt - set -l __last_command_exit_status $status + set --local exit_codes $pipestatus # save previous exit codes - if not set -q -g __fish_arrow_functions_defined - set -g __fish_arrow_functions_defined - function _git_branch_name - set -l branch (git symbolic-ref --quiet HEAD 2>/dev/null) - if set -q branch[1] - echo (string replace -r '^refs/heads/' '' $branch) - else - echo (git rev-parse --short HEAD 2>/dev/null) - end - end + # Handle transient prompt (Fish 4.1.0+) + # When --final-rendering is passed, show simplified prompt for scrollback + if contains -- --final-rendering $argv + set --local last_status $exit_codes[-1] - function _is_git_dirty - not command git diff-index --cached --quiet HEAD -- &>/dev/null - or not command git diff --no-ext-diff --quiet --exit-code &>/dev/null - end - - function _is_git_repo - type -q git - or return 1 - git rev-parse --git-dir >/dev/null 2>&1 - end - - function _hg_branch_name - echo (hg branch 2>/dev/null) - end - - function _is_hg_dirty - set -l stat (hg status -mard 2>/dev/null) - test -n "$stat" - end - - function _is_hg_repo - fish_print_hg_root >/dev/null - end - - function _repo_branch_name - _$argv[1]_branch_name - end - - function _is_repo_dirty - _is_$argv[1]_dirty - end - - function _repo_type - if _is_hg_repo - echo hg - return 0 - else if _is_git_repo - echo git - return 0 - end - return 1 - end + echo -e -n (_pure_prompt_transient $last_status) + echo -e -n (_pure_prompt_ending) + return end - set -l cyan (set_color -o cyan) - set -l yellow (set_color -o yellow) - set -l red (set_color -o red) - set -l green (set_color -o green) - set -l blue (set_color -o blue) - set -l normal (set_color normal) + _pure_print_prompt_rows # manage default vs. compact prompt + _pure_place_iterm2_prompt_mark # place iTerm shell integration mark + echo -e -n (_pure_prompt $exit_codes) # print prompt + echo -e -n (_pure_prompt_ending) # reset colors and end prompt - set -l arrow_color "$green" - if test $__last_command_exit_status != 0 - set arrow_color "$red" - end - - set -l arrow "$arrow_color➜ " - if fish_is_root_user - set arrow "$arrow_color# " - end - - set -l cwd $cyan(basename (prompt_pwd)) - - set -l repo_info - if set -l repo_type (_repo_type) - set -l repo_branch $red(_repo_branch_name $repo_type) - set repo_info "$blue $repo_type:($repo_branch$blue)" - - if _is_repo_dirty $repo_type - set -l dirty "$yellow ✗" - set repo_info "$repo_info$dirty" - end - end - - echo -n -s $arrow ' '$cwd $repo_info $normal ' ' + set _pure_fresh_session false end diff --git a/.config/nvim/lua/autocmd.lua b/.config/nvim/lua/autocmd.lua index c01fe54..442d03d 100644 --- a/.config/nvim/lua/autocmd.lua +++ b/.config/nvim/lua/autocmd.lua @@ -12,6 +12,15 @@ vim.api.nvim_create_autocmd("TextYankPost", { end, }) +-- Close any new tab and reopen its buffer in the previous window +vim.api.nvim_create_autocmd("TabNew", { + callback = function() + local buf = vim.api.nvim_get_current_buf() + vim.cmd("tabclose") + vim.cmd("buffer " .. buf) + end, +}) + -- vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { -- desc = "diagnostics on hold", -- group = vim.api.nvim_create_augroup("diagnostics", { clear = true }), diff --git a/.config/nvim/lua/keymaps.lua b/.config/nvim/lua/keymaps.lua index 5be87c4..d225ac1 100644 --- a/.config/nvim/lua/keymaps.lua +++ b/.config/nvim/lua/keymaps.lua @@ -117,3 +117,5 @@ map({ "n", "v" }, "", function() vim.lsp.buf.selection_range(-vim.v.count1) end end, { desc = "Select child treesitter node or inner incremental lsp selections" }) + +map("n", "se", ":AutoSession search", { desc = "Search sessions" }) diff --git a/.config/nvim/lua/options.lua b/.config/nvim/lua/options.lua index d0433d6..c8c4834 100644 --- a/.config/nvim/lua/options.lua +++ b/.config/nvim/lua/options.lua @@ -87,4 +87,22 @@ vim.diagnostic.config({ virtual_text = true, underline = true }) vim.opt.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions" +vim.opt.switchbuf = "useopen,usetab" + vim.cmd.packadd("cfilter") + +if vim.g.neovide then + vim.g.neovide_scroll_animation_length = 0.1 -- Put anything you want to happen only in Neovide here + vim.g.neovide_scroll_animation_far_lines = 1 + vim.g.neovide_floating_shadow = false + + local function copy() + vim.cmd([[normal! "+y]]) + end + local function paste() + vim.api.nvim_paste(vim.fn.getreg("+"), true, -1) + end + + vim.keymap.set("v", "", copy, { silent = true, desc = "Copy" }) + vim.keymap.set({ "n", "i", "v", "c", "t" }, "", paste, { silent = true, desc = "Paste" }) +end diff --git a/.config/nvim/lua/plugins/cursor.lua b/.config/nvim/lua/plugins/cursor.lua index 3c50303..4f15c17 100644 --- a/.config/nvim/lua/plugins/cursor.lua +++ b/.config/nvim/lua/plugins/cursor.lua @@ -1,3 +1,3 @@ vim.pack.add({ "https://github.com/sphamba/smear-cursor.nvim" }) -require("smear_cursor").setup() +-- require("smear_cursor").setup() diff --git a/.config/nvim/lua/plugins/session.lua b/.config/nvim/lua/plugins/session.lua index a53d357..96f2937 100644 --- a/.config/nvim/lua/plugins/session.lua +++ b/.config/nvim/lua/plugins/session.lua @@ -1,7 +1,17 @@ vim.pack.add({ "https://github.com/rmagatti/auto-session" }) +---enables autocomplete for opts +---@module "auto-session" +---@type AutoSession.Config require("auto-session").setup({ suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" }, auto_restore = true, auto_save = true, + session_lens = { + picker = "snacks", + picker_opts = { + preview = false, + preset = "dropdown", + }, + }, }) diff --git a/.config/nvim/lua/plugins/snacks.lua b/.config/nvim/lua/plugins/snacks.lua index 866ccef..f7a2adc 100644 --- a/.config/nvim/lua/plugins/snacks.lua +++ b/.config/nvim/lua/plugins/snacks.lua @@ -44,6 +44,13 @@ Snacks.setup({ }, image = { enabled = false }, picker = { + win = { + input = { + keys = { + [""] = false, -- disable vertical split action, freeing Ctrl+V for system paste + }, + }, + }, layout = { fullscreen = true }, sources = { select = { layout = { fullscreen = false } }, diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua index 598872f..08a212e 100644 --- a/.config/nvim/lua/plugins/treesitter.lua +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -1,32 +1,43 @@ -vim.pack.add({ "https://github.com/nvim-treesitter/nvim-treesitter" }) +vim.pack.add({ + "https://github.com/arborist-ts/arborist.nvim", +}) -local ts = require("nvim-treesitter") +require("arborist").setup({ + ignore = { + "blink-cmp-documentation", + "blink-cmp-signature", + }, +}) + +-- vim.pack.add({ "https://github.com/nvim-treesitter/nvim-treesitter" }) + +-- local ts = require("nvim-treesitter") -- Installs treesitter for filetype if available -- enables highlighting and indentation -vim.api.nvim_create_autocmd("FileType", { - pattern = { ".*" }, - callback = function(args) - local ft = vim.bo[args.buf].filetype - local lang = vim.treesitter.language.get_lang(ft) - - if not lang or not vim.treesitter.language.add(lang) then - local available = vim.g.ts_available or ts.get_available() - if not vim.g.ts_available then - vim.g.ts_available = available - end - if vim.tbl_contains(available, lang) then - ts.install(lang) - end - end - - if vim.treesitter.language.add(lang) then - vim.treesitter.start(args.buf, lang) - vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" - vim.wo[0][0].foldexpr = "v:lua.vim.treesitter.foldexpr()" - vim.wo[0][0].foldmethod = "expr" - end - end, -}) - +-- vim.api.nvim_create_autocmd("FileType", { +-- pattern = { ".*" }, +-- callback = function(args) +-- local ft = vim.bo[args.buf].filetype +-- local lang = vim.treesitter.language.get_lang(ft) +-- +-- if not lang or not vim.treesitter.language.add(lang) then +-- local available = vim.g.ts_available or ts.get_available() +-- if not vim.g.ts_available then +-- vim.g.ts_available = available +-- end +-- if vim.tbl_contains(available, lang) then +-- ts.install(lang) +-- end +-- end +-- +-- if vim.treesitter.language.add(lang) then +-- vim.treesitter.start(args.buf, lang) +-- vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" +-- vim.wo[0][0].foldexpr = "v:lua.vim.treesitter.foldexpr()" +-- vim.wo[0][0].foldmethod = "expr" +-- end +-- end, +-- }) +-- vim.treesitter.language.register("bash", "env") diff --git a/.config/nvim/nvim-pack-lock.json b/.config/nvim/nvim-pack-lock.json index c00f070..cbcda93 100644 --- a/.config/nvim/nvim-pack-lock.json +++ b/.config/nvim/nvim-pack-lock.json @@ -9,6 +9,10 @@ "rev": "645d108a5242ec7b378cbe643eb6d04d4223f034", "src": "https://github.com/stevearc/aerial.nvim" }, + "arborist.nvim": { + "rev": "6cffbf419a495c84c56b918771a3d004e892e235", + "src": "https://github.com/arborist-ts/arborist.nvim" + }, "auto-session": { "rev": "62437532b38495551410b3f377bcf4aaac574ebe", "src": "https://github.com/rmagatti/auto-session"