From 795552cf2e6c8fd7df7698fc7cff346df0356189 Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Fri, 28 Jan 2022 21:57:04 +0100 Subject: [PATCH] Changed some nvim config stuff --- nvim/.config/nvim/init.vim | 22 ++- nvim/.config/nvim/lua/plugins.lua | 167 ++++++++++++------- nvim/.config/nvim/plugin/packer_compiled.lua | 105 ++++++++---- zsh/.zcompcache/docker_subcommands | 2 +- 4 files changed, 200 insertions(+), 96 deletions(-) diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index 756d0a2..0a8663e 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -10,18 +10,21 @@ let delimitMate_balance_matchpairs = 1 " Theme colorscheme gruvbox +" colorscheme codedark set t_Co=256 set t_ZH= set t_ZR= set background=dark " Ident -set list lcs=tab:┃\ ,trail:· +" set list lcs=tab:┃\ ,trail:· +set list lcs=tab:¦\ ,trail:· " Airline let g:airline_powerline_fonts = 1 let g:airline#extensions#tabline#enabled = 1 let g:airline_theme='gruvbox' +" let g:airline_theme='codedark' let g:airline_section_z = '%3p%% %#__accent_bold#%4l%#__restore__#%#__accent_bold#/%L%#__restore__# :%3v' let g:airline_section_warning = '' @@ -82,3 +85,20 @@ map lf :lua vim.lsp.buf.formatting() let g:closetag_filenames = "*.html,*.xhtml,*.phtml,*.erb,*.jsx,*.tsx" let g:closetag_xhtml_filenames = '*.xhtml,*.jsx,*.tsx,*.erb' + +" gray +highlight! CmpItemAbbrDeprecated guibg=NONE gui=strikethrough guifg=#808080 +" blue +highlight! CmpItemAbbrMatch guibg=NONE guifg=#569CD6 +highlight! CmpItemAbbrMatchFuzzy guibg=NONE guifg=#569CD6 +" light blue +highlight! CmpItemKindVariable guibg=NONE guifg=#9CDCFE +highlight! CmpItemKindInterface guibg=NONE guifg=#9CDCFE +highlight! CmpItemKindText guibg=NONE guifg=#9CDCFE +" pink +highlight! CmpItemKindFunction guibg=NONE guifg=#C586C0 +highlight! CmpItemKindMethod guibg=NONE guifg=#C586C0 +" front +highlight! CmpItemKindKeyword guibg=NONE guifg=#D4D4D4 +highlight! CmpItemKindProperty guibg=NONE guifg=#D4D4D4 +highlight! CmpItemKindUnit guibg=NONE guifg=#D4D4D4 diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua index fa794a6..913365f 100644 --- a/nvim/.config/nvim/lua/plugins.lua +++ b/nvim/.config/nvim/lua/plugins.lua @@ -8,12 +8,13 @@ require('packer').startup(function() use 'wbthomason/packer.nvim' use 'gruvbox-community/gruvbox' + use 'tomasiser/vim-code-dark' use 'bling/vim-airline' use 'Raimondi/delimitMate' use 'alvan/vim-closetag' use 'scrooloose/nerdtree' - -- use 'tomtom/tcomment_vim' + -- -- use 'tomtom/tcomment_vim' use 'tpope/vim-commentary' use 'tpope/vim-surround' use 'christoomey/vim-tmux-navigator' @@ -23,23 +24,26 @@ require('packer').startup(function() -- use { 'junegunn/fzf', run = './install --bin' } -- use 'junegunn/fzf.vim' -- use 'tpope/vim-fugitive' - use 'ConradIrwin/vim-bracketed-paste' + -- use 'ConradIrwin/vim-bracketed-paste' use { 'nvim-telescope/telescope.nvim', requires = { {'nvim-lua/plenary.nvim'} } } - use 'neovim/nvim-lspconfig' -- Collection of configurations for built-in LSP client - use 'hrsh7th/nvim-cmp' -- Autocompletion plugin - use 'hrsh7th/cmp-nvim-lsp' -- LSP source for nvim-cmp - use 'hrsh7th/cmp-buffer' -- LSP source for buffer - use 'saadparwaiz1/cmp_luasnip' -- Snippets source for nvim-cmp - use 'L3MON4D3/LuaSnip' -- Snippets plugin - -- use 'ray-x/lsp_signature.nvim' + use 'neovim/nvim-lspconfig' + use 'hrsh7th/cmp-nvim-lsp' + use 'hrsh7th/cmp-buffer' + use 'hrsh7th/cmp-path' + use 'hrsh7th/cmp-cmdline' + use 'hrsh7th/nvim-cmp' + use 'onsails/lspkind-nvim' + + use 'hrsh7th/cmp-vsnip' + use 'hrsh7th/vim-vsnip' + use "rafamadriz/friendly-snippets" use 'leafgarland/typescript-vim' use 'peitalin/vim-jsx-typescript' - use 'cespare/vim-toml' end) --Remap for dealing with word wrap @@ -48,6 +52,74 @@ vim.api.nvim_set_keymap('n', 'j', "v:count == 0 ? 'gj' : 'j'", { noremap = true, require('telescope').setup{ defaults = { file_ignore_patterns = { "node_module" } } } +-- nvim-cmp setup +local cmp = require 'cmp' + +local has_words_before = function() + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil +end + +local feedkey = function(key, mode) + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true) +end + +cmp.setup { + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, + mapping = { + [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), + [''] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif vim.fn["vsnip#available"](1) == 1 then + feedkey("(vsnip-expand-or-jump)", "") + elseif has_words_before() then + cmp.complete() + else + fallback() -- The fallback function sends a already mapped key. In this case, it's probably ``. + end + end, { "i", "s" }), + [""] = cmp.mapping(function() + if cmp.visible() then + cmp.select_prev_item() + elseif vim.fn["vsnip#jumpable"](-1) == 1 then + feedkey("(vsnip-jump-prev)", "") + end + end, { "i", "s" }), + }, + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'vsnip' }, -- For vsnip users. + }, { + { name = 'buffer' }, + }) +} + +-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline('/', { + sources = { + { name = 'buffer' } + } +}) + +-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline(':', { + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }) +}) + +-- lsp setup local nvim_lsp = require('lspconfig') vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( @@ -93,11 +165,12 @@ augroup LSPDiagnosticsOnHover augroup END ]] -vim.cmd [[autocmd CursorHoldI * lua vim.lsp.buf.signature_help()]] +vim.cmd [[autocmd CursorHoldI * silent! lua vim.lsp.buf.signature_help()]] -- Enable some language servers with the additional completion capabilities offered by nvim-cmp local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) +capabilities.textDocument.completion.completionItem.snippetSupport = true local servers = { 'clangd', 'tsserver', 'gopls', 'pylsp' } for _, lsp in ipairs(servers) do @@ -107,6 +180,30 @@ for _, lsp in ipairs(servers) do } end +nvim_lsp.cssls.setup { + capabilities = capabilities, + cmd = {"vscode-css-languageserver", "--stdio"} +} + +local lspkind = require('lspkind') +cmp.setup { + formatting = { + format = lspkind.cmp_format({ + with_text = true, + menu = ({ + buffer = "[Buffer]", + nvim_lsp = "[LSP]", + luasnip = "[LuaSnip]", + nvim_lua = "[Lua]", + latex_symbols = "[Latex]", + }) + }), + }, + experimental = { + ghost_text = true + } +} + vim.fn.sign_define("LspDiagnosticsSignError", { text="" }) vim.fn.sign_define("LspDiagnosticsSignWarning", { text="" }) vim.fn.sign_define("LspDiagnosticsSignInformation", { text="" }) @@ -114,51 +211,3 @@ vim.fn.sign_define("LspDiagnosticsSignHint", { text="" }) -- Set completeopt to have a better completion experience vim.o.completeopt = 'menuone,noselect' - --- luasnip setup -local luasnip = require 'luasnip' - --- nvim-cmp setup -local cmp = require 'cmp' -cmp.setup { - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) - end, - }, - mapping = { - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - [''] = function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, - [''] = function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, - }, - sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { name = 'buffer' }, - }, -} diff --git a/nvim/.config/nvim/plugin/packer_compiled.lua b/nvim/.config/nvim/plugin/packer_compiled.lua index 731e8d1..c72dce4 100644 --- a/nvim/.config/nvim/plugin/packer_compiled.lua +++ b/nvim/.config/nvim/plugin/packer_compiled.lua @@ -57,7 +57,7 @@ end time([[Luarocks path setup]], false) time([[try_loadstring definition]], true) local function try_loadstring(s, component, name) - local success, result = pcall(loadstring(s)) + local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) if not success then vim.schedule(function() vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) @@ -69,105 +69,140 @@ end time([[try_loadstring definition]], false) time([[Defining packer_plugins]], true) _G.packer_plugins = { - LuaSnip = { - loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/LuaSnip" - }, ["cmp-buffer"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/cmp-buffer" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/cmp-buffer", + url = "https://github.com/hrsh7th/cmp-buffer" + }, + ["cmp-cmdline"] = { + loaded = true, + path = "/home/tim/.local/share/nvim/site/pack/packer/start/cmp-cmdline", + url = "https://github.com/hrsh7th/cmp-cmdline" }, ["cmp-nvim-lsp"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", + url = "https://github.com/hrsh7th/cmp-nvim-lsp" }, - cmp_luasnip = { + ["cmp-path"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/cmp_luasnip" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/cmp-path", + url = "https://github.com/hrsh7th/cmp-path" + }, + ["cmp-vsnip"] = { + loaded = true, + path = "/home/tim/.local/share/nvim/site/pack/packer/start/cmp-vsnip", + url = "https://github.com/hrsh7th/cmp-vsnip" }, delimitMate = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/delimitMate" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/delimitMate", + url = "https://github.com/Raimondi/delimitMate" + }, + ["friendly-snippets"] = { + loaded = true, + path = "/home/tim/.local/share/nvim/site/pack/packer/start/friendly-snippets", + url = "https://github.com/rafamadriz/friendly-snippets" }, gruvbox = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/gruvbox" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/gruvbox", + url = "https://github.com/gruvbox-community/gruvbox" }, - ["lsp_signature.nvim"] = { + ["lspkind-nvim"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/lsp_signature.nvim" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/lspkind-nvim", + url = "https://github.com/onsails/lspkind-nvim" }, nerdtree = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/nerdtree" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/nerdtree", + url = "https://github.com/scrooloose/nerdtree" }, ["nvim-cmp"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-cmp" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-cmp", + url = "https://github.com/hrsh7th/nvim-cmp" }, ["nvim-lspconfig"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-lspconfig" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", + url = "https://github.com/neovim/nvim-lspconfig" }, ["packer.nvim"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/packer.nvim" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" }, ["plenary.nvim"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/plenary.nvim" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" }, ["telescope.nvim"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/telescope.nvim" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/telescope.nvim", + url = "https://github.com/nvim-telescope/telescope.nvim" }, ["typescript-vim"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/typescript-vim" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/typescript-vim", + url = "https://github.com/leafgarland/typescript-vim" }, ["vim-airline"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-airline" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-airline", + url = "https://github.com/bling/vim-airline" }, ["vim-bbye"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-bbye" - }, - ["vim-bracketed-paste"] = { - loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-bracketed-paste" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-bbye", + url = "https://github.com/moll/vim-bbye" }, ["vim-closetag"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-closetag" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-closetag", + url = "https://github.com/alvan/vim-closetag" + }, + ["vim-code-dark"] = { + loaded = true, + path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-code-dark", + url = "https://github.com/tomasiser/vim-code-dark" }, ["vim-commentary"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-commentary" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-commentary", + url = "https://github.com/tpope/vim-commentary" }, ["vim-dispatch"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-dispatch" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-dispatch", + url = "https://github.com/tpope/vim-dispatch" }, ["vim-jsx-typescript"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-jsx-typescript" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-jsx-typescript", + url = "https://github.com/peitalin/vim-jsx-typescript" }, ["vim-surround"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-surround" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-surround", + url = "https://github.com/tpope/vim-surround" }, ["vim-tmux-navigator"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-tmux-navigator" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-tmux-navigator", + url = "https://github.com/christoomey/vim-tmux-navigator" }, ["vim-togglelist"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-togglelist" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-togglelist", + url = "https://github.com/milkypostman/vim-togglelist" }, - ["vim-toml"] = { + ["vim-vsnip"] = { loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-toml" + path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-vsnip", + url = "https://github.com/hrsh7th/vim-vsnip" } } diff --git a/zsh/.zcompcache/docker_subcommands b/zsh/.zcompcache/docker_subcommands index 9c7e771..65935e4 100644 --- a/zsh/.zcompcache/docker_subcommands +++ b/zsh/.zcompcache/docker_subcommands @@ -1,4 +1,4 @@ _docker_subcommands=( ${(Q)"${(z)$(<<\EO:_docker_subcommands -'builder:Manage builds' 'buildx*:Build with BuildKit (Docker Inc., v0.6.1-docker)' 'compose*:Docker Compose (Docker Inc., 2.2.0)' 'config:Manage Docker configs' 'container:Manage containers' 'context:Manage contexts' 'image:Manage images' 'manifest:Manage Docker image manifests and manifest lists' 'network:Manage networks' 'node:Manage Swarm nodes' 'plugin:Manage plugins' 'secret:Manage Docker secrets' 'service:Manage services' 'stack:Manage Docker stacks' 'swarm:Manage Swarm' 'system:Manage Docker' 'trust:Manage trust on Docker images' 'volume:Manage volumes' 'attach:Attach local standard input, output, and error streams to a running container' 'build:Build an image from a Dockerfile' 'commit:Create a new image from a container''s changes' 'cp:Copy files/folders between a container and the local filesystem' 'create:Create a new container' 'diff:Inspect changes to files or directories on a container''s filesystem' 'events:Get real time events from the server' 'exec:Run a command in a running container' 'export:Export a container''s filesystem as a tar archive' 'history:Show the history of an image' 'images:List images' 'import:Import the contents from a tarball to create a filesystem image' 'info:Display system-wide information' 'inspect:Return low-level information on Docker objects' 'kill:Kill one or more running containers' 'load:Load an image from a tar archive or STDIN' 'login:Log in to a Docker registry' 'logout:Log out from a Docker registry' 'logs:Fetch the logs of a container' 'pause:Pause all processes within one or more containers' 'port:List port mappings or a specific mapping for the container' 'ps:List containers' 'pull:Pull an image or a repository from a registry' 'push:Push an image or a repository to a registry' 'rename:Rename a container' 'restart:Restart one or more containers' 'rm:Remove one or more containers' 'rmi:Remove one or more images' 'run:Run a command in a new container' 'save:Save one or more images to a tar archive (streamed to STDOUT by default)' 'search:Search the Docker Hub for images' 'start:Start one or more stopped containers' 'stats:Display a live stream of container(s) resource usage statistics' 'stop:Stop one or more running containers' 'tag:Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE' 'top:Display the running processes of a container' 'unpause:Unpause all processes within one or more containers' 'update:Update configuration of one or more containers' 'version:Show the Docker version information' 'wait:Block until one or more containers stop, then print their exit codes' 'daemon:Enable daemon mode' 'help:Show help for a command' +'builder:Manage builds' 'buildx*:Docker Buildx (Docker Inc., v0.7.1-docker)' 'compose*:Docker Compose (Docker Inc., 2.2.2)' 'config:Manage Docker configs' 'container:Manage containers' 'context:Manage contexts' 'image:Manage images' 'manifest:Manage Docker image manifests and manifest lists' 'network:Manage networks' 'node:Manage Swarm nodes' 'plugin:Manage plugins' 'secret:Manage Docker secrets' 'service:Manage services' 'stack:Manage Docker stacks' 'swarm:Manage Swarm' 'system:Manage Docker' 'trust:Manage trust on Docker images' 'volume:Manage volumes' 'attach:Attach local standard input, output, and error streams to a running container' 'build:Build an image from a Dockerfile' 'commit:Create a new image from a container''s changes' 'cp:Copy files/folders between a container and the local filesystem' 'create:Create a new container' 'diff:Inspect changes to files or directories on a container''s filesystem' 'events:Get real time events from the server' 'exec:Run a command in a running container' 'export:Export a container''s filesystem as a tar archive' 'history:Show the history of an image' 'images:List images' 'import:Import the contents from a tarball to create a filesystem image' 'info:Display system-wide information' 'inspect:Return low-level information on Docker objects' 'kill:Kill one or more running containers' 'load:Load an image from a tar archive or STDIN' 'login:Log in to a Docker registry' 'logout:Log out from a Docker registry' 'logs:Fetch the logs of a container' 'pause:Pause all processes within one or more containers' 'port:List port mappings or a specific mapping for the container' 'ps:List containers' 'pull:Pull an image or a repository from a registry' 'push:Push an image or a repository to a registry' 'rename:Rename a container' 'restart:Restart one or more containers' 'rm:Remove one or more containers' 'rmi:Remove one or more images' 'run:Run a command in a new container' 'save:Save one or more images to a tar archive (streamed to STDOUT by default)' 'search:Search the Docker Hub for images' 'start:Start one or more stopped containers' 'stats:Display a live stream of container(s) resource usage statistics' 'stop:Stop one or more running containers' 'tag:Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE' 'top:Display the running processes of a container' 'unpause:Unpause all processes within one or more containers' 'update:Update configuration of one or more containers' 'version:Show the Docker version information' 'wait:Block until one or more containers stop, then print their exit codes' 'daemon:Enable daemon mode' 'help:Show help for a command' EO:_docker_subcommands )}"} )