1
0

7 Коммитууд ba4c1accae ... a3fb902167

Эзэн SHA1 Мессеж Огноо
  Thomas Dy a3fb902167 nixpkgs/neovim: add a/i for function calls 1 сар өмнө
  Thomas Dy 4787f055ab nixpkgs/neovim: load ts_ls preferences from helix config 1 сар өмнө
  Thomas Dy 1d9d08ec5d nixpkgs/neovim: add vim-rsi 1 сар өмнө
  Thomas Dy 7fa977ff37 nixpkgs/neovim: try fixing typescript indentation 1 сар өмнө
  Thomas Dy 8398bf7425 nixpkgs/neovim: update flake.lock and plugins 1 сар өмнө
  Thomas Dy ba4c1accae nixpkgs/neovim: update flake.lock and plugins 1 сар өмнө
  Thomas Dy 4cbdcfbfc7 nixpkgs/neovim: add <C-f> / <C-b> in insert 1 сар өмнө

+ 6 - 0
.config/nixpkgs/neovim/flake.nix

@@ -18,6 +18,12 @@
           overlays = [(final: prev: {
             node-lsp = final.callPackage ./node-lsp {};
             blink-cmp = blink-cmp.packages.${system}.blink-cmp;
+            neovim-unwrapped = prev.neovim-unwrapped.overrideAttrs (attrs: attrs // {
+              patches = (attrs.patches or []) ++ [
+                # fix floating windows not closing when going to another file
+                ./neovim-34946.patch
+              ];
+            });
           })];
         };
       in

+ 24 - 5
.config/nixpkgs/neovim/lsp.lua

@@ -9,6 +9,18 @@ vim.lsp.config("*", {
   }
 })
 
+local function read_helix_config()
+  local tinytoml = require("tinytoml")
+  local data = vim.secure.read(".helix/languages.toml")
+  if data ~= nil then
+    local status, data = pcall(tinytoml.parse, data, { load_from_string = true })
+    if status then
+      return data
+    end
+  end
+  return {}
+end
+
 vim.lsp.enable("bashls");
 vim.lsp.enable("eslint");
 
@@ -22,6 +34,17 @@ end
 if vim.fn.executable("deno") == 1 then
   vim.lsp.enable("deno");
 else
+  local preferences = {
+    importModuleSpecifierPreference = 'non-relative',
+    -- this prevents renames from aliasing when destructuring
+    providePrefixAndSuffixTextForRename = false,
+  }
+
+  local helix_preferences = vim.tbl_get(read_helix_config(), 'language-server', 'typescript-language-server', 'config', 'preferences')
+  if helix_preferences ~= nil then
+    preferences = vim.tbl_deep_extend('force', preferences, helix_preferences)
+  end
+
   local function make_settings()
     -- we disable formatting but these are still used when performing some code
     -- actions
