Migrate to lazy.nvim with more lua config
This commit is contained in:
parent
d7aa29354c
commit
be6559c1b6
|
@ -1,3 +1,3 @@
|
|||
iabbr mfg Mit freundlichen Grüßen
|
||||
|
||||
set fdl=99
|
||||
setlocal spell
|
||||
setlocal fdl=99
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
local cmp = require('cmp')
|
||||
local lspkind = require('lspkind')
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<C-b>'] = 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()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'vsnip' },
|
||||
{ name = "copilot"},
|
||||
},{
|
||||
{ name = 'buffer' },
|
||||
--{ name = 'path' },
|
||||
}),
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = 'symbol_text', -- show only symbol annotations
|
||||
maxwidth = 80, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
|
||||
ellipsis_char = '…', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
|
||||
symbol_map = { Copilot = "" },
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
--cmp.setup.cmdline({ '/', '?' }, {
|
||||
-- mapping = cmp.mapping.preset.cmdline(),
|
||||
-- sources = {
|
||||
-- { name = 'buffer' }
|
||||
-- }
|
||||
--})
|
||||
--
|
||||
---- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
--cmp.setup.cmdline(':', {
|
||||
-- mapping = cmp.mapping.preset.cmdline(),
|
||||
-- sources = cmp.config.sources({ }, {
|
||||
-- { name = 'cmdline' }
|
||||
-- })
|
||||
--})
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"languageserver": {
|
||||
"turtle": {
|
||||
"command": "turtle_lsp",
|
||||
"filetypes": ["ttl", "turtle"]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
au! BufRead,BufNewFile *.atg setfiletype coco
|
||||
au! BufRead,BufNewFile *.wili setfiletype wili
|
18
ftdetect/extensions.lua
Normal file
18
ftdetect/extensions.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
vim.filetype.add({
|
||||
extension = {
|
||||
},
|
||||
filename = {
|
||||
['.scalafmt.conf'] = 'hocon',
|
||||
['kitty.conf'] = 'kitty',
|
||||
['neomuttrc'] = 'neomutt',
|
||||
['template'] = 'sh',
|
||||
},
|
||||
pattern = {
|
||||
['${XDG_CONFIG_HOME}/kitty/*.conf'] = 'kitty',
|
||||
['${XDG_CONFIG_HOME}/kitty/*.session'] = 'kitty-session',
|
||||
},
|
||||
})
|
||||
|
||||
-- au BufRead,BufNewFile *.ttl set filetype=rdf-turtle
|
||||
-- au! BufNewFile,BufRead *.xwiki set ft=xwiki syntax=xwiki
|
||||
--
|
|
@ -1 +0,0 @@
|
|||
au! BufNewFile,BufRead .scalafmt.conf set ft=hocon syntax=hocon
|
|
@ -1,8 +0,0 @@
|
|||
au! BufNewFile,BufRead kitty.conf set ft=kitty syntax=kitty
|
||||
if exists("$XDG_CONFIG_HOME")
|
||||
au! BufNewFile,BufRead $XDG_CONFIG_HOME/kitty/*.conf set ft=kitty syntax=kitty
|
||||
au! BufRead,BufNewFile $XDG_CONFIG_HOME/kitty/*.session set ft=kitty-session syntax=kitty-session
|
||||
else
|
||||
au! BufNewFile,BufRead ~/.config/kitty/*.conf set ft=kitty syntax=kitty
|
||||
au! BufRead,BufNewFile ~/.config/kitty/*.session set ft=kitty-session syntax=kitty-session
|
||||
endif
|
24
ftdetect/sc.lua
Normal file
24
ftdetect/sc.lua
Normal file
|
@ -0,0 +1,24 @@
|
|||
-- Override detection from lua/vim/filetype/detect.lua
|
||||
-- removes match on |%w+| for SuperCollider
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
-- This function checks the first 25 lines of file extension "sc" to resolve
|
||||
-- detection between scala and SuperCollider
|
||||
sc = function(path, bufnr)
|
||||
for _, line in ipairs(vim.filetype.getlines(bufnr, 1, 25)) do
|
||||
if
|
||||
vim.filetype.findany(line, {
|
||||
'var%s<',
|
||||
'classvar%s<',
|
||||
'%^this.*',
|
||||
'%+%s%w*%s{',
|
||||
'%*ar%s',
|
||||
})
|
||||
then
|
||||
return 'supercollider'
|
||||
end
|
||||
end
|
||||
return 'scala'
|
||||
end
|
||||
}
|
||||
})
|
|
@ -1 +0,0 @@
|
|||
au! BufNewFile,BufRead *.sieve set ft=sieve syntax=sieve
|
|
@ -1 +0,0 @@
|
|||
au! BufRead,BufNewFile tolua_*.pkg set ft=tolua syntax=tolua
|
|
@ -1,2 +0,0 @@
|
|||
au! BufNewFile,BufRead *.xwiki set ft=xwiki syntax=xwiki
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
local mylsp = require("my-lsp")
|
||||
local path = require("mason-core.path")
|
||||
|
||||
local function mason_package(...)
|
||||
|
@ -14,7 +13,6 @@ require('jdtls').start_or_attach({
|
|||
on_attach = function(client, bufnr)
|
||||
require'jdtls.setup'.add_commands()
|
||||
require'jdtls'.setup_dap()
|
||||
mylsp.on_attach(client, bufnr)
|
||||
end,
|
||||
init_options = {
|
||||
bundles = extra_bundles
|
||||
|
|
110
init.lua
Normal file
110
init.lua
Normal file
|
@ -0,0 +1,110 @@
|
|||
if vim.env['VIRTUAL_ENV'] ~= nil then
|
||||
vim.g.python3_host_prog = vim.fn.system("which -a python3 | sed -n 2p | tr -d '\n'")
|
||||
else
|
||||
vim.g.python3_host_prog = vim.fn.system("which python3 | tr -d '\n'")
|
||||
end
|
||||
|
||||
-- lazy.nvim bootstrap
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
require("lazy").setup("plugins")
|
||||
|
||||
vim.opt.background = "dark"
|
||||
vim.g.chroma_italic_style = "bold"
|
||||
vim.g.chroma_nontext_dark = 1
|
||||
|
||||
vim.opt.number = true
|
||||
|
||||
vim.opt.colorcolumn = "+1"
|
||||
vim.opt.textwidth = 80
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
|
||||
vim.opt.whichwrap = "b,s,<,>,[,],h,l"
|
||||
|
||||
vim.opt.timeout = false
|
||||
|
||||
vim.opt.foldmethod = "expr"
|
||||
vim.opt.foldlevelstart = 99
|
||||
vim.opt.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
||||
vim.opt.foldenable = false
|
||||
|
||||
-- todo visualbell needed?
|
||||
|
||||
vim.opt.shell = "/bin/zsh"
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
vim.opt.inccommand = "split"
|
||||
|
||||
vim.opt.wildmode = { "list:longest", "list:full" }
|
||||
vim.opt.wildignore = { "*.so", "*.swp", "*.zip", "*.o" }
|
||||
vim.opt.suffixes = {
|
||||
".bak", "~", ".h", ".info", ".swp", ".obj", ".info", ".aux", ".dvi", ".bbl", ".out", ".o", ".lo",
|
||||
"\\.class", ".pdf" }
|
||||
|
||||
vim.opt.completeopt = "menu,menuone,noselect"
|
||||
vim.opt.mouse = ''
|
||||
vim.opt.shortmess = vim.o.shortmess .. "c"
|
||||
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.undofile = true
|
||||
|
||||
vim.opt.spelllang = 'de'
|
||||
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.pumblend = 10
|
||||
|
||||
vim.opt.updatetime = 300
|
||||
|
||||
local command = vim.api.nvim_create_user_command
|
||||
local initlua = vim.fn.stdpath('config') .. '/init.lua'
|
||||
command('RC', function() vim.cmd.edit(initlua) end, { desc = 'edit init.lua' })
|
||||
command('CD', ':cd %:h', { desc = 'cd to current file' })
|
||||
command('TrailingSpace', '%s/\\s*$//g', { desc = 'remove trailing spaces' })
|
||||
|
||||
vim.g.tex_flavor = 'latex'
|
||||
|
||||
local key = vim.keymap.set
|
||||
|
||||
key('n', '<space>', 'za', { desc = 'toggle fold' })
|
||||
key('v', '.', '<cmd>normal .<CR>', { desc = 'repeat last command in visual mode' })
|
||||
key('n', 'cy', '"*y', { desc = 'copy to system clipboard' })
|
||||
|
||||
key('t', '<C-q>', '<C-\\><C-n>', { desc = 'exit terminal mode' })
|
||||
|
||||
-- Arrow keys for window movement and resizing
|
||||
key('n', '<Left>', '<C-w>h')
|
||||
key('n', '<Down>', '<C-w>j')
|
||||
key('n', '<Up>', '<C-w>k')
|
||||
key('n', '<Right>', '<C-w>l')
|
||||
--
|
||||
key('n', '<S-Left>', "<C-w>',<")
|
||||
key('n', '<S-Right>', "<C-w>',>',")
|
||||
key('n', '<S-Down>', "<C-w>',-")
|
||||
key('n', '<S-Up>', "<C-w>',+")
|
||||
|
||||
key('n', '<M-[>', function() vim.fn.search('^[^[:space:])\\]}]', 'be') end, { desc = 'jump to previous unindented line' })
|
||||
key('n', '<M-]>', function() vim.fn.search('^[^[:space:])\\]}]', 'e') end, { desc = 'jump to next unindented line' })
|
||||
|
||||
key('i', '<C-U>', '<C-G>u<C-U>')
|
||||
key('n', '&', ':&&<CR>')
|
||||
key('x', '&', ':&&<CR>')
|
||||
key('n', 'Y', 'y$')
|
||||
|
||||
|
||||
key('i', '<C-Space>', '<C-x><C-o>', { desc = 'completion' })
|
||||
key('n', '<C-l>', '<cmd>noh<CR><cmd>redraw!<CR>', { desc = 'clear search highlight' })
|
||||
key('v', 'gs', "<cmd>'<,'>sort<CR>", { desc = 'sort selection' })
|
||||
|
||||
|
||||
key({ 'n', 'x' }, '<M-a>', "<Plug>(EasyAlign)", { desc = 'align selection' })
|
193
init.vim
193
init.vim
|
@ -1,193 +0,0 @@
|
|||
if exists("$VIRTUAL_ENV")
|
||||
let g:python3_host_prog=substitute(system("which -a python3 | head -n2 | tail -n1"), "\n", '', 'g')
|
||||
else
|
||||
let g:python3_host_prog=substitute(system("which python3"), "\n", '', 'g')
|
||||
endif
|
||||
|
||||
runtime packages.vim
|
||||
|
||||
let $MYVIMDIR=split(&rtp, ',')[0]
|
||||
|
||||
set exrc
|
||||
|
||||
set background=dark
|
||||
let g:chroma_italic_style="bold"
|
||||
let g:chroma_nontext_dark=1
|
||||
colo chroma
|
||||
|
||||
if exists("&cc")
|
||||
set cc=+1
|
||||
endif
|
||||
|
||||
set number
|
||||
|
||||
set textwidth=80
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
|
||||
set whichwrap+=<,>,h,l
|
||||
|
||||
set notimeout
|
||||
set ttimeout
|
||||
set ttimeoutlen=50
|
||||
|
||||
set foldmethod=syntax
|
||||
set foldlevelstart=99
|
||||
|
||||
" disables visualbell
|
||||
set vb t_vb=
|
||||
|
||||
set shellcmdflag=-c
|
||||
set shell=/bin/zsh
|
||||
|
||||
set modeline
|
||||
set showcmd
|
||||
|
||||
set ignorecase smartcase
|
||||
set inccommand=split
|
||||
set wildmode=list:longest,list:full
|
||||
set wildignore+=*.so,*.swp,*.zip,*.o
|
||||
set suffixes=.bak,~,.h,.info,.swp,.obj,.info,.aux,.dvi,.bbl,.out,.o,.lo,\.class
|
||||
set suffixes+=.pdf
|
||||
set wildmenu
|
||||
set hidden
|
||||
|
||||
"set completeopt=menu,noinsert,preview
|
||||
"set completeopt=menuone,noinsert,noselect
|
||||
set completeopt=menu,menuone,noselect
|
||||
set shortmess+=c
|
||||
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
|
||||
set mouse=
|
||||
|
||||
set cursorline
|
||||
set guicursor=
|
||||
|
||||
set undofile
|
||||
set undodir=~/.local/share/nvim/undo
|
||||
|
||||
set spelllang=de
|
||||
|
||||
set termguicolors
|
||||
set pumblend=20
|
||||
|
||||
set updatetime=300
|
||||
|
||||
" custom commands
|
||||
command! RC edit $MYVIMRC
|
||||
command! SRC source $MYVIMRC
|
||||
command! CD :cd %:h
|
||||
command! PlugEdit edit $MYVIMDIR/packages.vim
|
||||
command! PlugReload source $MYVIMDIR/packages.vim | PlugInstall
|
||||
command! TrailingSpace %s/\s*$//g
|
||||
|
||||
|
||||
"{{{ latex
|
||||
|
||||
" controls filetype setting, therefore not possible to move to ftplugin
|
||||
let g:tex_flavor = "latex"
|
||||
|
||||
"}}}
|
||||
|
||||
" {{{ misc Autocommands
|
||||
augroup Misc
|
||||
au FileType mail setlocal spell
|
||||
au FileType man setlocal nonu
|
||||
augroup END
|
||||
|
||||
|
||||
augroup Cache
|
||||
autocmd!
|
||||
autocmd BufRead,BufNewFile ~/Private/* setlocal directory=.
|
||||
augroup END
|
||||
|
||||
"{{{ binary editing
|
||||
augroup Binary
|
||||
au!
|
||||
au BufReadPre *.bin let &bin=1
|
||||
au BufReadPost *.bin if &bin | %!xxd
|
||||
au BufReadPost *.bin set ft=xxd | endif
|
||||
au BufWritePre *.bin if &bin | %!xxd -r
|
||||
au BufWritePre *.bin endif
|
||||
au BufWritePost *.bin if &bin | %!xxd
|
||||
au BufWritePost *.bin set nomod | endif
|
||||
augroup END
|
||||
"}}}
|
||||
|
||||
"}}}
|
||||
|
||||
" common mappings {{{
|
||||
|
||||
nnoremap <space> za
|
||||
vnoremap <silent> . <cmd>normal .<CR>
|
||||
noremap cy "*y
|
||||
|
||||
tnoremap <C-q> <C-\><C-n>
|
||||
|
||||
map <Left> <C-w>h
|
||||
map <Down> <C-w>j
|
||||
map <Up> <C-w>k
|
||||
map <Right> <C-w>l
|
||||
|
||||
map <S-Left> <C-w><
|
||||
map <S-Right> <C-w>>
|
||||
map <S-Down> <C-w>-
|
||||
map <S-Up> <C-w>+
|
||||
|
||||
" navigate windows with alt+[hjkl]
|
||||
tnoremap <A-h> <C-\><C-N><C-w>h
|
||||
tnoremap <A-j> <C-\><C-N><C-w>j
|
||||
tnoremap <A-k> <C-\><C-N><C-w>k
|
||||
tnoremap <A-l> <C-\><C-N><C-w>l
|
||||
inoremap <A-h> <C-\><C-N><C-w>h
|
||||
inoremap <A-j> <C-\><C-N><C-w>j
|
||||
inoremap <A-k> <C-\><C-N><C-w>k
|
||||
inoremap <A-l> <C-\><C-N><C-w>l
|
||||
nnoremap <A-h> <C-w>h
|
||||
nnoremap <A-j> <C-w>j
|
||||
nnoremap <A-k> <C-w>k
|
||||
nnoremap <A-l> <C-w>l
|
||||
|
||||
nnoremap <M-[> :call search('^[^[:space:])\]}]', 'be')<cr>
|
||||
nnoremap <M-]> :call search('^[^[:space:])\]}]', 'e')<cr>
|
||||
|
||||
inoremap <C-U> <C-G>u<C-U>
|
||||
nnoremap & :&&<CR>
|
||||
xnoremap & :&&<CR>
|
||||
nnoremap Y y$
|
||||
|
||||
inoremap <C-Space> <C-x><C-o>
|
||||
|
||||
nmap <C-L> <cmd>noh<cr><cmd>redraw!<cr>
|
||||
|
||||
nmap <C-Tab> <C-w><C-w>
|
||||
imap <C-Tab> <esc><C-w><C-w>
|
||||
|
||||
vmap <silent> gs <cmd>'<,'>sort<cr>
|
||||
|
||||
"}}}
|
||||
|
||||
|
||||
"Git {{{
|
||||
nmap <Leader>gu <cmd>Gina push<CR>
|
||||
nmap <Leader>gvc <cmd>!git svn dcommit<CR>
|
||||
nmap <Leader>gvf <cmd>!git svn fetch<CR>
|
||||
" Git }}}
|
||||
|
||||
" Start interactive EasyAlign in visual mode (e.g. vipga)
|
||||
xmap <M-a> <Plug>(EasyAlign)
|
||||
|
||||
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
|
||||
nmap <M-a> <Plug>(EasyAlign)
|
||||
|
||||
let g:signify_vcs_list = [ 'git', 'hg' ]
|
||||
"let g:signify_disable_by_default = 1
|
||||
|
||||
|
||||
let g:localvimrc_whitelist='/home/crater2150/work/.*'
|
||||
let g:localvimrc_sandbox=0
|
||||
|
||||
set foldmethod=expr
|
||||
set foldexpr=nvim_treesitter#foldexpr()
|
||||
set nofoldenable " Disable folding at startup.
|
||||
" vi:foldmethod=marker sw=2
|
61
lua/common.lua
Normal file
61
lua/common.lua
Normal file
|
@ -0,0 +1,61 @@
|
|||
-- Adapted from https://github.com/LazyVim/LazyVim/
|
||||
-- SPDX-License-Identifier: Apache-2.0
|
||||
return {
|
||||
icons = {
|
||||
dap = {
|
||||
Stopped = { " ", "DiagnosticWarn", "DapStoppedLine" },
|
||||
Breakpoint = " ",
|
||||
BreakpointCondition = " ",
|
||||
BreakpointRejected = { " ", "DiagnosticError" },
|
||||
LogPoint = ".>",
|
||||
},
|
||||
diagnostics = {
|
||||
Error = " ",
|
||||
Warn = " ",
|
||||
Hint = " ",
|
||||
Info = " ",
|
||||
},
|
||||
git = {
|
||||
added = " ",
|
||||
modified = " ",
|
||||
removed = " ",
|
||||
},
|
||||
kinds = {
|
||||
Array = " ",
|
||||
Boolean = " ",
|
||||
Class = " ",
|
||||
Color = " ",
|
||||
Constant = " ",
|
||||
Constructor = " ",
|
||||
Copilot = " ",
|
||||
Enum = " ",
|
||||
EnumMember = " ",
|
||||
Event = " ",
|
||||
Field = " ",
|
||||
File = " ",
|
||||
Folder = " ",
|
||||
Function = " ",
|
||||
Interface = " ",
|
||||
Key = " ",
|
||||
Keyword = " ",
|
||||
Method = " ",
|
||||
Module = " ",
|
||||
Namespace = " ",
|
||||
Null = " ",
|
||||
Number = " ",
|
||||
Object = " ",
|
||||
Operator = " ",
|
||||
Package = " ",
|
||||
Property = " ",
|
||||
Reference = " ",
|
||||
Snippet = " ",
|
||||
String = " ",
|
||||
Struct = " ",
|
||||
Text = " ",
|
||||
TypeParameter = " ",
|
||||
Unit = " ",
|
||||
Value = " ",
|
||||
Variable = " ",
|
||||
},
|
||||
},
|
||||
}
|
5
lua/plugins/chroma.lua
Normal file
5
lua/plugins/chroma.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
'crater2150/vim-theme-chroma',
|
||||
lazy = false, priority = 1000,
|
||||
config = function() vim.cmd.colorscheme("chroma") end
|
||||
}
|
65
lua/plugins/cmp.lua
Normal file
65
lua/plugins/cmp.lua
Normal file
|
@ -0,0 +1,65 @@
|
|||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
-- load cmp on InsertEnter
|
||||
event = "InsertEnter",
|
||||
-- these dependencies will only be loaded when cmp loads
|
||||
-- dependencies are always lazy-loaded unless specified otherwise
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-cmdline',
|
||||
'hrsh7th/cmp-vsnip',
|
||||
'hrsh7th/vim-vsnip',
|
||||
'hrsh7th/vim-vsnip-integ',
|
||||
'onsails/lspkind.nvim',
|
||||
},
|
||||
config = function()
|
||||
local cmp = require('cmp')
|
||||
local lspkind = require('lspkind')
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<C-b>'] = 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()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'vsnip' },
|
||||
{ name = "copilot"},
|
||||
},{
|
||||
{ name = 'buffer' },
|
||||
--{ name = 'path' },
|
||||
}),
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = 'symbol_text', -- show only symbol annotations
|
||||
maxwidth = 80, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
|
||||
ellipsis_char = '…', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
|
||||
symbol_map = { Copilot = "" },
|
||||
})
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
12
lua/plugins/deepl.lua
Normal file
12
lua/plugins/deepl.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
return { 'ryicoh/deepl.vim',
|
||||
keys = {
|
||||
|
||||
{ '<leader><C-e>', function() vim.fn['deepl#v']("EN") end, mode = 'v' },
|
||||
{ '<leader><C-d>', function() vim.fn['deepl#v']("DE") end, mode = 'v' },
|
||||
},
|
||||
dependencies = { 'tsuyoshicho/vim-pass' },
|
||||
config = function ()
|
||||
vim.g['deepl#endpoint'] = "https://api-free.deepl.com/v2/translate"
|
||||
vim.g['deepl#auth_key'] = vim.fn['pass#get']('web/deepl.com', 'apikey')
|
||||
end
|
||||
}
|
64
lua/plugins/init.lua
Normal file
64
lua/plugins/init.lua
Normal file
|
@ -0,0 +1,64 @@
|
|||
return {
|
||||
"folke/which-key.nvim",
|
||||
'pbrisbin/vim-mkdir',
|
||||
'fladson/vim-kitty',
|
||||
|
||||
'tpope/vim-repeat',
|
||||
'tpope/vim-surround',
|
||||
'tpope/vim-characterize',
|
||||
'tpope/vim-eunuch',
|
||||
'tpope/vim-commentary',
|
||||
'tpope/vim-sleuth',
|
||||
|
||||
-- ic / ac
|
||||
{'glts/vim-textobj-comment',
|
||||
dependencies = { 'kana/vim-textobj-user' }
|
||||
},
|
||||
-- ii / ai
|
||||
'michaeljsmith/vim-indent-object',
|
||||
'airblade/vim-gitgutter',
|
||||
|
||||
'neovim/nvim-lspconfig',
|
||||
|
||||
{ 'nvim-telescope/telescope.nvim',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' }
|
||||
},
|
||||
|
||||
{ 'ray-x/lsp_signature.nvim',
|
||||
config = function()
|
||||
require('lsp_signature').setup({})
|
||||
end
|
||||
},
|
||||
'nvim-lua/lsp-status.nvim',
|
||||
'kyazdani42/nvim-web-devicons',
|
||||
'folke/trouble.nvim',
|
||||
'folke/lsp-colors.nvim',
|
||||
'nvim-lua/popup.nvim',
|
||||
|
||||
'zbirenbaum/copilot.lua',
|
||||
{'zbirenbaum/copilot-cmp',
|
||||
dependencies = { "hrsh7th/nvim-cmp" },
|
||||
},
|
||||
'junegunn/vim-easy-align',
|
||||
'machakann/vim-highlightedyank',
|
||||
'vim-airline/vim-airline',
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
'lambdalisue/suda.vim',
|
||||
-- git
|
||||
'lambdalisue/gina.vim',
|
||||
'gregsexton/gitv',
|
||||
'gisphm/vim-gitignore',
|
||||
'sjl/splice.vim',
|
||||
'jamessan/vim-gnupg',
|
||||
|
||||
'lervag/vimtex',
|
||||
'ledger/vim-ledger',
|
||||
'anekos/hledger-vim',
|
||||
|
||||
'vim-pandoc/vim-pandoc',
|
||||
'vim-pandoc/vim-pandoc-syntax',
|
||||
'isobit/vim-caddyfile',
|
||||
'GEverding/vim-hocon',
|
||||
'nfnty/vim-nftables',
|
||||
}
|
||||
-- 'powerman/vim-plugin-AnsiEsc',
|
200
lua/plugins/lspconfig.lua
Normal file
200
lua/plugins/lspconfig.lua
Normal file
|
@ -0,0 +1,200 @@
|
|||
return {
|
||||
-- lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
{ "folke/neoconf.nvim", cmd = "Neoconf", config = true },
|
||||
{ "folke/neodev.nvim", opts = {} },
|
||||
"mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
{
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
cond = function()
|
||||
return require("lazy.core.config").plugins["nvim-cmp"] ~= nil
|
||||
end,
|
||||
},
|
||||
},
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
-- options for vim.diagnostic.config()
|
||||
diagnostics = {
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
virtual_text = {
|
||||
spacing = 4,
|
||||
source = "if_many",
|
||||
prefix = "●",
|
||||
-- this will set set the prefix to a function that returns the diagnostics icon based on the severity
|
||||
-- this only works on a recent 0.10.0 build. Will be set to "●" when not supported
|
||||
-- prefix = "icons",
|
||||
},
|
||||
severity_sort = true,
|
||||
},
|
||||
-- add any global capabilities here
|
||||
capabilities = {},
|
||||
servers = {
|
||||
jsonls = {},
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
},
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
pylsp = {
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
rope_autoimport = { enabled = true, },
|
||||
isort = { enabled = true, },
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
-- you can do any additional lsp server setup here
|
||||
-- return true if you don't want this server to be setup with lspconfig
|
||||
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
||||
setup = {
|
||||
-- example to setup with typescript.nvim
|
||||
-- tsserver = function(_, opts)
|
||||
-- require("typescript").setup({ server = opts })
|
||||
-- return true
|
||||
-- end,
|
||||
-- Specify * to use this function as a fallback for any server
|
||||
-- ["*"] = function(server, opts) end,
|
||||
},
|
||||
},
|
||||
---@param opts PluginLspOpts
|
||||
config = function(_, opts)
|
||||
-- diagnostics
|
||||
for name, icon in pairs(require("common").icons.diagnostics) do
|
||||
name = "DiagnosticSign" .. name
|
||||
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
|
||||
end
|
||||
|
||||
if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then
|
||||
opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and "●"
|
||||
or function(diagnostic)
|
||||
local icons = require("common").icons.diagnostics
|
||||
for d, icon in pairs(icons) do
|
||||
if diagnostic.severity == vim.diagnostic.severity[d:upper()] then
|
||||
return icon
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vim.diagnostic.config(vim.deepcopy(opts.diagnostics))
|
||||
|
||||
local servers = opts.servers
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
"force",
|
||||
{},
|
||||
vim.lsp.protocol.make_client_capabilities(),
|
||||
require("cmp_nvim_lsp").default_capabilities(),
|
||||
opts.capabilities or {}
|
||||
)
|
||||
|
||||
local function setup(server)
|
||||
local server_opts = vim.tbl_deep_extend("force", {
|
||||
capabilities = vim.deepcopy(capabilities),
|
||||
}, servers[server] or {})
|
||||
|
||||
if opts.setup[server] then
|
||||
if opts.setup[server](server, server_opts) then
|
||||
return
|
||||
end
|
||||
elseif opts.setup["*"] then
|
||||
if opts.setup["*"](server, server_opts) then
|
||||
return
|
||||
end
|
||||
end
|
||||
require("lspconfig")[server].setup(server_opts)
|
||||
end
|
||||
|
||||
-- get all the servers that are available thourgh mason-lspconfig
|
||||
local have_mason, mlsp = pcall(require, "mason-lspconfig")
|
||||
local all_mslp_servers = {}
|
||||
if have_mason then
|
||||
all_mslp_servers = vim.tbl_keys(require("mason-lspconfig.mappings.server").lspconfig_to_package)
|
||||
end
|
||||
|
||||
local ensure_installed = {} ---@type string[]
|
||||
for server, server_opts in pairs(servers) do
|
||||
if server_opts then
|
||||
server_opts = server_opts == true and {} or server_opts
|
||||
-- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig
|
||||
if server_opts.mason == false or not vim.tbl_contains(all_mslp_servers, server) then
|
||||
setup(server)
|
||||
else
|
||||
ensure_installed[#ensure_installed + 1] = server
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if have_mason then
|
||||
mlsp.setup({ ensure_installed = ensure_installed, handlers = { setup } })
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
-- formatters
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = { "mason.nvim" },
|
||||
opts = function()
|
||||
local nls = require("null-ls")
|
||||
return {
|
||||
root_dir = require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git"),
|
||||
sources = {
|
||||
nls.builtins.formatting.stylua,
|
||||
nls.builtins.formatting.shfmt,
|
||||
nls.builtins.completion.vsnip,
|
||||
nls.builtins.diagnostics.zsh,
|
||||
nls.builtins.formatting.beautysh,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- cmdline tools and lsp servers
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
cmd = "Mason",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"jdtls",
|
||||
"lua-language-server",
|
||||
},
|
||||
},
|
||||
---@param opts MasonSettings | {ensure_installed: string[]}
|
||||
config = function(_, opts)
|
||||
require("mason").setup(opts)
|
||||
local mr = require("mason-registry")
|
||||
local function ensure_installed()
|
||||
for _, tool in ipairs(opts.ensure_installed) do
|
||||
local p = mr.get_package(tool)
|
||||
if not p:is_installed() then
|
||||
p:install()
|
||||
end
|
||||
end
|
||||
end
|
||||
if mr.refresh then
|
||||
mr.refresh(ensure_installed)
|
||||
else
|
||||
ensure_installed()
|
||||
end
|
||||
end,
|
||||
},
|
||||
'mfussenegger/nvim-jdtls',
|
||||
}
|
||||
|
4
lua/plugins/markdown.lua
Normal file
4
lua/plugins/markdown.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
'euclio/vim-markdown-composer',
|
||||
build = 'cargo build --release'
|
||||
}
|
58
lua/plugins/metals.lua
Normal file
58
lua/plugins/metals.lua
Normal file
|
@ -0,0 +1,58 @@
|
|||
return {
|
||||
'scalameta/nvim-metals',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'mfussenegger/nvim-dap',
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
config = function()
|
||||
local metals_config = require('metals').bare_config()
|
||||
metals_config.init_options.statusBarProvider = "on"
|
||||
metals_config.settings = {
|
||||
showImplicitArguments = true,
|
||||
superMethodLensesEnabled = true,
|
||||
}
|
||||
metals_config.on_attach = function(client, bufnr)
|
||||
require("metals").setup_dap()
|
||||
require("my_lsp").on_attach(client, bufnr)
|
||||
end
|
||||
metals_config.capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
-- Debug settings if you're using nvim-dap
|
||||
local dap = require("dap")
|
||||
dap.configurations.scala = {
|
||||
{
|
||||
type = "scala",
|
||||
request = "launch",
|
||||
name = "RunOrTest",
|
||||
metals = {
|
||||
runType = "runOrTestFile",
|
||||
--args = { "firstArg", "secondArg", "thirdArg" }, -- here just as an example
|
||||
},
|
||||
},
|
||||
{
|
||||
type = "scala",
|
||||
request = "launch",
|
||||
name = "Test Target",
|
||||
metals = {
|
||||
runType = "testTarget",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
-- Autocmd that will actually be in charging of starting the whole thing
|
||||
local nvim_metals_group = vim.api.nvim_create_augroup("nvim-metals", { clear = true })
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
-- NOTE: You may or may not want java included here. You will need it if you
|
||||
-- want basic Java support but it may also conflict if you are using
|
||||
-- something like nvim-jdtls which also works on a java filetype autocmd.
|
||||
pattern = { "scala", "sbt" },
|
||||
callback = function()
|
||||
require("metals").initialize_or_attach(metals_config)
|
||||
end,
|
||||
group = nvim_metals_group,
|
||||
})
|
||||
|
||||
return metals_config
|
||||
end
|
||||
}
|
54
lua/plugins/telescope.lua
Normal file
54
lua/plugins/telescope.lua
Normal file
|
@ -0,0 +1,54 @@
|
|||
--Plug 'nvim-telescope/telescope.nvim'
|
||||
|
||||
--Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
|
||||
--Plug 'gbrlsnchs/telescope-lsp-handlers.nvim'
|
||||
--Plug 'nvim-telescope/telescope-ui-select.nvim'
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
{'nvim-telescope/telescope-fzf-native.nvim',
|
||||
build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build',
|
||||
},
|
||||
'gbrlsnchs/telescope-lsp-handlers.nvim',
|
||||
'nvim-telescope/telescope-ui-select.nvim',
|
||||
--Plug { 'do': 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
|
||||
},
|
||||
cmd = "Telescope",
|
||||
version = false,
|
||||
keys = {
|
||||
{',ff', require("telescope.builtin").fd, desc = "Find files"},
|
||||
{',fg', require("telescope.builtin").git_files, desc = "Find files (git)"},
|
||||
{',gs', require("telescope.builtin").git_status, desc = "Git status"},
|
||||
{',s', require("telescope.builtin").lsp_dynamic_workspace_symbols, desc = "Symbols"},
|
||||
{'g/', require("telescope.builtin").live_grep, desc = "Live grep"},
|
||||
{'<C-/>', require("telescope.builtin").current_buffer_fuzzy_find, desc = "Fuzzy find"},
|
||||
{'<leader>*', require("telescope.builtin").grep_string, desc = "Find at cursor"},
|
||||
{'gb', require("telescope.builtin").buffers},
|
||||
{ "<leader>:", require("telescope.builtin").command_history, desc = "Command History" },
|
||||
{ "<leader>;", require("telescope.builtin").commands, desc = "Commands" },
|
||||
},
|
||||
opts = {
|
||||
defaults = {
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
},
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true, -- false will only do exact matching
|
||||
override_generic_sorter = true, -- override the generic sorter
|
||||
override_file_sorter = true, -- override the file sorter
|
||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||
-- the default case_mode is "smart_case"
|
||||
},
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown { }
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local telescope = require('telescope')
|
||||
telescope.setup(opts)
|
||||
telescope.load_extension('fzf')
|
||||
telescope.load_extension('ui-select')
|
||||
end,
|
||||
}
|
12
lua/plugins/text-to-color.lua
Normal file
12
lua/plugins/text-to-color.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
return {
|
||||
'svermeulen/text-to-colorscheme',
|
||||
dependencies = { 'tsuyoshicho/vim-pass' },
|
||||
config = function ()
|
||||
require('text-to-colorscheme').setup {
|
||||
ai = {
|
||||
gpt_model = "gpt-3.5-turbo",
|
||||
openai_api_key = vim.fn['pass#get']('apikeys/openai_vim'),
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
88
lua/plugins/treesitter.lua
Normal file
88
lua/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,88 @@
|
|||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
version = false, -- last release is way too old and doesn't work on Windows
|
||||
build = ":TSUpdate",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
dependencies = {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
init = function()
|
||||
-- PERF: no need to load the plugin, if we only need its queries for mini.ai
|
||||
local plugin = require("lazy.core.config").spec.plugins["nvim-treesitter"]
|
||||
local opts = require("lazy.core.plugin").values(plugin, "opts", false)
|
||||
local enabled = false
|
||||
if opts.textobjects then
|
||||
for _, mod in ipairs({ "move", "select", "swap", "lsp_interop" }) do
|
||||
if opts.textobjects[mod] and opts.textobjects[mod].enable then
|
||||
enabled = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if not enabled then
|
||||
require("lazy.core.loader").disable_rtp_plugin("nvim-treesitter-textobjects")
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "<c-space>", desc = "Increment selection" },
|
||||
{ "<bs>", desc = "Decrement selection", mode = "x" },
|
||||
},
|
||||
---@type TSConfig
|
||||
opts = {
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"gitignore",
|
||||
"html",
|
||||
"java",
|
||||
"json",
|
||||
"lua",
|
||||
"luadoc",
|
||||
"luap",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"scala",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"yaml",
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<C-space>",
|
||||
node_incremental = "<C-space>",
|
||||
scope_incremental = false,
|
||||
node_decremental = "<bs>",
|
||||
},
|
||||
},
|
||||
},
|
||||
---@param opts TSConfig
|
||||
config = function(_, opts)
|
||||
if type(opts.ensure_installed) == "table" then
|
||||
---@type table<string, boolean>
|
||||
local added = {}
|
||||
opts.ensure_installed = vim.tbl_filter(function(lang)
|
||||
if added[lang] then
|
||||
return false
|
||||
end
|
||||
added[lang] = true
|
||||
return true
|
||||
end, opts.ensure_installed)
|
||||
end
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
end,
|
||||
},
|
||||
{ 'nvim-treesitter/playground',
|
||||
cmd = 'TSPlaygroundToggle'
|
||||
},
|
||||
|
||||
}
|
125
packages.vim
125
packages.vim
|
@ -1,125 +0,0 @@
|
|||
call plug#begin(expand('<sfile>:p:h') . '/plugged')
|
||||
|
||||
" basic stuff
|
||||
Plug 'pbrisbin/vim-mkdir'
|
||||
Plug 'embear/vim-localvimrc'
|
||||
|
||||
Plug 'crater2150/vim-theme-chroma'
|
||||
"Plug '~/sources/chroma-colors/vim'
|
||||
Plug 'fladson/vim-kitty'
|
||||
|
||||
" generic
|
||||
Plug 'ryicoh/deepl.vim'
|
||||
Plug 'tsuyoshicho/vim-pass'
|
||||
|
||||
" tim pope stuff
|
||||
Plug 'tpope/vim-repeat' " . for commands from plugins
|
||||
Plug 'tpope/vim-surround' " add/remove braces,quotes,...
|
||||
Plug 'tpope/vim-characterize' " More info in ga output
|
||||
Plug 'tpope/vim-eunuch' " :Delete, :Move, etc.
|
||||
Plug 'tpope/vim-commentary' " gc operator
|
||||
Plug 'tpope/vim-sleuth' " detect shiftwidth/expandtab
|
||||
"
|
||||
" motions and textobjects
|
||||
Plug 'kana/vim-textobj-user' | Plug 'glts/vim-textobj-comment' " ic / ac
|
||||
Plug 'michaeljsmith/vim-indent-object'
|
||||
Plug 'vim-scripts/argtextobj.vim'
|
||||
|
||||
Plug 'airblade/vim-gitgutter'
|
||||
|
||||
" LSP
|
||||
Plug 'neovim/nvim-lspconfig'
|
||||
Plug 'hrsh7th/cmp-buffer'
|
||||
Plug 'hrsh7th/cmp-nvim-lsp'
|
||||
Plug 'hrsh7th/cmp-path'
|
||||
Plug 'hrsh7th/cmp-cmdline'
|
||||
Plug 'hrsh7th/cmp-vsnip'
|
||||
Plug 'hrsh7th/nvim-cmp'
|
||||
Plug 'hrsh7th/vim-vsnip'
|
||||
Plug 'hrsh7th/vim-vsnip-integ'
|
||||
Plug 'nvim-lua/plenary.nvim'
|
||||
Plug 'scalameta/nvim-metals'
|
||||
Plug 'williamboman/mason.nvim'
|
||||
Plug 'williamboman/mason-lspconfig.nvim'
|
||||
Plug 'onsails/lspkind.nvim'
|
||||
|
||||
|
||||
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
||||
Plug 'nvim-lua/lsp-status.nvim'
|
||||
Plug 'kyazdani42/nvim-web-devicons'
|
||||
Plug 'folke/trouble.nvim'
|
||||
Plug 'folke/lsp-colors.nvim'
|
||||
Plug 'nvim-lua/popup.nvim'
|
||||
Plug 'nvim-lua/plenary.nvim'
|
||||
Plug 'nvim-telescope/telescope.nvim'
|
||||
Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
|
||||
Plug 'gbrlsnchs/telescope-lsp-handlers.nvim'
|
||||
Plug 'nvim-telescope/telescope-ui-select.nvim'
|
||||
Plug 'ray-x/lsp_signature.nvim'
|
||||
Plug 'mfussenegger/nvim-jdtls'
|
||||
|
||||
Plug 'mfussenegger/nvim-dap'
|
||||
|
||||
Plug 'zbirenbaum/copilot.lua'
|
||||
Plug 'zbirenbaum/copilot-cmp'
|
||||
|
||||
Plug 'machakann/vim-highlightedyank'
|
||||
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
|
||||
" for stuff installed via disto package manager, e.g. fzf's bundled vim plugin
|
||||
Plug '/usr/share/vim/vimfiles'
|
||||
|
||||
Plug 'vim-airline/vim-airline'
|
||||
Plug 'lambdalisue/suda.vim'
|
||||
|
||||
Plug 'vim-scripts/SyntaxRange'
|
||||
|
||||
Plug 'lukas-reineke/indent-blankline.nvim'
|
||||
|
||||
" ruby
|
||||
Plug 'depuracao/vim-rdoc'
|
||||
Plug 'vim-ruby/vim-ruby'
|
||||
Plug 'tpope/vim-rails'
|
||||
Plug 'tpope/vim-rake'
|
||||
|
||||
" git
|
||||
Plug 'lambdalisue/gina.vim'
|
||||
Plug 'gregsexton/gitv'
|
||||
Plug 'gisphm/vim-gitignore'
|
||||
Plug 'sjl/splice.vim'
|
||||
|
||||
|
||||
" other filetype specific plugins
|
||||
Plug 'jamessan/vim-gnupg'
|
||||
let g:no_cecutil_maps = 1
|
||||
Plug 'powerman/vim-plugin-AnsiEsc'
|
||||
Plug 'tpope/vim-markdown'
|
||||
Plug 'lervag/vimtex'
|
||||
" let g:vimtex_compiler_method = 'arara'
|
||||
Plug 'ledger/vim-ledger'
|
||||
Plug 'anekos/hledger-vim'
|
||||
Plug 'elzr/vim-json'
|
||||
Plug 'kchmck/vim-coffee-script'
|
||||
Plug 'gre/play2vim'
|
||||
Plug 'isobit/vim-caddyfile'
|
||||
Plug 'vim-pandoc/vim-pandoc'
|
||||
Plug 'vim-pandoc/vim-pandoc-syntax'
|
||||
Plug 'GEverding/vim-hocon'
|
||||
Plug 'nfnty/vim-nftables'
|
||||
|
||||
function! BuildComposer(info)
|
||||
if a:info.status != 'unchanged' || a:info.force
|
||||
if has('nvim')
|
||||
!cargo build --release
|
||||
else
|
||||
!cargo build --release --no-default-features --features json-rpc
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
Plug 'euclio/vim-markdown-composer', { 'do': function('BuildComposer') }
|
||||
|
||||
call plug#end()
|
||||
|
||||
" vim:ft=vim foldmethod=marker
|
46
plugin/on-attach.lua
Normal file
46
plugin/on-attach.lua
Normal file
|
@ -0,0 +1,46 @@
|
|||
local on_attach = function(args)
|
||||
local bufnr = args.buf
|
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
|
||||
--Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[bufnr].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
|
||||
-- Mappings.
|
||||
local opts = { silent = true, buffer = bufnr }
|
||||
local loud = { buffer = bufnr }
|
||||
|
||||
local map = vim.keymap.set
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
map("n", "<leader>dr", function() require("dap").repl.toggle() end, { silent = true })
|
||||
map('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
map('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
map('n', 'K', vim.lsp.buf.hover, opts)
|
||||
map('v', 'K', vim.lsp.buf.hover, opts)
|
||||
map('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||
map('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||
map('n', '<Leader>D', vim.lsp.buf.type_definition, opts)
|
||||
map('n', '<Leader>rn', vim.lsp.buf.rename, opts)
|
||||
map('n', '<M-x>', vim.lsp.buf.code_action, loud)
|
||||
map('n', '<M-s>', vim.lsp.codelens.run, loud)
|
||||
map('n', 'gr', vim.lsp.buf.references, opts)
|
||||
map('n', '<M-e>', vim.diagnostic.open_float, opts)
|
||||
map('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
map('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
map('n', '<M-q>', vim.diagnostic.setloclist, opts)
|
||||
map("n", "<Leader>f", function() vim.lsp.buf.format { async = true } end, opts)
|
||||
map("n", "<leader>dc", function() require("dap").continue() end, opts)
|
||||
map("n", "<leader>dK", function() require("dap.ui.widgets").hover() end, opts)
|
||||
map("n", "<leader>dt", function() require("dap").toggle_breakpoint() end, opts)
|
||||
map("n", "<leader>dso", function() require("dap").step_over() end, opts)
|
||||
map("n", "<leader>dsi", function() require("dap").step_into() end, opts)
|
||||
map("n", "<leader>dl", function() require("dap").run_last() end, opts)
|
||||
|
||||
map("n", "<leader>aa", vim.diagnostic.setqflist, opts)
|
||||
map("n", "<leader>aw", function() vim.diagnostic.setqflist({ severity = "W" }) end, opts)
|
||||
map("n", "<leader>ae", function() vim.diagnostic.setqflist({ severity = "E" }) end, opts)
|
||||
|
||||
vim.cmd [[autocmd CursorHoldI * silent! lua vim.lsp.buf.signature_help()]]
|
||||
vim.cmd [[autocmd CursorHold * lua vim.diagnostic.open_float({max_width = 100, focusable = false})]]
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", { callback = on_attach })
|
|
@ -1,41 +0,0 @@
|
|||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn include @EmbeddedLua syntax/lua.vim
|
||||
syn include @EmbeddedPreproc syntax/c.vim
|
||||
|
||||
syn match toluaString "\".*\""
|
||||
syn match toluaInclude "<.*>"
|
||||
syn region toluaEmbeddedLua matchgroup=toluaEmbeddedDelimiter
|
||||
\ start="^\$\[" end="^\$\]" contains=@EmbeddedLua
|
||||
syn match toluaCInclude "^\$#.*$" contains=toluaString,toluaInclude
|
||||
|
||||
syn keyword toluaStatement module nextgroup=toluaModuleName skipwhite
|
||||
syn match toluaModuleName "[_a-zA-Z]\+" contained
|
||||
|
||||
syn match toluaRename "@ [_a-zA-Z]\+"
|
||||
|
||||
" from c syntax file
|
||||
syn keyword cType int long short char void
|
||||
syn keyword cType signed unsigned float double
|
||||
syn keyword luaState lua_State
|
||||
|
||||
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell extend
|
||||
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell extend
|
||||
syn keyword cStructure struct union enum typedef
|
||||
syn keyword cStorageClass static register auto volatile extern const
|
||||
|
||||
let b:current_syntax = "tolua"
|
||||
|
||||
hi def link toluaEmbeddedDelimiter Special
|
||||
hi def link toluaCInclude PreProc
|
||||
hi def link toluaString String
|
||||
hi def link toluaInclude String
|
||||
hi def link toluaStatement Statement
|
||||
hi def link toluaModuleName Identifier
|
||||
hi def link toluaRename Special
|
||||
hi def link cType Type
|
||||
hi def link luaState Type
|
||||
hi def link cStorageClass StorageClass
|
||||
hi def link cStructure Structure
|
Loading…
Reference in a new issue