]> src.twobees.de Git - dotfiles.git/commitdiff
...
authorTobias Sachs <nibbler-ts@ctsachs.de>
Tue, 27 Dec 2022 09:51:06 +0000 (10:51 +0100)
committerTobias Sachs <nibbler-ts@ctsachs.de>
Tue, 27 Dec 2022 09:51:06 +0000 (10:51 +0100)
stow/nvim/.config/nvim/after/plugin/lspsetup.lua
stow/nvim/.config/nvim/after/plugin/treesitter.lua [new file with mode: 0644]
stow/nvim/.config/nvim/init.lua
stow/nvim/.config/nvim/lua/cmp-settings.lua [deleted file]
stow/nvim/.config/nvim/lua/csharp.lua [deleted file]
stow/nvim/.config/nvim/lua/mappings.lua
stow/nvim/.config/nvim/lua/perl.lua [deleted file]
stow/nvim/.config/nvim/lua/plugin_mgr.lua
stow/nvim/.config/nvim/lua/treesitter.lua [deleted file]

index 170bfebfafe6024675e8c6942643295ebfd85166..9fe45066432a176989bf15ce4d85b64b68b2758b 100644 (file)
@@ -10,12 +10,36 @@ lsp.configure('sumneko_lua', {
         }
     }
 })
