nvim: virtual line & misc
This commit is contained in:
parent
7ceae85cf9
commit
ed0f598e7b
6 changed files with 52 additions and 47 deletions
|
@ -36,6 +36,7 @@
|
||||||
(using_statement)
|
(using_statement)
|
||||||
(local_function_statement)
|
(local_function_statement)
|
||||||
(object_creation_expression)
|
(object_creation_expression)
|
||||||
|
(array_creation_expression)
|
||||||
(implicit_object_creation_expression)
|
(implicit_object_creation_expression)
|
||||||
|
|
||||||
] @indent.begin
|
] @indent.begin
|
||||||
|
@ -61,6 +62,8 @@
|
||||||
(while_statement
|
(while_statement
|
||||||
(block "{" @indent.branch))
|
(block "{" @indent.branch))
|
||||||
|
|
||||||
|
(array_creation_expression
|
||||||
|
(initializer_expression "{" @indent.branch))
|
||||||
(object_creation_expression
|
(object_creation_expression
|
||||||
(initializer_expression "{" @indent.branch))
|
(initializer_expression "{" @indent.branch))
|
||||||
(implicit_object_creation_expression
|
(implicit_object_creation_expression
|
||||||
|
@ -102,6 +105,7 @@
|
||||||
(local_function_statement ";" @indent.end)
|
(local_function_statement ";" @indent.end)
|
||||||
(local_declaration_statement ";" @indent.end)
|
(local_declaration_statement ";" @indent.end)
|
||||||
|
|
||||||
|
; this is fucked up, because grammer doesn't match # as part of the token
|
||||||
[
|
[
|
||||||
(if_directive)
|
(if_directive)
|
||||||
(else_directive)
|
(else_directive)
|
||||||
|
@ -110,4 +114,4 @@
|
||||||
(nullable_directive)
|
(nullable_directive)
|
||||||
(pragma_directive)
|
(pragma_directive)
|
||||||
(undef_directive)
|
(undef_directive)
|
||||||
] @align.zero
|
] @indent.zero
|
||||||
|
|
|
@ -20,6 +20,8 @@ function M.setup()
|
||||||
|
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to next diagnostic' })
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to next diagnostic' })
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to prev diagnostic' })
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to prev diagnostic' })
|
||||||
|
vim.keymap.set('n', '[e', function() vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR}) end, { desc = 'Go to next error' })
|
||||||
|
vim.keymap.set('n', ']e', function() vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR}) end, { desc = 'Go to prev error' })
|
||||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, { desc = 'Diagnostic to loclist' })
|
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, { desc = 'Diagnostic to loclist' })
|
||||||
|
|
||||||
vim.keymap.set({ 'n', 'x', 'o' }, 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next search result' })
|
vim.keymap.set({ 'n', 'x', 'o' }, 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next search result' })
|
||||||
|
|
|
@ -134,15 +134,16 @@ function M.setup()
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
virtual_text = {
|
virtual_text = false
|
||||||
format = function(diag)
|
-- virtual_text = {
|
||||||
local s = vim.diagnostic.severity
|
-- format = function(diag)
|
||||||
if diag.severity == s.E or diag.severity == s.W then
|
-- local s = vim.diagnostic.severity
|
||||||
return diag.message
|
-- if diag.severity == s.E or diag.severity == s.W then
|
||||||
end
|
-- return diag.message
|
||||||
return nil
|
-- end
|
||||||
end,
|
-- return nil
|
||||||
},
|
-- end,
|
||||||
|
-- },
|
||||||
})
|
})
|
||||||
|
|
||||||
if vim.g.neoray then -- {{{
|
if vim.g.neoray then -- {{{
|
||||||
|
|
|
@ -57,15 +57,6 @@ local server_configs = function()
|
||||||
phpactor = {
|
phpactor = {
|
||||||
-- {{{
|
-- {{{
|
||||||
cmd = { vim.env.HOME .. '/devel/phpactor/bin/phpactor', 'language-server' },
|
cmd = { vim.env.HOME .. '/devel/phpactor/bin/phpactor', 'language-server' },
|
||||||
handlers = {
|
|
||||||
['textDocument/publishDiagnostics'] = vim.lsp.with(
|
|
||||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
|
||||||
virtual_text = {
|
|
||||||
severity = vim.diagnostic.severity.ERROR,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
),
|
|
||||||
},
|
|
||||||
root_dir = function(startpath)
|
root_dir = function(startpath)
|
||||||
local u = require('lspconfig.util')
|
local u = require('lspconfig.util')
|
||||||
return u.search_ancestors(startpath, function(path)
|
return u.search_ancestors(startpath, function(path)
|
||||||
|
@ -303,18 +294,23 @@ local function make_client_capabilities()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function config()
|
local function config()
|
||||||
require('neodev').setup({})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
callback = on_attach,
|
callback = on_attach,
|
||||||
})
|
})
|
||||||
|
|
||||||
local capabilities = make_client_capabilities()
|
local capabilities = make_client_capabilities()
|
||||||
local servers = server_configs();
|
|
||||||
|
|
||||||
local nvim_lsp = require('lspconfig')
|
local nvim_lsp = require('lspconfig')
|
||||||
|
|
||||||
|
nvim_lsp.util.default_config = vim.tbl_extend('force',
|
||||||
|
nvim_lsp.util.default_config,
|
||||||
|
{
|
||||||
|
capabilities = capabilities
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
local servers = server_configs();
|
||||||
for name, conf in pairs(servers) do
|
for name, conf in pairs(servers) do
|
||||||
conf.capabilities = capabilities
|
|
||||||
nvim_lsp[name].setup(conf)
|
nvim_lsp[name].setup(conf)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -336,8 +332,12 @@ end
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
|
event = 'BufRead',
|
||||||
|
config = config,
|
||||||
|
cmd = { 'LspInfo', 'LspLog', 'LspStart' },
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{ 'j-hui/fidget.nvim', config = true },
|
{ 'folke/neodev.nvim', config = true },
|
||||||
|
{ 'j-hui/fidget.nvim', config = true, tag = 'legacy' },
|
||||||
{
|
{
|
||||||
'ray-x/lsp_signature.nvim',
|
'ray-x/lsp_signature.nvim',
|
||||||
opts = {
|
opts = {
|
||||||
|
@ -357,12 +357,9 @@ return {
|
||||||
{ '<leader>li', '<Cmd>LspInfo<CR>', desc = 'Lsp info' },
|
{ '<leader>li', '<Cmd>LspInfo<CR>', desc = 'Lsp info' },
|
||||||
{ '<leader>ll', '<Cmd>LspLog<CR>', desc = 'Lsp log' },
|
{ '<leader>ll', '<Cmd>LspLog<CR>', desc = 'Lsp log' },
|
||||||
},
|
},
|
||||||
event = 'BufRead',
|
|
||||||
config = config,
|
|
||||||
},
|
},
|
||||||
{ 'SmiteshP/nvim-navic', lazy = true },
|
{ 'SmiteshP/nvim-navic', lazy = true },
|
||||||
{ 'Hoffs/omnisharp-extended-lsp.nvim', lazy = true },
|
{ 'Hoffs/omnisharp-extended-lsp.nvim', lazy = true },
|
||||||
{ 'b0o/schemastore.nvim', lazy = true },
|
{ 'b0o/schemastore.nvim', lazy = true },
|
||||||
{ 'folke/neodev.nvim', lazy = true },
|
|
||||||
{ 'Issafalcon/lsp-overloads.nvim', lazy = true },
|
{ 'Issafalcon/lsp-overloads.nvim', lazy = true },
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,6 +173,15 @@ return {
|
||||||
},
|
},
|
||||||
|
|
||||||
{ 'dyng/ctrlsf.vim', cmd = 'CtrlSF' },
|
{ 'dyng/ctrlsf.vim', cmd = 'CtrlSF' },
|
||||||
|
{
|
||||||
|
'https://git.sr.ht/~whynothugo/lsp_lines.nvim',
|
||||||
|
config = function()
|
||||||
|
require('lsp_lines').setup()
|
||||||
|
vim.diagnostic.config({
|
||||||
|
virtual_lines = { only_current_line = true },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
'andymass/vim-matchup',
|
'andymass/vim-matchup',
|
||||||
|
|
|
@ -4,7 +4,8 @@ local M = {
|
||||||
'nvim-lua/plenary.nvim',
|
'nvim-lua/plenary.nvim',
|
||||||
{
|
{
|
||||||
'nvim-telescope/telescope-fzf-native.nvim',
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build'
|
build =
|
||||||
|
'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
cmd = { 'Telescope' },
|
cmd = { 'Telescope' },
|
||||||
|
@ -12,11 +13,11 @@ local M = {
|
||||||
{ '<Space>b', [[<Cmd>Telescope buffers<CR>]], desc = 'Buffers' },
|
{ '<Space>b', [[<Cmd>Telescope buffers<CR>]], desc = 'Buffers' },
|
||||||
{ '<Space>ff', [[<Cmd>Telescope find_files<CR>]], desc = 'Search file' },
|
{ '<Space>ff', [[<Cmd>Telescope find_files<CR>]], desc = 'Search file' },
|
||||||
{ '<Space>fg', [[<Cmd>Telescope live_grep<CR>]], desc = 'Grep through files' },
|
{ '<Space>fg', [[<Cmd>Telescope live_grep<CR>]], desc = 'Grep through files' },
|
||||||
{ '<Space>T', [[<Cmd>Telescope<CR>]], desc = 'Telescope' },
|
{ '<Space>Ta', [[<Cmd>Telescope<CR>]], desc = 'Telescope all' },
|
||||||
{ '<Space>Tg', [[<Cmd>Telescope grep_string<CR>]], desc = 'Telescope grep string' },
|
{ '<Space>Tg', [[<Cmd>Telescope grep_string<CR>]], desc = 'Telescope grep string' },
|
||||||
{ '<Space>Td', [[<Cmd>Telescope diagnostics<CR>]], desc = 'Telescope workspace diagnostics' },
|
{ '<Space>Td', [[<Cmd>Telescope diagnostics<CR>]], desc = 'Telescope workspace diagnostics' },
|
||||||
{ '<Space>Tj', [[<Cmd>Telescope jumplist<CR>]], desc = 'Telescope jumplist' },
|
{ '<Space>Tj', [[<Cmd>Telescope jumplist<CR>]], desc = 'Telescope jumplist' },
|
||||||
{ '<Space>Tr', [[<Cmd>Telescope resume<CR>]], desc = 'Telescope resume' },
|
{ '<Space>TT', [[<Cmd>Telescope resume<CR>]], desc = 'Telescope resume' },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ function M.config()
|
||||||
local actions = require('telescope.actions')
|
local actions = require('telescope.actions')
|
||||||
local layout_actions = require('telescope.actions.layout')
|
local layout_actions = require('telescope.actions.layout')
|
||||||
|
|
||||||
telescope.setup {
|
local opts = {
|
||||||
defaults = {
|
defaults = {
|
||||||
preview = {
|
preview = {
|
||||||
hide_on_startup = true,
|
hide_on_startup = true,
|
||||||
|
@ -55,25 +56,16 @@ function M.config()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
extensions = {
|
||||||
|
fzf = {},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
telescope.load_extension('fzf')
|
telescope.setup(opts)
|
||||||
|
|
||||||
local augr = vim.api.nvim_create_augroup('Telescope', {})
|
for ext, _ in pairs(opts.extensions) do
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
telescope.load_extension(ext)
|
||||||
group = augr,
|
end
|
||||||
pattern = 'TelescopePrompt',
|
|
||||||
callback = function()
|
|
||||||
vim.api.nvim_exec([[
|
|
||||||
imap <buffer> <C-b> <Cmd>Telescope buffers initial_mode=insert<CR>
|
|
||||||
nmap <buffer> <C-b> <Cmd>Telescope buffers initial_mode=insert<CR>
|
|
||||||
imap <buffer> <C-f> <Cmd>Telescope fd initial_mode=insert<CR>
|
|
||||||
nmap <buffer> <C-f> <Cmd>Telescope fd initial_mode=insert<CR>
|
|
||||||
imap <buffer> <C-a> <Cmd>Telescope builtin initial_mode=insert<CR>
|
|
||||||
nmap <buffer> <C-a> <Cmd>Telescope builtin initial_mode=insert<CR>
|
|
||||||
]], false)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
Loading…
Add table
Reference in a new issue