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)
|
||||
(local_function_statement)
|
||||
(object_creation_expression)
|
||||
(array_creation_expression)
|
||||
(implicit_object_creation_expression)
|
||||
|
||||
] @indent.begin
|
||||
|
@ -61,6 +62,8 @@
|
|||
(while_statement
|
||||
(block "{" @indent.branch))
|
||||
|
||||
(array_creation_expression
|
||||
(initializer_expression "{" @indent.branch))
|
||||
(object_creation_expression
|
||||
(initializer_expression "{" @indent.branch))
|
||||
(implicit_object_creation_expression
|
||||
|
@ -102,6 +105,7 @@
|
|||
(local_function_statement ";" @indent.end)
|
||||
(local_declaration_statement ";" @indent.end)
|
||||
|
||||
; this is fucked up, because grammer doesn't match # as part of the token
|
||||
[
|
||||
(if_directive)
|
||||
(else_directive)
|
||||
|
@ -110,4 +114,4 @@
|
|||
(nullable_directive)
|
||||
(pragma_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_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', 'x', 'o' }, 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next search result' })
|
||||
|
|
|
@ -134,15 +134,16 @@ function M.setup()
|
|||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = {
|
||||
format = function(diag)
|
||||
local s = vim.diagnostic.severity
|
||||
if diag.severity == s.E or diag.severity == s.W then
|
||||
return diag.message
|
||||
end
|
||||
return nil
|
||||
end,
|
||||
},
|
||||
virtual_text = false
|
||||
-- virtual_text = {
|
||||
-- format = function(diag)
|
||||
-- local s = vim.diagnostic.severity
|
||||
-- if diag.severity == s.E or diag.severity == s.W then
|
||||
-- return diag.message
|
||||
-- end
|
||||
-- return nil
|
||||
-- end,
|
||||
-- },
|
||||
})
|
||||
|
||||
if vim.g.neoray then -- {{{
|
||||
|
|
|
@ -57,15 +57,6 @@ local server_configs = function()
|
|||
phpactor = {
|
||||
-- {{{
|
||||
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)
|
||||
local u = require('lspconfig.util')
|
||||
return u.search_ancestors(startpath, function(path)
|
||||
|
@ -303,18 +294,23 @@ local function make_client_capabilities()
|
|||
end
|
||||
|
||||
local function config()
|
||||
require('neodev').setup({})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
callback = on_attach,
|
||||
})
|
||||
|
||||
local capabilities = make_client_capabilities()
|
||||
local servers = server_configs();
|
||||
|
||||
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
|
||||
conf.capabilities = capabilities
|
||||
nvim_lsp[name].setup(conf)
|
||||
end
|
||||
end
|
||||
|
@ -336,8 +332,12 @@ end
|
|||
return {
|
||||
{
|
||||
'neovim/nvim-lspconfig',
|
||||
event = 'BufRead',
|
||||
config = config,
|
||||
cmd = { 'LspInfo', 'LspLog', 'LspStart' },
|
||||
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',
|
||||
opts = {
|
||||
|
@ -357,12 +357,9 @@ return {
|
|||
{ '<leader>li', '<Cmd>LspInfo<CR>', desc = 'Lsp info' },
|
||||
{ '<leader>ll', '<Cmd>LspLog<CR>', desc = 'Lsp log' },
|
||||
},
|
||||
event = 'BufRead',
|
||||
config = config,
|
||||
},
|
||||
{ 'SmiteshP/nvim-navic', lazy = true },
|
||||
{ 'Hoffs/omnisharp-extended-lsp.nvim', lazy = true },
|
||||
{ 'b0o/schemastore.nvim', lazy = true },
|
||||
{ 'folke/neodev.nvim', lazy = true },
|
||||
{ 'Issafalcon/lsp-overloads.nvim', lazy = true },
|
||||
}
|
||||
|
|
|
@ -173,6 +173,15 @@ return {
|
|||
},
|
||||
|
||||
{ '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',
|
||||
|
|
|
@ -4,7 +4,8 @@ local M = {
|
|||
'nvim-lua/plenary.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' },
|
||||
|
@ -12,11 +13,11 @@ local M = {
|
|||
{ '<Space>b', [[<Cmd>Telescope buffers<CR>]], desc = 'Buffers' },
|
||||
{ '<Space>ff', [[<Cmd>Telescope find_files<CR>]], desc = 'Search file' },
|
||||
{ '<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>Td', [[<Cmd>Telescope diagnostics<CR>]], desc = 'Telescope workspace diagnostics' },
|
||||
{ '<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 layout_actions = require('telescope.actions.layout')
|
||||
|
||||
telescope.setup {
|
||||
local opts = {
|
||||
defaults = {
|
||||
preview = {
|
||||
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', {})
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
group = augr,
|
||||
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,
|
||||
})
|
||||
for ext, _ in pairs(opts.extensions) do
|
||||
telescope.load_extension(ext)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Add table
Reference in a new issue