@@ -38,11 +61,7 @@ else
   vim.lsp.config("ts_ls", {
     init_options = {
       completionDisableFilterText = true,
-      preferences = {
-        importModuleSpecifierPreference = 'non-relative',
-        -- this prevents renames from aliasing when destructuring
-        providePrefixAndSuffixTextForRename = false,
-      },
+      preferences = preferences,
     },
     settings = make_settings(),
     handlers = {

+ 0 - 4
.config/nixpkgs/neovim/mappings.lua

@@ -79,10 +79,6 @@ vim.keymap.set('n', '<Leader>j', '<cmd>TSJJoin<CR>', opts)
 vim.keymap.set('i', '<C-,>', function() toggle_end_char(',') end, opts)
 vim.keymap.set('i', '<C-;>', function() toggle_end_char(';') end, opts)
 
--- some readline bindings
-vim.keymap.set('i', '<C-b>', '<Left>', opts)
-vim.keymap.set('i', '<C-f>', '<Right>', opts)
-
 -- diagnostics
 vim.keymap.set('n', '<space>e', function() vim.diagnostic.open_float() end, opts)
 vim.keymap.set('n', '[d', function() vim.diagnostic.jump({ count = -1, float = true, severity = vim.diagnostic.severity.ERROR }) end, opts)

+ 60 - 0
.config/nixpkgs/neovim/neovim-34946.patch

@@ -0,0 +1,60 @@
+From cad0c71adc30ca4d358cec3146495b340b2e068e Mon Sep 17 00:00:00 2001
+From: Tronikel <contactdonatas@gmail.com>
+Date: Tue, 15 Jul 2025 18:18:50 +0300
+Subject: [PATCH] fix: close floating preview window correctly
+
+---
+ runtime/lua/vim/lsp/util.lua | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
+index db221ddc6889e6..28d00d6cd307f2 100644
+--- a/runtime/lua/vim/lsp/util.lua
++++ b/runtime/lua/vim/lsp/util.lua
+@@ -1418,9 +1418,10 @@ end
+ ---
+ ---@param events table list of events
+ ---@param winnr integer window id of preview window
+----@param bufnrs table list of buffers where the preview window will remain visible
++---@param floating_bufnr integer floating preview buffer
++---@param bufnr integer buffer that opened the floating preview buffer
+ ---@see autocmd-events
+-local function close_preview_autocmd(events, winnr, bufnrs)
++local function close_preview_autocmd(events, winnr, floating_bufnr, bufnr)
+   local augroup = api.nvim_create_augroup('nvim.preview_window_' .. winnr, {
+     clear = true,
+   })
+@@ -1429,13 +1430,13 @@ local function close_preview_autocmd(events, winnr, bufnrs)
+   -- the floating window buffer or the buffer that spawned it
+   api.nvim_create_autocmd('BufLeave', {
+     group = augroup,
+-    buffer = bufnrs[1],
++    buffer = bufnr,
+     callback = function()
+       vim.schedule(function()
+         -- When jumping to the quickfix window from the preview window,
+         -- do not close the preview window.
+         if api.nvim_get_option_value('filetype', { buf = 0 }) ~= 'qf' then
+-          close_preview_window(winnr, bufnrs)
++          close_preview_window(winnr, { floating_bufnr, bufnr })
+         end
+       end)
+     end,
+@@ -1444,7 +1445,7 @@ local function close_preview_autocmd(events, winnr, bufnrs)
+   if #events > 0 then
+     api.nvim_create_autocmd(events, {
+       group = augroup,
+-      buffer = bufnrs[2],
++      buffer = bufnr,
+       callback = function()
+         close_preview_window(winnr)
+       end,
+@@ -1690,7 +1691,7 @@ function M.open_floating_preview(contents, syntax, opts)
+       '<cmd>bdelete<cr>',
+       { silent = true, noremap = true, nowait = true }
+     )
+-    close_preview_autocmd(opts.close_events, floating_winnr, { floating_bufnr, bufnr })
++    close_preview_autocmd(opts.close_events, floating_winnr, floating_bufnr, bufnr)
+ 
+     -- save focus_id
+     if opts.focus_id then

+ 4 - 0
.config/nixpkgs/neovim/plugins.lua

@@ -282,6 +282,10 @@ require('mini.ai').setup({
   -- only consider the current location
   search_method = 'cover',
   custom_textobjects = {
+    ['.'] = spec_treesitter({
+      a = '@call.outer',
+      i = '@call.inner',
+    }),
     [','] = spec_treesitter({
       a = '@parameter.outer',
       i = '@parameter.inner',

+ 15 - 3
.config/nixpkgs/neovim/plugins/default.nix

@@ -8,14 +8,26 @@ let
     };
 
     "nvim-treesitter/nvim-treesitter" = {
-      # these extra rules causes nvim to crash when looking at a deeply nested
-      # JSX expression
-      patches = [ ./treesitter-jsx.patch ];
+      patches = [
+        # these extra rules causes nvim to crash when looking at a deeply nested
+        # JSX expression
+        ./treesitter-jsx.patch
+
+        # try to fix indentation in JS
+        ./treesitter-ecma.patch
+      ];
     };
 
     "mistweaverco/kulala.nvim" = {
       patches = [ ./kulala-treesitter.patch ];
     };
+
+    "FourierTransformer/tinytoml" = {
+      postPatch = ''
+        mkdir lua
+        mv tinytoml.lua lua
+      '';
+    };
   };
 
   buildPlugin = name: spec:

+ 8 - 0
.config/nixpkgs/neovim/plugins/sources.json

@@ -75,5 +75,13 @@
   "aaronik/treewalker.nvim": {
     "rev": "ae229700e1cce34198280f588568dc49c52d9eb1",
     "sha256": "011r3xvc6207jrzd049nfwfdiz20d7syy0l5dzqmr5f8m7kjf6dh"
+  },
+  "tpope/vim-rsi": {
+    "rev": "45540637ead22f011e8215f1c90142e49d946a54",
+    "sha256": "0vr5mlna5f60dmhk4ims7g0ikqw15h21hr619xii1069ggddqr9v"
+  },
+  "FourierTransformer/tinytoml": {
+    "rev": "8fc9acf778eea141a36b7b42f55fcb6689fcfd3f",
+    "sha256": "1np8gymhlvklf45f9961ksxkm0nz3ppwkxcjaw8qxzr2fgd3kq9j"
   }
 }

+ 13 - 0
.config/nixpkgs/neovim/plugins/treesitter-ecma.patch

@@ -0,0 +1,13 @@
+diff --git a/queries/ecma/indents.scm b/queries/ecma/indents.scm
+index d5674167..dcfd2ad6 100644
+--- a/queries/ecma/indents.scm
++++ b/queries/ecma/indents.scm
+@@ -37,7 +37,7 @@
+ 
+ (variable_declarator
+   value: (_) @_value
+-  (#not-kind-eq? @_value "arrow_function" "call_expression" "function")) @indent.begin
++  (#not-kind-eq? @_value "arrow_function" "function")) @indent.begin
+ 
+ (arguments
+   ")" @indent.end)