From a98e149ad115bfba211a3e81f9975d89af43daef Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Tue, 12 Oct 2021 13:05:10 +0200 Subject: [PATCH 1/3] feat: make opam more XDG_USER_DIR compliant $OPAMROOT contains both config and data, so it's not perfect... still better than having it in ~/ tho ! --- .config/zsh/.zprofile | 2 ++ .config/zsh/.zshrc | 3 +++ 2 files changed, 5 insertions(+) diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile index 043d577..e8160f0 100644 --- a/.config/zsh/.zprofile +++ b/.config/zsh/.zprofile @@ -19,6 +19,8 @@ export ANDROID_PREFS_ROOT="$XDG_CONFIG_HOME/android" export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc-2.0" export TEXMFHOME="$XDG_DATA_HOME/texmf" export CARGO_HOME="$XDG_DATA_HOME/cargo" +export OPAMROOT="$XDG_DATA_HOME/opam" +export COQBIN="$OPAMROOT/default/bin" ## default programs export SUDO_ASKPASS="$HOME/.local/bin/dmenupass" diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 277119e..7588c43 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -78,3 +78,6 @@ typeset -A ZSH_HIGHLIGHT_STYLES ZSH_HIGHLIGHT_STYLES[alias]='fg=green,bold' ZSH_HIGHLIGHT_STYLES[path]='fg=magenta,bold' ZSH_HIGHLIGHT_STYLES[unknown-token]='bg=red,fg=white,bold' + +# opam configuration +test -r "$OPAMROOT/opam-init/init.zsh" && . "$OPAMROOT/opam-init/init.zsh" > /dev/null 2> /dev/null || true From 05d89420f027d0e6a8c81e1a8c5ff35289b48d17 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Tue, 12 Oct 2021 14:00:47 +0200 Subject: [PATCH 2/3] fix: nvim-cmp config fix [Tab] behavior --- .config/nvim/lua/plugin/cmp.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.config/nvim/lua/plugin/cmp.lua b/.config/nvim/lua/plugin/cmp.lua index deebb51..fee7dda 100644 --- a/.config/nvim/lua/plugin/cmp.lua +++ b/.config/nvim/lua/plugin/cmp.lua @@ -58,8 +58,8 @@ cmp.setup { select = true, }), [""] = cmp.mapping(function(fallback) - if vim.fn.pumvisible() == 1 then - vim.fn.feedkeys(t "", "n") + if cmp.visible() then + cmp.select_next_item() elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() elseif check_backspace() then @@ -69,8 +69,8 @@ cmp.setup { end end, { "i", "s" }), [""] = cmp.mapping(function(fallback) - if vim.fn.pumvisible() == 1 then - vim.fn.feedkeys(t "", "n") + if cmp.visible() then + cmp.select_prev_item() elseif luasnip.jumpable(-1) then luasnip.jump(-1) else From 101d37ff52b15cda66505e8528dd8bba230a1acb Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Tue, 12 Oct 2021 14:01:37 +0200 Subject: [PATCH 3/3] feat: update lsp config c: make nvim-cmp capabalities available lua: ignore some non-standard keywords --- .config/nvim/lua/lsp/c.lua | 9 ++++++++- .config/nvim/lua/lsp/lua.lua | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.config/nvim/lua/lsp/c.lua b/.config/nvim/lua/lsp/c.lua index e9277c0..986eca3 100644 --- a/.config/nvim/lua/lsp/c.lua +++ b/.config/nvim/lua/lsp/c.lua @@ -3,11 +3,18 @@ -- License : GPLv3 -- Description : clangd config file for lsp +-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers.. +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) + + require("lspconfig").clangd.setup { cmd = { "clangd", "--background-index", "--suggest-missing-includes", "--clang-tidy", "--header-insertion=iwyu" - } + }, + -- The following example advertise capabilities to `clangd`. + capabilities = capabilities, } diff --git a/.config/nvim/lua/lsp/lua.lua b/.config/nvim/lua/lsp/lua.lua index 11567ec..892afc2 100644 --- a/.config/nvim/lua/lsp/lua.lua +++ b/.config/nvim/lua/lsp/lua.lua @@ -21,7 +21,7 @@ require'lspconfig'.sumneko_lua.setup { }, diagnostics = { -- Get the language server to recognize the `vim` global - globals = {'vim'}, + globals = {"vim", "use", "globals", "utils"}, }, workspace = { -- Make the server aware of Neovim runtime files