nvim: separate plugins and config
It may look nicer but it leads to problems. Also tweaked some thinks and cleaned up, made firenvim config only run if it is used.
This commit is contained in:
parent
0bfde6fd66
commit
7a49812118
@ -3,7 +3,7 @@ if vim.fn.has('nvim-0.7.0') == 0 then
|
||||
end
|
||||
|
||||
require('my/plugins')
|
||||
require('my/functions')
|
||||
require('my.functions')
|
||||
require('my/settings')
|
||||
require('my/keymaps')
|
||||
require('my/filetypes')
|
||||
|
@ -4,32 +4,34 @@ require('my/tools')
|
||||
|
||||
packer.use { -- toggle comments
|
||||
'https://github.com/tomtom/tcomment_vim',
|
||||
tag = '*',
|
||||
config = function()
|
||||
vim.g.tcomment_opleader1 = '<Leader>c'
|
||||
vim.g.tcomment_mapleader1 = ''
|
||||
vim.g.tcomment_mapleader2 = ''
|
||||
end
|
||||
-- tag = '*' -- reactivate when tagged after 2022-08-15
|
||||
}
|
||||
|
||||
vim.g.tcomment_opleader1 = '<Leader>c'
|
||||
vim.g.tcomment_mapleader1 = ''
|
||||
vim.g.tcomment_mapleader2 = ''
|
||||
|
||||
|
||||
packer.use {
|
||||
'https://github.com/TimUntersberger/neogit',
|
||||
requires = {
|
||||
'https://github.com/nvim-lua/plenary.nvim',
|
||||
'https://github.com/folke/which-key.nvim'
|
||||
'https://github.com/folke/which-key.nvim',
|
||||
'https://github.com/sindrets/diffview.nvim'
|
||||
},
|
||||
config = function()
|
||||
require('which-key').setup {
|
||||
-- commit_popup = {
|
||||
-- kind = 'split'
|
||||
-- }
|
||||
}
|
||||
end,
|
||||
map('n', '<Leader>g', function()
|
||||
require('neogit').open({ kind = "vsplit" })
|
||||
end)
|
||||
}
|
||||
|
||||
local neogit = require('neogit')
|
||||
neogit.setup {
|
||||
disable_commit_confirmation = true,
|
||||
kind = 'tab',
|
||||
integrations = {
|
||||
diffview = true
|
||||
}
|
||||
}
|
||||
|
||||
map('n', '<Leader>g', neogit.open)
|
||||
|
||||
-- start git commits in insert mode
|
||||
vim.api.nvim_create_augroup('config_coding', { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
@ -40,9 +42,7 @@ vim.api.nvim_create_autocmd(
|
||||
command = [[startinsert | 1]]
|
||||
})
|
||||
|
||||
packer.use {
|
||||
'https://github.com/gentoo/gentoo-syntax'
|
||||
}
|
||||
packer.use 'https://github.com/gentoo/gentoo-syntax'
|
||||
|
||||
packer.use { -- NOTE: looks abandoned
|
||||
'https://github.com/jiangmiao/auto-pairs',
|
||||
@ -51,10 +51,8 @@ packer.use { -- NOTE: looks abandoned
|
||||
end
|
||||
}
|
||||
|
||||
packer.use {
|
||||
'https://github.com/L3MON4D3/LuaSnip',
|
||||
config = function()
|
||||
require("luasnip.loaders.from_lua").load(
|
||||
{ paths = vim.fn.stdpath('config') .. '/snippets'} )
|
||||
end
|
||||
}
|
||||
packer.use 'https://github.com/L3MON4D3/LuaSnip'
|
||||
|
||||
require("luasnip.loaders.from_lua").load({
|
||||
paths = vim.fn.stdpath('config') .. '/snippets'
|
||||
})
|
||||
|
@ -14,102 +14,101 @@ packer.use {
|
||||
'https://github.com/hrsh7th/cmp-nvim-lua',
|
||||
'https://github.com/hrsh7th/cmp-nvim-lsp-signature-help',
|
||||
'https://github.com/uga-rosa/cmp-dictionary',
|
||||
},
|
||||
config = function()
|
||||
local cmp = require'cmp'
|
||||
if not cmp then return end
|
||||
local luasnip = require('luasnip')
|
||||
if not luasnip then return end
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<S-PageUp>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<S-PageDown>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<Left>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = false }),
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.kump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end)
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype('lua', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'nvim_lua' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
cmp.setup.filetype('gitcommit', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'dictionary' }
|
||||
}, {
|
||||
{ name = 'buffer' }
|
||||
})
|
||||
})
|
||||
|
||||
-- Use buffer source for `/`
|
||||
cmp.setup.cmdline('/', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':'
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
|
||||
require('cmp_dictionary').setup({
|
||||
dic = {
|
||||
['gitcommit'] =
|
||||
vim.fn.stdpath('config') .. '/resources/git.dict',
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
|
||||
if cmp and luasnip then
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<S-PageUp>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<S-PageDown>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<Left>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = false }),
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.kump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end)
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
-- set configuration for specific filetypes
|
||||
cmp.setup.filetype('lua', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'nvim_lua' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
cmp.setup.filetype('gitcommit', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'dictionary' }
|
||||
}, {
|
||||
{ name = 'buffer' }
|
||||
})
|
||||
})
|
||||
|
||||
-- Use buffer source for `/`
|
||||
cmp.setup.cmdline('/', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':'
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
|
||||
require('cmp_dictionary').setup({
|
||||
dic = {
|
||||
['gitcommit'] =
|
||||
vim.fn.stdpath('config') .. '/resources/git.dict',
|
||||
}
|
||||
})
|
||||
end
|
||||
|
@ -4,41 +4,39 @@ packer.use {
|
||||
'https://github.com/nvim-treesitter/nvim-treesitter',
|
||||
run = function()
|
||||
require('nvim-treesitter.install').update({ with_sync = true })
|
||||
end,
|
||||
config = function()
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = { 'org' }
|
||||
},
|
||||
ensure_installed = {
|
||||
'org', 'html', 'css', 'comment', 'json', 'json5',
|
||||
'cpp', 'c', 'lua', 'bash', 'javascript' ,'cmake', 'make',
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = { 'org' }
|
||||
},
|
||||
ensure_installed = {
|
||||
'org', 'html', 'css', 'comment', 'json', 'json5',
|
||||
'cpp', 'c', 'lua', 'bash', 'javascript' ,'cmake', 'make',
|
||||
},
|
||||
}
|
||||
|
||||
packer.use {
|
||||
'https://github.com/nvim-orgmode/orgmode',
|
||||
tag = '*',
|
||||
requires = 'https://github.com/nvim-treesitter/nvim-treesitter',
|
||||
config = function()
|
||||
require('orgmode').setup{}
|
||||
require('orgmode').setup_ts_grammar()
|
||||
requires = 'https://github.com/nvim-treesitter/nvim-treesitter'
|
||||
}
|
||||
|
||||
vim.api.nvim_create_augroup('config_fileformats', { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'BufEnter' },
|
||||
{
|
||||
group = 'config_fileformats',
|
||||
pattern = { '*.org' },
|
||||
callback = function()
|
||||
-- allow to hide stuff, like links
|
||||
vim.opt_local.conceallevel = 2
|
||||
vim.opt_local.concealcursor = 'nc'
|
||||
end
|
||||
}
|
||||
)
|
||||
require('orgmode').setup{}
|
||||
require('orgmode').setup_ts_grammar()
|
||||
|
||||
vim.api.nvim_create_augroup('config_fileformats', { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'BufEnter' },
|
||||
{
|
||||
group = 'config_fileformats',
|
||||
pattern = { '*.org' },
|
||||
callback = function()
|
||||
-- allow to hide stuff, like links
|
||||
vim.opt_local.conceallevel = 2
|
||||
vim.opt_local.concealcursor = 'nc'
|
||||
end
|
||||
}
|
||||
)
|
||||
|
@ -11,8 +11,8 @@ vim.api.nvim_create_autocmd(
|
||||
{
|
||||
group = 'config_functions',
|
||||
pattern = {
|
||||
'*.lua', '*.cpp',
|
||||
'*.hpp', '*.conf', '*.cfg', '*.ini'
|
||||
'*.lua', '*.cpp', '*.hpp',
|
||||
'*.conf', '*.cfg', '*.ini', '*.adoc'
|
||||
},
|
||||
callback = M.remove_trailing_whitespace
|
||||
}
|
||||
|
@ -5,159 +5,165 @@ require('my/completion')
|
||||
packer.use {
|
||||
'https://github.com/neovim/nvim-lspconfig',
|
||||
tag = '*',
|
||||
requires = 'https://github.com/hrsh7th/cmp-nvim-lsp',
|
||||
config = function()
|
||||
map('n', '<f5>', vim.diagnostic.goto_prev)
|
||||
map('n', '<f6>', vim.diagnostic.goto_next)
|
||||
|
||||
-- only do this after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
local function map(mode, shortcut, command)
|
||||
vim.keymap.set(mode, shortcut, command,
|
||||
{ noremap = true, silent = true, buffer=bufnr })
|
||||
end
|
||||
|
||||
map('n', 'gD', vim.lsp.buf.declaration)
|
||||
map('n', 'gd', vim.lsp.buf.definition)
|
||||
map('n', 'gi', vim.lsp.buf.implementation)
|
||||
map('n', 'gr', vim.lsp.buf.references)
|
||||
map('n', 'K', vim.lsp.buf.hover)
|
||||
map('n', '<C-k>', vim.lsp.buf.signature_help)
|
||||
map('n', '<Leader>lwa', vim.lsp.buf.add_workspace_folder)
|
||||
map('n', '<Leader>lwr', vim.lsp.buf.remove_workspace_folder)
|
||||
map('n', '<Leader>lwl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end)
|
||||
map('n', '<Leader>lr', vim.lsp.buf.rename)
|
||||
map('n', '<Leader>la', vim.lsp.buf.code_action)
|
||||
map('n', '<Leader>lf', vim.lsp.buf.formatting)
|
||||
|
||||
-- highlight symbol under cursor
|
||||
if client.resolved_capabilities.document_highlight then
|
||||
vim.cmd [[
|
||||
hi! LspReferenceRead cterm=bold ctermbg=red guibg=#633466
|
||||
hi! LspReferenceText cterm=bold ctermbg=red guibg=#633466
|
||||
hi! LspReferenceWrite cterm=bold ctermbg=red guibg=#633466
|
||||
]]
|
||||
vim.api.nvim_create_augroup('config_lsp', { clear = false })
|
||||
vim.api.nvim_clear_autocmds({
|
||||
buffer = bufnr,
|
||||
group = 'config_lsp',
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
group = 'config_lsp',
|
||||
buffer = bufnr,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
})
|
||||
vim.api.nvim_create_autocmd('CursorMoved', {
|
||||
group = 'config_lsp',
|
||||
buffer = bufnr,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
end
|
||||
|
||||
-- -- show help on hover
|
||||
-- if client.resolved_capabilities.hover then
|
||||
-- vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
-- group = 'config_lsp',
|
||||
-- buffer = bufnr,
|
||||
-- callback = vim.lsp.buf.hover,
|
||||
-- })
|
||||
-- end
|
||||
end
|
||||
|
||||
-- update client capabilities with completion plugin stuff
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(
|
||||
vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
-- setup servers
|
||||
if vim.fn.executable('clangd') > 0 then
|
||||
require'lspconfig'.clangd.setup{
|
||||
cmd = {
|
||||
'clangd',
|
||||
'--compile-commands-dir=build',
|
||||
'--clang-tidy', -- needs >=clangd-9
|
||||
'--ranking-model=decision_forest' -- needs >=clangd-12
|
||||
},
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
|
||||
if vim.fn.executable('lua-language-server') > 0 then
|
||||
require'lspconfig'.sumneko_lua.setup {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = 'LuaJIT',
|
||||
},
|
||||
diagnostics = {
|
||||
globals = {'vim'},
|
||||
},
|
||||
workspace = {
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
completion = {
|
||||
-- complete full function signature
|
||||
callSnippet = 'Replace',
|
||||
},
|
||||
},
|
||||
},
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
|
||||
if vim.fn.executable('pylsp') > 0 then
|
||||
require'lspconfig'.pylsp.setup{
|
||||
settings = {
|
||||
pylsp = {
|
||||
}
|
||||
},
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
|
||||
if vim.fn.executable('lemminx') > 0 then
|
||||
require'lspconfig'.lemminx.setup{
|
||||
filetypes = {
|
||||
'xml', 'xsd', 'xsl', 'xslt', 'svg', 'gentoo-metadata'
|
||||
},
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
|
||||
if vim.fn.executable('vscode-html-language-server') > 0 then
|
||||
require'lspconfig'.html.setup{
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
|
||||
if vim.fn.executable('vscode-css-language-server') > 0 then
|
||||
require'lspconfig'.cssls.setup{
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
|
||||
if vim.fn.executable('vscode-eslint-language-server') > 0 then
|
||||
require'lspconfig'.eslint.setup{
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
|
||||
if vim.fn.executable('vscode-json-language-server') > 0 then
|
||||
require'lspconfig'.jsonls.setup{
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
end
|
||||
requires = 'https://github.com/hrsh7th/cmp-nvim-lsp'
|
||||
}
|
||||
|
||||
-- only do this after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
local function map(mode, shortcut, command) -- overwrite function in keymaps
|
||||
vim.keymap.set(mode, shortcut, command, {
|
||||
noremap = true, silent = true, buffer=bufnr })
|
||||
end
|
||||
|
||||
map('n', '<f5>', vim.diagnostic.goto_prev)
|
||||
map('n', '<f6>', vim.diagnostic.goto_next)
|
||||
map('n', 'gD', vim.lsp.buf.declaration)
|
||||
map('n', 'gd', vim.lsp.buf.definition)
|
||||
map('n', 'gi', vim.lsp.buf.implementation)
|
||||
map('n', 'gr', vim.lsp.buf.references)
|
||||
map('n', 'K', vim.lsp.buf.hover)
|
||||
map('n', '<C-k>', vim.lsp.buf.signature_help)
|
||||
map('n', '<Leader>lwa', vim.lsp.buf.add_workspace_folder)
|
||||
map('n', '<Leader>lwr', vim.lsp.buf.remove_workspace_folder)
|
||||
map('n', '<Leader>lwl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end)
|
||||
map('n', '<Leader>lr', vim.lsp.buf.rename)
|
||||
map('n', '<Leader>la', vim.lsp.buf.code_action)
|
||||
map('n', '<Leader>lf', vim.lsp.buf.formatting)
|
||||
|
||||
-- highlight symbol under cursor
|
||||
if client.resolved_capabilities.document_highlight then
|
||||
vim.cmd [[
|
||||
execute "hi! LspReferenceRead cterm=bold ctermbg=".g:amora#palette.comment[1]." guibg=".g:amora#palette.comment[0]
|
||||
execute "hi! LspReferenceText cterm=bold ctermbg=".g:amora#palette.comment[1]." guibg=".g:amora#palette.comment[0]
|
||||
execute "hi! LspReferenceWrite cterm=bold ctermbg=".g:amora#palette.comment[1]." guibg=".g:amora#palette.comment[0]
|
||||
]]
|
||||
vim.api.nvim_create_augroup('config_lsp', { clear = false })
|
||||
vim.api.nvim_clear_autocmds({
|
||||
buffer = bufnr,
|
||||
group = 'config_lsp',
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
group = 'config_lsp',
|
||||
buffer = bufnr,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
})
|
||||
vim.api.nvim_create_autocmd('CursorMoved', {
|
||||
group = 'config_lsp',
|
||||
buffer = bufnr,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
end
|
||||
|
||||
-- -- show help on hover -- cursor ends up in popup
|
||||
-- if client.resolved_capabilities.hover then
|
||||
-- vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
-- group = 'config_lsp',
|
||||
-- buffer = bufnr,
|
||||
-- callback = function()
|
||||
-- vim.lsp.buf.hover({ focusable = false })
|
||||
-- end
|
||||
-- })
|
||||
-- end
|
||||
end
|
||||
|
||||
-- update client capabilities with completion plugin stuff
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(
|
||||
vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
|
||||
vim.lsp.handlers.hover, {
|
||||
border = "rounded",
|
||||
width = 60,
|
||||
})
|
||||
|
||||
-- setup servers
|
||||
if vim.fn.executable('clangd') > 0 then
|
||||
require'lspconfig'.clangd.setup{
|
||||
cmd = {
|
||||
'clangd',
|
||||
'--compile-commands-dir=build',
|
||||
'--clang-tidy', -- needs >=clangd-9
|
||||
'--ranking-model=decision_forest' -- needs >=clangd-12
|
||||
},
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
|
||||
if vim.fn.executable('lua-language-server') > 0 then
|
||||
require'lspconfig'.sumneko_lua.setup {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = 'LuaJIT',
|
||||
},
|
||||
diagnostics = {
|
||||
globals = {'vim'},
|
||||
},
|
||||
workspace = {
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
completion = {
|
||||
-- complete full function signature
|
||||
callSnippet = 'Replace',
|
||||
},
|
||||
},
|
||||
},
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
|
||||
if vim.fn.executable('pylsp') > 0 then
|
||||
require'lspconfig'.pylsp.setup{
|
||||
settings = {
|
||||
pylsp = {
|
||||
}
|
||||
},
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
|
||||
if vim.fn.executable('lemminx') > 0 then
|
||||
require'lspconfig'.lemminx.setup{
|
||||
filetypes = {
|
||||
'xml', 'xsd', 'xsl', 'xslt', 'svg', 'gentoo-metadata'
|
||||
},
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
|
||||
if vim.fn.executable('vscode-html-language-server') > 0 then
|
||||
require'lspconfig'.html.setup{
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
|
||||
if vim.fn.executable('vscode-css-language-server') > 0 then
|
||||
require'lspconfig'.cssls.setup{
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
|
||||
if vim.fn.executable('vscode-eslint-language-server') > 0 then
|
||||
require'lspconfig'.eslint.setup{
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
|
||||
if vim.fn.executable('vscode-json-language-server') > 0 then
|
||||
require'lspconfig'.jsonls.setup{
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
|
@ -6,63 +6,47 @@ packer.use {
|
||||
tag = '*',
|
||||
run = function()
|
||||
vim.fn['firenvim#install'](0)
|
||||
end,
|
||||
config = function()
|
||||
vim.g.firenvim_config = {
|
||||
localSettings = {
|
||||
[".*"] = {
|
||||
priority = 0,
|
||||
takeover = 'never',
|
||||
},
|
||||
['/(issues|pull|merge_requests)/'] = {
|
||||
priority = 1,
|
||||
takeover = 'once'
|
||||
},
|
||||
['https://bugs\\.gentoo\\.org/'] = {
|
||||
priority = 1,
|
||||
takeover = 'once'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if vim.g.started_by_firenvim then
|
||||
vim.o.wrap = true
|
||||
vim.o.guifont = 'Source_Code_Pro:h10'
|
||||
end
|
||||
|
||||
vim.api.nvim_create_augroup('firenvim', { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'BufWinEnter' },
|
||||
{
|
||||
group = 'firenvim',
|
||||
pattern = {
|
||||
'*/firenvim/*.txt',
|
||||
'*/firenvim/*.md',
|
||||
},
|
||||
callback = function()
|
||||
vim.o.textwidth = 0
|
||||
-- FIXME: my_set_colorcolumn() should set that automatically
|
||||
vim.o.colorcolumn = 0
|
||||
vim.cmd([[startinsert]])
|
||||
end
|
||||
}
|
||||
)
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'BufEnter' },
|
||||
{
|
||||
group = 'firenvim',
|
||||
pattern = {
|
||||
'schlomp.space_*',
|
||||
'codeberg.org_*',
|
||||
'gitlab.com_*',
|
||||
'github.com_*',
|
||||
'very.tastytea.de_*',
|
||||
'bookwyrm.social_*',
|
||||
'openlibrary.org_*',
|
||||
'bugs.gentoo.org_*',
|
||||
},
|
||||
command = [[set filetype=markdown | set tw=0]]
|
||||
}
|
||||
)
|
||||
end
|
||||
}
|
||||
|
||||
if vim.g.started_by_firenvim then
|
||||
vim.g.firenvim_config = {
|
||||
localSettings = {
|
||||
[".*"] = {
|
||||
priority = 0,
|
||||
takeover = 'never',
|
||||
},
|
||||
['/(issues|pull|merge_requests)/'] = {
|
||||
priority = 1,
|
||||
takeover = 'once'
|
||||
},
|
||||
['https://bugs\\.gentoo\\.org/'] = {
|
||||
priority = 1,
|
||||
takeover = 'once'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vim.opt.wrap = true
|
||||
vim.opt.guifont = 'Source_Code_Pro:h10'
|
||||
vim.opt.textwidth = 0
|
||||
vim.opt.colorcolumn = '0'
|
||||
|
||||
vim.api.nvim_create_augroup('firenvim', { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'BufEnter' },
|
||||
{
|
||||
group = 'firenvim',
|
||||
pattern = {
|
||||
'schlomp.space_*',
|
||||
'codeberg.org_*',
|
||||
'gitlab.com_*',
|
||||
'github.com_*',
|
||||
'very.tastytea.de_*',
|
||||
'bookwyrm.social_*',
|
||||
'openlibrary.org_*',
|
||||
'bugs.gentoo.org_*',
|
||||
},
|
||||
command = [[set filetype=markdown | set tw=0 cc=0]]
|
||||
})
|
||||
end
|
||||
|
@ -26,15 +26,13 @@ vim.cmd([[command! -narg=1 -complete=help Ht tab help <args>]])
|
||||
-- theme
|
||||
vim.o.termguicolors = true -- 24 bit colours
|
||||
packer.use {
|
||||
'https://github.com/owozsh/amora',
|
||||
config = function()
|
||||
vim.cmd('colorscheme amora')
|
||||
-- make comments a bit lighter
|
||||
vim.cmd([[
|
||||
highlight AmoraComment ctermfg=61 guifg=#7C4180
|
||||
highlight AmoraCommentBold cterm=bold ctermfg=61 gui=bold guifg=#7C4180
|
||||
]])
|
||||
end
|
||||
'https://github.com/owozsh/amora'
|
||||
}
|
||||
vim.cmd('colorscheme amora')
|
||||
-- make comments a bit lighter
|
||||
vim.cmd([[
|
||||
highlight AmoraComment ctermfg=61 guifg=#7C4180
|
||||
highlight AmoraCommentBold cterm=bold ctermfg=61 gui=bold guifg=#7C4180
|
||||
]])
|
||||
|
||||
packer.use 'https://github.com/editorconfig/editorconfig-vim'
|
||||
|
@ -3,13 +3,11 @@ require('my/keymaps')
|
||||
require('my/filetypes')
|
||||
|
||||
packer.use {
|
||||
'https://github.com/folke/which-key.nvim',
|
||||
config = function()
|
||||
require('which-key').setup {
|
||||
}
|
||||
end
|
||||
'https://github.com/folke/which-key.nvim'
|
||||
}
|
||||
|
||||
require('which-key').setup{}
|
||||
|
||||
packer.use {
|
||||
'https://github.com/nvim-telescope/telescope.nvim',
|
||||
tag = '*',
|
||||
@ -17,42 +15,41 @@ packer.use {
|
||||
'https://github.com/nvim-lua/plenary.nvim',
|
||||
'https://github.com/nvim-treesitter/nvim-treesitter',
|
||||
},
|
||||
config = function()
|
||||
local telescope = require('telescope')
|
||||
local actions = require('telescope.actions')
|
||||
telescope.load_extension('media_files') -- FIXME: does not work
|
||||
|
||||
require('telescope').setup {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-_>"] = actions.which_key,
|
||||
},
|
||||
n = {
|
||||
["?"] = actions.which_key,
|
||||
}
|
||||
},
|
||||
extensions = {
|
||||
media_files = {
|
||||
filetypes = { 'png', 'webp', 'jpg', 'jpeg', 'epub', 'pdf' }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
local builtin = require('telescope.builtin')
|
||||
local my = require('my.functions')
|
||||
map('n', '<Leader>tb', builtin.buffers)
|
||||
map('n', '<Leader>tf', function()
|
||||
builtin.find_files({ cwd = my.get_project_root() })
|
||||
end)
|
||||
map('n', '<Leader>to', builtin.oldfiles)
|
||||
map('n', '<Leader>tg', function()
|
||||
builtin.live_grep({ cwd = my.get_project_root() })
|
||||
end)
|
||||
map('n', '<Leader>tm', builtin.man_pages)
|
||||
map('n', '<Leader>tr', builtin.registers)
|
||||
end
|
||||
}
|
||||
|
||||
local telescope = require('telescope')
|
||||
local actions = require('telescope.actions')
|
||||
telescope.load_extension('media_files') -- FIXME: does not work
|
||||
|
||||
require('telescope').setup {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-_>"] = actions.which_key,
|
||||
},
|
||||
n = {
|
||||
["?"] = actions.which_key,
|
||||
}
|
||||
},
|
||||
extensions = {
|
||||
media_files = {
|
||||
filetypes = { 'png', 'webp', 'jpg', 'jpeg', 'epub', 'pdf' }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
local builtin = require('telescope.builtin')
|
||||
local my = require('my.functions')
|
||||
map('n', '<Leader>tb', builtin.buffers)
|
||||
map('n', '<Leader>tf', function()
|
||||
builtin.find_files({ cwd = my.get_project_root() })
|
||||
end)
|
||||
map('n', '<Leader>to', builtin.oldfiles)
|
||||
map('n', '<Leader>tg', function()
|
||||
builtin.live_grep({ cwd = my.get_project_root() })
|
||||
end)
|
||||
map('n', '<Leader>tm', builtin.man_pages)
|
||||
map('n', '<Leader>tr', builtin.registers)
|
||||
|
||||
packer.use {
|
||||
'https://github.com/nvim-telescope/telescope-media-files.nvim',
|
||||
requires = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user