Moved over part of config to lua and switched to intergrated lsp

This commit is contained in:
Dreaded_X 2021-10-12 02:14:29 +02:00
parent 385db48967
commit 001a3c4161
7 changed files with 322 additions and 5461 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
zsh/.zcompdump
zsh/.zcompcache
zsh/.zcompdump.zwc
zsh/.zhistory

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +1,4 @@
call plug#begin('~/.dotfiles/nvim/.config/nvim/plugged')
Plug 'morhetz/gruvbox'
Plug 'bling/vim-airline'
Plug 'Raimondi/delimitMate'
Plug 'scrooloose/nerdtree'
Plug 'tomtom/tcomment_vim'
Plug 'tpope/vim-surround'
Plug 'christoomey/vim-tmux-navigator'
Plug 'tpope/vim-dispatch'
Plug 'milkypostman/vim-togglelist'
Plug 'moll/vim-bbye'
Plug 'junegunn/fzf', {'do': './install --bin'}
Plug 'junegunn/fzf.vim'
Plug 'tpope/vim-fugitive'
Plug 'ConradIrwin/vim-bracketed-paste'
Plug 'ncm2/ncm2'
Plug 'roxma/nvim-yarp'
Plug 'ncm2/ncm2-bufword'
Plug 'ncm2/ncm2-path'
Plug 'ncm2/ncm2-tmux'
Plug 'ncm2/ncm2-tern', {'do': 'npm install'}
Plug 'Shougo/echodoc.vim'
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
call plug#end()
lua require('plugins')
" Load vim config in current directory
silent! so .vimlocal
@ -81,7 +51,7 @@ set updatetime=300
set noshowmode
" Keybindings
map <silent> <F2> :NERDTreeToggle<cr>
map <silent> <M-2> :NERDTreeToggle<cr>
map <silent> <M-h> :TmuxNavigateLeft<cr>
map <silent> <M-j> :TmuxNavigateDown<cr>
map <silent> <M-k> :TmuxNavigateUp<cr>
@ -91,86 +61,21 @@ map <silent> <S-tab> :bp<cr>
map <silent> <S-j> 10j
map <silent> <S-k> 10k
map <silent> <C-b> :Bdelete<cr>
map <silent> <F4> :call ToggleQuickfixList()<cr>
map <silent> <F11> :noh<cr>
map <silent> <leader>m :call LanguageClient_contextMenu()<cr>
map <silent> <leader>n :cnext<cr>
map <silent> <leader>N :cprevious<cr>
map <silent> <leader>b :Buffers<cr>
map <silent> <leader>c :Commits<cr>
map <silent> <leader>f :Ag<cr>
map <silent> <M-3> :call ToggleQuickfixList()<cr>
map <silent> <M-1> :noh<cr>
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
imap <expr> <BS> pumvisible() ? "\<bs>" : "<Plug>delimitMateBS"
imap <expr> <cr> pumvisible() ? "\<C-y>\<cr>" : "<Plug>delimitMateCR"
" Use fzf and silver searcher to search files (REQUIRES: the_silver_searcher)
if executable('ag')
map <silent> <C-p> :call fzf#run(fzf#wrap('custom', {'source': 'ag -g ""'}, 0))<cr>
endif
let g:fzf_layout = {'down': '~20%'}
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'border': ['fg', 'Ignore'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
map <silent> <leader>ln :lua vim.lsp.diagnostic.goto_next()<cr>
map <silent> <leader>lp :lua vim.lsp.diagnostic.goto_prev()<cr>
map <leader>ll :lua vim.lsp.buf.
map <silent> <leader>lh :lua vim.lsp.buf.hover()<cr>
autocmd! FileType fzf
autocmd FileType fzf set laststatus=0 noruler
\| autocmd BufLeave <buffer> set laststatus=2 ruler
" ncm2
autocmd BufEnter * call ncm2#enable_for_buffer()
set completeopt=noinsert,menuone,noselect
" Echodoc
let g:echodoc#enable_at_startup = 1
let g:echodoc#type = 'signature'
" LanguageClient
let g:LanguageClient_serverCommands = {
\ 'cpp': ['clangd'],
\ 'cc': ['clangd'],
\ 'c': ['clangd'],
\ 'python': ['pyls'],
\ }
let g:LanguageClient_diagnosticsDisplay = {
\ 1: {
\ "name": "Error",
\ "texthl": "GruvBoxRedSign",
\ "signText": "",
\ "signTexthl": "GruvBoxRedSign",
\ "virtualTexthl": "GruvBoxRedSign",
\ },
\ 2: {
\ "name": "Warning",
\ "texthl": "ALEWarning",
\ "signText": "",
\ "signTexthl": "ALEWarningSign",
\ "virtualTexthl": "GruvBoxYellowSign",
\ },
\ 3: {
\ "name": "Information",
\ "texthl": "ALEInfo",
\ "signText": "",
\ "signTexthl": "ALEInfoSign",
\ "virtualTexthl": "Todo",
\ },
\ 4: {
\ "name": "Hint",
\ "texthl": "ALEInfo",
\ "signText": "",
\ "signTexthl": "ALEInfoSign",
\ "virtualTexthl": "Todo",
\ },}
let g:closetag_filenames = "*.html,*.xhtml,*.phtml,*.erb,*.jsx,*.tsx"
let g:closetag_xhtml_filenames = '*.xhtml,*.jsx,*.tsx,*.erb'

View File

@ -0,0 +1,126 @@
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
end
require('packer').startup(function()
use 'wbthomason/packer.nvim'
use 'gruvbox-community/gruvbox'
use 'bling/vim-airline'
use 'Raimondi/delimitMate'
use 'alvan/vim-closetag'
use 'scrooloose/nerdtree'
-- use 'tomtom/tcomment_vim'
use 'tpope/vim-commentary'
use 'tpope/vim-surround'
use 'christoomey/vim-tmux-navigator'
use 'tpope/vim-dispatch'
use 'milkypostman/vim-togglelist'
use 'moll/vim-bbye'
-- use { 'junegunn/fzf', run = './install --bin' }
-- use 'junegunn/fzf.vim'
-- use 'tpope/vim-fugitive'
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 'leafgarland/typescript-vim'
use 'peitalin/vim-jsx-typescript'
use 'cespare/vim-toml'
end)
local nvim_lsp = require('lspconfig')
-- Add additional capabilities supported by nvim-cmp
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = {
spacing = 8,
},
signs = true,
update_in_insert = false
}
)
vim.o.updatetime = 250
vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.lsp.diagnostic.show_line_diagnostics({focusable=false})]]
-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
local servers = { 'clangd', 'tsserver', 'gopls', 'pylsp' }
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
-- on_attach = my_custom_on_attach,
capabilities = capabilities
}
end
vim.fn.sign_define("LspDiagnosticsSignError", { text="" })
vim.fn.sign_define("LspDiagnosticsSignWarning", { text="" })
vim.fn.sign_define("LspDiagnosticsSignInformation", { text="" })
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 = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-expand-or-jump', true, true, true), '')
else
fallback()
end
end,
['<S-Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-jump-prev', true, true, true), '')
else
fallback()
end
end,
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'buffer' },
},
}

