3 Commits 9934cb6f1a ... b0c9768995

Author SHA1 Message Date
  Thomas Dy b0c9768995 git: enable untrackedCache 7 months ago
  Thomas Dy 7ea7eeeb74 nixpkgs/neovim: disable fuzzy matching 7 months ago
  Thomas Dy 25a8b470df nixpkgs/neovim: fix format on save 7 months ago
3 changed files with 23 additions and 0 deletions
  1. 1 0
      .config/git/config
  2. 21 0
      .config/nixpkgs/neovim/lsp.lua
  3. 1 0
      .config/nixpkgs/neovim/plugins.lua

+ 1 - 0
.config/git/config

@@ -6,6 +6,7 @@
 [core]
 	autocrlf = input
 	hooksPath = ~/.config/git/hooks
+	untrackedcache = true
 [delta]
 	features = side-by-side line-numbers decorations
 	whitespace-error-style = 22 reverse

+ 21 - 0
.config/nixpkgs/neovim/lsp.lua

@@ -97,8 +97,29 @@ if vim.fn.executable("nil") == 1 then
   });
 end
 
+-- format on save
 local group = vim.api.nvim_create_augroup('LspFormatting', { clear = false })
 
+vim.api.nvim_create_autocmd('LspAttach', {
+  callback = function(args)
+    local bufnr = args.buf
+    local client = vim.lsp.get_client_by_id(args.data.client_id)
+
+    if client.server_capabilities.documentFormattingProvider then
+      for key, cmd in pairs(vim.api.nvim_get_autocmds({ group = group, buffer = bufnr })) do
+        vim.api.nvim_del_autocmd(cmd.id)
+      end
+      vim.api.nvim_create_autocmd('BufWritePre', {
+        group = group,
+        buffer = bufnr,
+        callback = function()
+          vim.lsp.buf.format()
+        end,
+      })
+    end
+  end,
+})
+
 -- custom LSP servers
 local configs = require('lspconfig.configs')
 

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

@@ -189,6 +189,7 @@ cmp.setup({
   },
   matching = {
     -- disable non-prefix matching
+    disallow_fuzzy_matching = true,
     disallow_partial_matching = true,
     disallow_prefix_unmatching = true,
   },