}
}
})
+
+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 } )
--- /dev/null
+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, },
+}
-
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
+++ /dev/null
-
--- 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,
- },
-}
+++ /dev/null
-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
-})
-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")
{'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',
+++ /dev/null
-
-require'nvim-treesitter.configs'.setup {
--- ensure_installed = "all",
- sync_install = false,
-
- highlight = {
- enable = true,
- additional_vim_regex_highlighting = false,
- },
- indent = { enable = true, },
-}