View File

@ -0,0 +1,181 @@
-- Automatically generated packer.nvim plugin loader code
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
return
end
vim.api.nvim_command('packadd packer.nvim')
local no_errors, error_msg = pcall(function()
local time
local profile_info
local should_profile = false
if should_profile then
local hrtime = vim.loop.hrtime
profile_info = {}
time = function(chunk, start)
if start then
profile_info[chunk] = hrtime()
else
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
end
end
else
time = function(chunk, start) end
end
local function save_profiles(threshold)
local sorted_times = {}
for chunk_name, time_taken in pairs(profile_info) do
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
end
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
local results = {}
for i, elem in ipairs(sorted_times) do
if not threshold or threshold and elem[2] > threshold then
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
end
end
_G._packer = _G._packer or {}
_G._packer.profile_output = results
end
time([[Luarocks path setup]], true)
local package_path_str = "/home/tim/.cache/nvim/packer_hererocks/2.0.5/share/lua/5.1/?.lua;/home/tim/.cache/nvim/packer_hererocks/2.0.5/share/lua/5.1/?/init.lua;/home/tim/.cache/nvim/packer_hererocks/2.0.5/lib/luarocks/rocks-5.1/?.lua;/home/tim/.cache/nvim/packer_hererocks/2.0.5/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/tim/.cache/nvim/packer_hererocks/2.0.5/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str
end
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
package.cpath = package.cpath .. ';' .. install_cpath_pattern
end
time([[Luarocks path setup]], false)
time([[try_loadstring definition]], true)
local function try_loadstring(s, component, name)
local success, result = pcall(loadstring(s))
if not success then
vim.schedule(function()
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
end)
end
return result
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"
},
["cmp-nvim-lsp"] = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp"
},
cmp_luasnip = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/cmp_luasnip"
},
delimitMate = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/delimitMate"
},
gruvbox = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/gruvbox"
},
["lsp_signature.nvim"] = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/lsp_signature.nvim"
},
nerdtree = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/nerdtree"
},
["nvim-cmp"] = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-cmp"
},
["nvim-lspconfig"] = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-lspconfig"
},
["packer.nvim"] = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/packer.nvim"
},
["plenary.nvim"] = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/plenary.nvim"
},
["telescope.nvim"] = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/telescope.nvim"
},
["typescript-vim"] = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/typescript-vim"
},
["vim-airline"] = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/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"
},
["vim-closetag"] = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-closetag"
},
["vim-commentary"] = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-commentary"
},
["vim-dispatch"] = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-dispatch"
},
["vim-jsx-typescript"] = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-jsx-typescript"
},
["vim-surround"] = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-surround"
},
["vim-tmux-navigator"] = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-tmux-navigator"
},
["vim-togglelist"] = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-togglelist"
},
["vim-toml"] = {
loaded = true,
path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-toml"
}
}
time([[Defining packer_plugins]], false)
if should_profile then save_profiles() end
end)
if not no_errors then
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
end

View File

@ -1,4 +1,4 @@
_docker_subcommands=( ${(Q)"${(z)$(<<\EO:_docker_subcommands
'builder:Manage builds' 'config:Manage Docker configs' 'container:Manage containers' 'context:Manage contexts' 'engine:Manage the docker engine' 'image:Manage images' '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'
'app*:Docker App (Docker Inc., v0.9.1-beta3)' 'builder:Manage builds' 'buildx*:Build with BuildKit (Docker Inc., v0.5.1-tp-docker)' '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
)}"} )