+
+lsp.on_attach = function (_, bufnr)
+    local options = { buffer = bufnr, remap = false }
+    vim.keymap.set ("n", "K", vim.lsp.buf.hover, options) -- buffer=0 -> only in current buffer
+    vim.keymap.set ("n", "gd", vim.lsp.buf.definition, options) -- goto definition
+    vim.keymap.set ("n", "gT", vim.lsp.buf.type_definition, options) -- goto typedefinition
+    vim.keymap.set ("n", "gi", vim.lsp.buf.implementation, options) -- goto implementation
+    vim.keymap.set ("n", "dj", vim.diagnostic.goto_next, options) -- goto dignostic next
+    vim.keymap.set ("n", "dk", vim.diagnostic.goto_prev, options) -- goto diognostic prev
+    vim.keymap.set ("n", "dl", "<cmd>Telescope diagnostic", options) -- goto list failure
+    vim.keymap.set ("n", "<leader>r", vim.lsp.buf.rename, options)
+end
+
+local cmp = require('cmp')
+local cmp_select = {behavior = cmp.SelectBehavior.Select}
+local cmp_mappings = lsp.defaults.cmp_mappings({
+    ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
+    ['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
+    ['<C-y>'] = cmp.mapping.confirm({ select = true }),
+    ["<C-Space>"] = cmp.mapping.complete(),
+})
+
+lsp.setup_nvim_cmp({
+    mapping = cmp_mappings,
+})
+
+cmp.setup({
+    experimental = { ghost_text = true },
+});
+
 lsp.setup()
 
-vim.lsp.handlers["textDocument/publishDiagnostics"] =
-vim.lsp.with(
-    vim.lsp.diagnostic.on_publish_diagnostics,
-    {
-        virtual_text = true, -- inline diagnostic on line end
-    }
-)
+vim.diagnostic.config( { virtual_text = true } )
diff --git a/stow/nvim/.config/nvim/after/plugin/treesitter.lua b/stow/nvim/.config/nvim/after/plugin/treesitter.lua
new file mode 100644 (file)
index 0000000..cf2bed1
--- /dev/null
@@ -0,0 +1,11 @@
+require'nvim-treesitter.configs'.setup {
+--    ensure_installed = "all",
+    sync_install = false,
+    auto_install = true,
+
+    highlight = {
+        enable = true,
+        additional_vim_regex_highlighting = false,
+    },
+    indent = { enable = true, },
+}
index 4d72f24aad83002c3299a213904e16d19509f1d9..f57bdd2b401340cf7821ba89ce483626778b8941 100644 (file)
@@ -1,13 +1,8 @@
-
 local data_path = vim.fn.stdpath('data')
 vim.o.backupdir = data_path .. "/backup//"
 pcall (require 'plugin_mgr')
-
 pcall (require 'set')
 pcall (require 'mappings')
-pcall (require 'treesitter')
-pcall (require 'perl')
-pcall (require 'cmp-settings')
 
 -- found in ThePrimagen dotfiles:
 local augroup = vim.api.nvim_create_augroup
diff --git a/stow/nvim/.config/nvim/lua/cmp-settings.lua b/stow/nvim/.config/nvim/lua/cmp-settings.lua
deleted file mode 100644 (file)
index 517fc9d..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-
--- mostly got this stuff from here: https://raw.githubusercontent.com/tjdevries/config_manager/master/xdg_config/nvim/after/plugin/completion.lua
-vim.opt.completeopt = { "menu", "menuone", "noselect" }
-
--- Don't show the dumb matching stuff.
-vim.opt.shortmess:append "c"
-
-
-local ok, lspkind = pcall(require, "lspkind")
-if not ok then
-  return
-end
-
-lspkind.init()
-
-local cmp = require "cmp"
-
-cmp.setup {
-  mapping = {
-    ["<C-n>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
-    ["<C-p>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
-    ["<C-d>"] = cmp.mapping.scroll_docs(-4),
-    ["<C-f>"] = cmp.mapping.scroll_docs(4),
-    ["<C-e>"] = cmp.mapping.abort(),
-    ["<c-y>"] = cmp.mapping(
-      cmp.mapping.confirm {
-        behavior = cmp.ConfirmBehavior.Insert,
-        select = true,
-      },
-      { "i", "c" }
-    ),
-
-    ["<c-space>"] = cmp.mapping {
-      i = cmp.mapping.complete(),
-      c = function(
-        _ --[[fallback]]
-      )
-        if cmp.visible() then
-          if not cmp.confirm { select = true } then
-            return
-          end
-        else
-          cmp.complete()
-        end
-      end,
-    },
-
-    -- ["<tab>"] = false,
-    ["<tab>"] = cmp.config.disable,
-
-    -- Testing
-    ["<c-q>"] = cmp.mapping.confirm {
-      behavior = cmp.ConfirmBehavior.Replace,
-      select = true,
-    },
-
-  },
-
-  sources = {
-
-    -- Youtube: Could enable this only for lua, but nvim_lua handles that already.
-    { name = "nvim_lua" },
-    { name = "nvim_lsp" },
-    { name = "path" },
-    { name = "buffer", keyword_length = 3 },
-  },
-
-  sorting = {
-    -- TODO: Would be cool to add stuff like "See variable names before method names" in rust, or something like that.
-    comparators = {
-      cmp.config.compare.offset,
-      cmp.config.compare.exact,
-      cmp.config.compare.score,
-
-      -- copied from cmp-under, but I don't think I need the plugin for this.
-      -- I might add some more of my own.
-      function(entry1, entry2)
-        local _, entry1_under = entry1.completion_item.label:find "^_+"
-        local _, entry2_under = entry2.completion_item.label:find "^_+"
-        entry1_under = entry1_under or 0
-        entry2_under = entry2_under or 0
-        if entry1_under > entry2_under then
-          return false
-        elseif entry1_under < entry2_under then
-          return true
-        end
-      end,
-
-      cmp.config.compare.kind,
-      cmp.config.compare.sort_text,
-      cmp.config.compare.length,
-      cmp.config.compare.order,
-    },
-  },
-
-  -- do i want luasnip?
-  -- snippet = {
-  --   expand = function(args)
-  --     require("luasnip").lsp_expand(args.body)
-  --   end,
-  -- },
-
-  formatting = {
-    -- Youtube: How to set up nice formatting for your sources.
-    format = lspkind.cmp_format {
-      with_text = true,
-      menu = {
-        buffer = "[buf]",
-        nvim_lsp = "[LSP]",
-        nvim_lua = "[api]",
-        path = "[path]",
-        luasnip = "[snip]",
-        gh_issues = "[issues]",
-        tn = "[TabNine]",
-      },
-    },
-  },
-
-  experimental = {
-    native_menu = false,
-  },
-}
diff --git a/stow/nvim/.config/nvim/lua/csharp.lua b/stow/nvim/.config/nvim/lua/csharp.lua
deleted file mode 100644 (file)
index 0ad4a5d..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-require'lspconfig'.csharp_ls.setup({ -- install server: 'dotnet tool install --global csharp-ls'
---        cmd = {"~\\.dotnet\\tools\\csharp-ls.exe"},
-    on_attach = function ()
-        vim.keymap.set ("n", "K", vim.lsp.buf.hover, { buffer=0}) -- buffer=0 -> only in current buffer
-        vim.keymap.set ("n", "gd", vim.lsp.buf.definition, { buffer=0}) -- goto definition
-        vim.keymap.set ("n", "gT", vim.lsp.buf.type_definition, { buffer=0}) -- goto typedefinition
-        vim.keymap.set ("n", "gi", vim.lsp.buf.implementation, { buffer=0}) -- goto implementation
-        vim.keymap.set ("n", "dj", vim.diagnostic.goto_next, { buffer=0}) -- goto dignostic next
-        vim.keymap.set ("n", "dk", vim.diagnostic.goto_prev, { buffer=0}) -- goto diognostic prev
-        vim.keymap.set ("n", "dl", "<cmd>Telescope diagnostic", { buffer=0}) -- goto list failure
-        vim.keymap.set ("n", "<leader>r", vim.lsp.buf.rename, { buffer=0})
-    end
-})
index fdfbae78519b2c960074657d91601cf48e641ba5..c3c0d447aa203285455a5ca868657f389516e26b 100644 (file)
@@ -1,19 +1,3 @@
-function map(mode, shortcut, command)
-    vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true })
-end
-
-function nmap(shortcut, command)
-    map('n', shortcut, command)
-end
-
-function imap(shortcut, command)
-    map('i', shortcut, command)
-end
-
-function vmap(shortcut, command)
-    map('v', shortcut, command)
-end
-
 vim.g.mapleader = " "
 vim.keymap.set("n", "<F8>", "]s")
 vim.keymap.set("n", "<S-F8>", "[s")
diff --git a/stow/nvim/.config/nvim/lua/perl.lua b/stow/nvim/.config/nvim/lua/perl.lua
deleted file mode 100644 (file)
index e69de29..0000000
index 39a670756267639a4e0b39b2cf2e84eec7e504d7..1f60c40ff86cc04456fd7f1e18913621b52cc53c 100644 (file)
@@ -48,14 +48,11 @@ return require('packer').startup(function(use)
             {'L3MON4D3/LuaSnip'},
             {'rafamadriz/friendly-snippets'},
 
-
-            -- git 
-            { 'tpope/vim-fugitive' },
         }
     }
 
-    -- complition stuff
-    use { 'hrsh7th/cmp-cmdline' }
+    -- git 
+    use { 'tpope/vim-fugitive' }
 
     use {
         'nvim-telescope/telescope.nvim', branch = '0.1.x',
diff --git a/stow/nvim/.config/nvim/lua/treesitter.lua b/stow/nvim/.config/nvim/lua/treesitter.lua
deleted file mode 100644 (file)
index 7c83727..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-
-require'nvim-treesitter.configs'.setup {
---    ensure_installed = "all",
-    sync_install = false,
-
-    highlight = {
-        enable = true,
-        additional_vim_regex_highlighting = false,
-    },
-    indent = { enable = true, },
-}