1
0
Fork 0

nvim: format

This commit is contained in:
Vladimír Dudr 2023-02-11 14:25:06 +01:00
parent d5a279bce8
commit c6abd232bd
16 changed files with 240 additions and 242 deletions

View file

@ -2,8 +2,12 @@ root = true
[*.lua] [*.lua]
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
tab_width = 4 tab_width = 2
quote_style = single max_line_length = 120
insert_final_newline = true insert_final_newline = true
continuation_indent = 2
quote_style = single
call_arg_parentheses = keep call_arg_parentheses = keep
table_separator_style = comma table_separator_style = comma
trailing_table_separator = smart

View file

@ -15,7 +15,7 @@ require('configs.options').setup()
require('lazy').setup( require('lazy').setup(
'configs.packages', 'configs.packages',
{ {
install = { colorscheme = { 'gruvbox' }, }, install = { colorscheme = { 'gruvbox' } },
-- rtp = { disabled_plugins = { 'netrwPlugin' } }, -- rtp = { disabled_plugins = { 'netrwPlugin' } },
change_detection = { change_detection = {
-- automatically check for config file changes and reload the ui -- automatically check for config file changes and reload the ui

View file

@ -3,9 +3,9 @@ local M = {}
local function toggle_win_opt(name) local function toggle_win_opt(name)
local newval = not vim.api.nvim_win_get_option(0, name) local newval = not vim.api.nvim_win_get_option(0, name)
vim.api.nvim_win_set_option( vim.api.nvim_win_set_option(
0, 0,
name, name,
newval newval
) )
if newval then if newval then
vim.notify(name .. ' is on') vim.notify(name .. ' is on')
@ -15,10 +15,8 @@ local function toggle_win_opt(name)
end end
function M.setup() function M.setup()
-- scroll up and down with shift+arrow {{
vim.keymap.set('n', '<S-Down>', '<C-E>') vim.keymap.set('n', '<S-Down>', '<C-E>')
vim.keymap.set('n', '<S-Up>', '<C-Y>') vim.keymap.set('n', '<S-Up>', '<C-Y>')
--}}}
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' })

View file

@ -1,82 +1,82 @@
local M = {} local M = {}
function M.setup() function M.setup()
-- {{{ LAYA -- {{{ LAYA
local aug = vim.api.nvim_create_augroup('laya', {}) local aug = vim.api.nvim_create_augroup('laya', {})
vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
group = aug, group = aug,
pattern = '**/jopixel/**/*.php', pattern = '**/jopixel/**/*.php',
callback = function() callback = function()
vim.cmd.iabbrev({ args = { '<buffer>', 'TR', '$this->obtainer()->translator()->t();<Left><Left>' } }) vim.cmd.iabbrev({ args = { '<buffer>', 'TR', '$this->obtainer()->translator()->t();<Left><Left>' } })
vim.cmd.iabbrev({ args = { '<buffer>', 'TI', '$this->obtainer()->translator()->t()<Left>' } }) vim.cmd.iabbrev({ args = { '<buffer>', 'TI', '$this->obtainer()->translator()->t()<Left>' } })
vim.cmd.iabbrev({ args = { '<buffer>', 'LOG', '$this->obtainer()->logger()->log();<Left><Left>' } }) vim.cmd.iabbrev({ args = { '<buffer>', 'LOG', '$this->obtainer()->logger()->log();<Left><Left>' } })
vim.cmd.iabbrev({ args = { '<buffer>', 'DBG', "$this->obtainer()->logger()->log('debug', 'debug',);<Left><Left>" } }) vim.cmd.iabbrev({ args = { '<buffer>', 'DBG', "$this->obtainer()->logger()->log('debug', 'debug',);<Left><Left>" } })
vim.cmd.iabbrev({ args = { '<buffer>', 'PROD', '$this->producer()' } }) vim.cmd.iabbrev({ args = { '<buffer>', 'PROD', '$this->producer()' } })
vim.cmd.iabbrev({ args = { '<buffer>', 'FILE', '$this->producer()->file()<Left>' } }) vim.cmd.iabbrev({ args = { '<buffer>', 'FILE', '$this->producer()->file()<Left>' } })
vim.cmd.iabbrev({ args = { '<buffer>', 'LINK', "$this->producer()->link($this, '')<Left><Left>" } }) vim.cmd.iabbrev({ args = { '<buffer>', 'LINK', "$this->producer()->link($this, '')<Left><Left>" } })
vim.cmd.iabbrev({ args = { '<buffer>', 'NW', '$this->obtainer()->notifications()->warning();<Left><Left>' } }) vim.cmd.iabbrev({ args = { '<buffer>', 'NW', '$this->obtainer()->notifications()->warning();<Left><Left>' } })
vim.cmd.iabbrev({ args = { '<buffer>', 'NS', '$this->obtainer()->notifications()->success();<Left><Left>' } }) vim.cmd.iabbrev({ args = { '<buffer>', 'NS', '$this->obtainer()->notifications()->success();<Left><Left>' } })
end end,
}) })
-- }}} LAYA -- }}} LAYA
--- terminal {{{ --- terminal {{{
local termgroup = vim.api.nvim_create_augroup('terminal', { clear = true }) local termgroup = vim.api.nvim_create_augroup('terminal', { clear = true })
vim.api.nvim_create_autocmd('TermOpen', { vim.api.nvim_create_autocmd('TermOpen', {
group = termgroup, group = termgroup,
callback = function() callback = function()
-- local buf = args.buf -- local buf = args.buf
vim.api.nvim_win_set_option(0, 'number', false) vim.api.nvim_win_set_option(0, 'number', false)
vim.api.nvim_win_set_option(0, 'signcolumn', 'no') vim.api.nvim_win_set_option(0, 'signcolumn', 'no')
vim.schedule(vim.cmd.startinsert) -- without schedule it lock screen refresh vim.schedule(vim.cmd.startinsert) -- without schedule it lock screen refresh
end end,
}) })
--}}} --}}}
-- Buffer {{{ -- Buffer {{{
vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, { command = "checktime" }) vim.api.nvim_create_autocmd({ 'FocusGained', 'TermClose', 'TermLeave' }, { command = 'checktime' })
-- go to last loc when opening a buffer -- go to last loc when opening a buffer
vim.api.nvim_create_autocmd("BufReadPost", { vim.api.nvim_create_autocmd('BufReadPost', {
callback = function() callback = function()
local mark = vim.api.nvim_buf_get_mark(0, '"') local mark = vim.api.nvim_buf_get_mark(0, '"')
local lcount = vim.api.nvim_buf_line_count(0) local lcount = vim.api.nvim_buf_line_count(0)
if mark[1] > 0 and mark[1] <= lcount then if mark[1] > 0 and mark[1] <= lcount then
pcall(vim.api.nvim_win_set_cursor, 0, mark) pcall(vim.api.nvim_win_set_cursor, 0, mark)
end end
end, end,
}) })
-- }}} -- }}}
-- qf {{{ -- qf {{{
-- local pad = function (str, n) -- local pad = function (str, n)
-- if #str > n then -- if #str > n then
-- return str -- return str
-- else -- else
-- return str .. string.rep(' ', n - #str) -- return str .. string.rep(' ', n - #str)
-- end -- end
-- end -- end
-- QuickfixFunc = function(info) -- QuickfixFunc = function(info)
-- local items -- local items
-- if info.quickfix then -- if info.quickfix then
-- items = vim.fn.getqflist({ id = info.id, items = 1 }).items -- items = vim.fn.getqflist({ id = info.id, items = 1 }).items
-- else -- else
-- items = vim.fn.getloclist(info.id, { items = 1 }).items -- items = vim.fn.getloclist(info.id, { items = 1 }).items
-- end -- end
-- local res = {}; -- local res = {};
-- for i = info.start_idx, info.end_idx, 1 do -- for i = info.start_idx, info.end_idx, 1 do
-- local item = items[i] -- local item = items[i]
-- table.insert(res, pad -- table.insert(res, pad
-- end -- end
-- end -- end
-- }}} -- }}}
end end
return M return M

View file

@ -101,14 +101,14 @@ function M.config()
pattern = '*Trouble', pattern = '*Trouble',
callback = function() callback = function()
vim.wo.cursorline = true vim.wo.cursorline = true
end end,
}) })
vim.api.nvim_create_autocmd('WinLeave', { vim.api.nvim_create_autocmd('WinLeave', {
group = troublegr, group = troublegr,
pattern = '*Trouble', pattern = '*Trouble',
callback = function() callback = function()
vim.wo.cursorline = false vim.wo.cursorline = false
end end,
}) })
local augr = vim.api.nvim_create_augroup('config_colorscheme', {}); local augr = vim.api.nvim_create_augroup('config_colorscheme', {});
@ -121,7 +121,7 @@ function M.config()
normalizeTerminal() normalizeTerminal()
normalizeCmpKindHighlight() normalizeCmpKindHighlight()
normalizeTroubleHighlight() normalizeTroubleHighlight()
end end,
}) })
vim.api.nvim_create_autocmd('Colorscheme', { vim.api.nvim_create_autocmd('Colorscheme', {
@ -151,9 +151,9 @@ function M.config()
end end
gr:hl('LineNr', 'gray', 'dark0_hard', linenr_style) gr:hl('LineNr', 'gray', 'dark0_hard', linenr_style)
gr:hl('LspCodeLens', 'gray', nil, { 'italic', }) gr:hl('LspCodeLens', 'gray', nil, { 'italic' })
gr:hl('IndentBlanklineContextChar', 'orange', nil, { 'nocombine', }) gr:hl('IndentBlanklineContextChar', 'orange', nil, { 'nocombine' })
gr:hl('DiagnosticVirtualTextError', 'error', nil, { 'italic', }) gr:hl('DiagnosticVirtualTextError', 'error', nil, { 'italic', })
gr:hl('DiagnosticVirtualTextWarn', 'warn', nil, { 'italic', }) gr:hl('DiagnosticVirtualTextWarn', 'warn', nil, { 'italic', })
@ -175,7 +175,7 @@ function M.config()
vim.fn.sign_define('DiagnosticSignWarn', { text = '', texthl = 'DiagnosticSignWarn' }) vim.fn.sign_define('DiagnosticSignWarn', { text = '', texthl = 'DiagnosticSignWarn' })
vim.fn.sign_define('DiagnosticSignInfo', { text = '', texthl = 'DiagnosticSignInfo' }) vim.fn.sign_define('DiagnosticSignInfo', { text = '', texthl = 'DiagnosticSignInfo' })
vim.fn.sign_define('DiagnosticSignHint', { text = '', texthl = 'DiagnosticSignHint' }) vim.fn.sign_define('DiagnosticSignHint', { text = '', texthl = 'DiagnosticSignHint' })
end end,
}) })
local term = vim.env.TERM local term = vim.env.TERM

View file

@ -1,24 +1,23 @@
local M = { local M = {
'numToStr/FTerm.nvim', 'numToStr/FTerm.nvim',
keys = { keys = {
{ '<Space>gg', '<Plug>Lazygit', desc = 'Lazygit' }, { '<Space>gg', '<Plug>Lazygit', desc = 'Lazygit' },
{ '<Space>gh', '<Plug>GitHistory', desc = 'Git history' }, { '<Space>gh', '<Plug>GitHistory', desc = 'Git history' },
}, },
lazy = true, lazy = true,
} }
function M.config() function M.config()
local fterm = require('FTerm') local fterm = require('FTerm')
local lazygit = fterm:new({ local lazygit = fterm:new({
-- ft = 'fterm_lazygit', -- You can also override the default filetype, if you want -- ft = 'fterm_lazygit', -- You can also override the default filetype, if you want
cmd = 'lazygit', cmd = 'lazygit',
dimensions = { dimensions = {
height = 0.9, height = 0.9,
width = 0.9 width = 0.9,
} },
}) })
local git_history = function() local git_history = function()
local file = vim.api.nvim_buf_get_name(0) local file = vim.api.nvim_buf_get_name(0)
@ -28,8 +27,8 @@ function M.config()
cmd = cmd, cmd = cmd,
dimensions = { dimensions = {
height = 0.9, height = 0.9,
width = 0.9 width = 0.9,
} },
}) })
end end

View file

@ -40,6 +40,6 @@ return {
-- Text object -- Text object
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'Inner git hunk' }) map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'Inner git hunk' })
end end,
} },
} }

View file

@ -1,6 +1,6 @@
local function formatting_filter(c) local function formatting_filter(c)
local bl = { local bl = {
'phpactor' 'phpactor',
} }
for _, name in ipairs(bl) do for _, name in ipairs(bl) do
if c.name == name then if c.name == name then
@ -39,10 +39,10 @@ local function on_attach(args) -- {{{
if client.server_capabilities.codeLensProvider then if client.server_capabilities.codeLensProvider then
vim.api.nvim_create_autocmd( vim.api.nvim_create_autocmd(
{ 'BufEnter', 'CursorHold', 'InsertLeave', }, { { 'BufEnter', 'CursorHold', 'InsertLeave' }, {
callback = vim.lsp.codelens.refresh, callback = vim.lsp.codelens.refresh,
buffer = bufnr, buffer = bufnr,
}) })
end end
vim.keymap.set('n', '<leader>cl', vim.lsp.codelens.run, mkOpts('LSP Run code lens')) vim.keymap.set('n', '<leader>cl', vim.lsp.codelens.run, mkOpts('LSP Run code lens'))
vim.keymap.set('n', '<leader>ci', vim.lsp.buf.implementation, mkOpts('LSP implementation')) vim.keymap.set('n', '<leader>ci', vim.lsp.buf.implementation, mkOpts('LSP implementation'))
@ -57,8 +57,8 @@ local function on_attach(args) -- {{{
vim.keymap.set('n', '<leader>cr', '<Cmd>Trouble lsp_references<CR>', mkOpts('LSP references')) vim.keymap.set('n', '<leader>cr', '<Cmd>Trouble lsp_references<CR>', mkOpts('LSP references'))
vim.keymap.set( vim.keymap.set(
{ 'v', 'n' }, '<leader>F', function() { 'v', 'n' }, '<leader>F', function()
vim.lsp.buf.format({ async = true, filter = formatting_filter, }) vim.lsp.buf.format({ async = true, filter = formatting_filter })
end, end,
mkOpts('Lsp Format') mkOpts('Lsp Format')
) )
@ -70,71 +70,71 @@ local function on_attach(args) -- {{{
client.server_capabilities.semanticTokensProvider.legend = { client.server_capabilities.semanticTokensProvider.legend = {
tokenModifiers = { 'static' }, tokenModifiers = { 'static' },
tokenTypes = { tokenTypes = {
'comment', -- "comment", 'comment', -- "comment",
'comment', -- "excluded_code", 'comment', -- "excluded_code",
'identifier', -- "identifier", 'identifier', -- "identifier",
'keyword', -- "keyword", 'keyword', -- "keyword",
'keyword', -- "keyword_control", 'keyword', -- "keyword_control",
'number', -- "number", 'number', -- "number",
'operator', -- "operator", 'operator', -- "operator",
'operator', -- "operator_overloaded", 'operator', -- "operator_overloaded",
'preproc', -- "preprocessor_keyword", 'preproc', -- "preprocessor_keyword",
'string', -- "string", 'string', -- "string",
'whitespace', -- "whitespace", 'whitespace', -- "whitespace",
'text', -- "text", 'text', -- "text",
'static', -- "static_symbol", 'static', -- "static_symbol",
'preproc', -- "preprocessor_text", 'preproc', -- "preprocessor_text",
'punctuation', -- "punctuation", 'punctuation', -- "punctuation",
'string.escape', -- "string_verbatim", 'string.escape', -- "string_verbatim",
'character.special', -- "string_escape_character", 'character.special', -- "string_escape_character",
'class', -- "class_name", 'class', -- "class_name",
'type', -- "delegate_name", 'type', -- "delegate_name",
'enum', -- "enum_name", 'enum', -- "enum_name",
'interface', -- "interface_name", 'interface', -- "interface_name",
'namespace', -- "module_name", 'namespace', -- "module_name",
'struct', -- "struct_name", 'struct', -- "struct_name",
'typeParameter', -- "type_parameter_name", 'typeParameter', -- "type_parameter_name",
'field', -- "field_name", 'field', -- "field_name",
'enumMember', -- "enum_member_name", 'enumMember', -- "enum_member_name",
'constant', -- "constant_name", 'constant', -- "constant_name",
'variable', -- "local_name", 'variable', -- "local_name",
'parameter', -- "parameter_name", 'parameter', -- "parameter_name",
'method', -- "method_name", 'method', -- "method_name",
'method', -- "extension_method_name", 'method', -- "extension_method_name",
'property', -- "property_name", 'property', -- "property_name",
'event', -- "event_name", 'event', -- "event_name",
'namespace', -- "namespace_name", 'namespace', -- "namespace_name",
'label', -- "label_name", 'label', -- "label_name",
'text.literal', -- "xml_doc_comment_attribute_name", 'text.literal', -- "xml_doc_comment_attribute_name",
'text.literal', -- "xml_doc_comment_attribute_quotes", 'text.literal', -- "xml_doc_comment_attribute_quotes",
'text.literal', -- "xml_doc_comment_attribute_value", 'text.literal', -- "xml_doc_comment_attribute_value",
'text.literal', -- "xml_doc_comment_cdata_section", 'text.literal', -- "xml_doc_comment_cdata_section",
'text.literal', -- "xml_doc_comment_comment", 'text.literal', -- "xml_doc_comment_comment",
'text.literal', -- "xml_doc_comment_delimiter", 'text.literal', -- "xml_doc_comment_delimiter",
'text.literal', -- "xml_doc_comment_entity_reference", 'text.literal', -- "xml_doc_comment_entity_reference",
'text.literal', -- "xml_doc_comment_name", 'text.literal', -- "xml_doc_comment_name",
'text.literal', -- "xml_doc_comment_processing_instruction", 'text.literal', -- "xml_doc_comment_processing_instruction",
'text.literal', -- "xml_doc_comment_text", 'text.literal', -- "xml_doc_comment_text",
'text.literal', -- "xml_literal_attribute_name", 'text.literal', -- "xml_literal_attribute_name",
'text.literal', -- "xml_literal_attribute_quotes", 'text.literal', -- "xml_literal_attribute_quotes",
'text.literal', -- "xml_literal_attribute_value", 'text.literal', -- "xml_literal_attribute_value",
'text.literal', -- "xml_literal_cdata_section", 'text.literal', -- "xml_literal_cdata_section",
'text.literal', -- "xml_literal_comment", 'text.literal', -- "xml_literal_comment",
'text.literal', -- "xml_literal_delimiter", 'text.literal', -- "xml_literal_delimiter",
'text.literal', -- "xml_literal_embedded_expression", 'text.literal', -- "xml_literal_embedded_expression",
'text.literal', -- "xml_literal_entity_reference", 'text.literal', -- "xml_literal_entity_reference",
'text.literal', -- "xml_literal_name", 'text.literal', -- "xml_literal_name",
'text.literal', -- "xml_literal_processing_instruction", 'text.literal', -- "xml_literal_processing_instruction",
'text.literal', -- "xml_literal_text", 'text.literal', -- "xml_literal_text",
'regexp', -- "regex_comment", 'regexp', -- "regex_comment",
'regexp', -- "regex_character_class", 'regexp', -- "regex_character_class",
'regexp', -- "regex_anchor", 'regexp', -- "regex_anchor",
'regexp', -- "regex_quantifier", 'regexp', -- "regex_quantifier",
'regexp', -- "regex_grouping", 'regexp', -- "regex_grouping",
'regexp', -- "regex_alternation", 'regexp', -- "regex_alternation",
'regexp', -- "regex_text", 'regexp', -- "regex_text",
'regexp', -- "regex_self_escaped_character", 'regexp', -- "regex_self_escaped_character",
'regexp' -- "regex_other_escape", 'regexp' -- "regex_other_escape",
}, },
} }
end end
@ -193,20 +193,20 @@ local function config()
vim.lsp.diagnostic.on_publish_diagnostics, { vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = { virtual_text = {
severity = vim.diagnostic.severity.ERROR, 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)
return not string.find(path, '/vendor/') and ( return not string.find(path, '/vendor/') and (
u.path.exists(u.path.join(path, 'composer.json')) u.path.exists(u.path.join(path, 'composer.json'))
or u.path.exists(u.path.join(path, 'sharedLibs')) or u.path.exists(u.path.join(path, 'sharedLibs'))
or u.path.exists(u.path.join(path, '.git')) or u.path.exists(u.path.join(path, '.git'))
) )
end) end)
end end,
}, -- }}} }, -- }}}
yamlls = { -- {{{ yamlls = { -- {{{
settings = { settings = {
@ -230,7 +230,7 @@ local function config()
versions = { versions = {
['3.1'] = 'https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json', ['3.1'] = 'https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json',
['3.0'] = 'https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json', ['3.0'] = 'https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json',
} },
}, },
}, },
}, },
@ -250,18 +250,18 @@ return {
{ {
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
dependencies = { dependencies = {
{ 'j-hui/fidget.nvim', config = true }, { 'j-hui/fidget.nvim', config = true },
{ 'ray-x/lsp_signature.nvim', opts = { hint_prefix = '', floating_window = false, hint_scheme = 'Identifier' } }, { 'ray-x/lsp_signature.nvim', opts = { hint_prefix = '', floating_window = false, hint_scheme = 'Identifier' } },
}, },
keys = { keys = {
{ '<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', event = 'BufRead',
config = config, 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 } { 'folke/neodev.nvim', lazy = true },
} }

View file

@ -15,7 +15,7 @@ function M.config()
theme = vim.env.TERM ~= 'linux' and 'gruvbox' or nil, theme = vim.env.TERM ~= 'linux' and 'gruvbox' or nil,
component_separators = { '', '' }, component_separators = { '', '' },
section_separators = { '', '' }, section_separators = { '', '' },
disabled_filetypes = {} disabled_filetypes = {},
}, },
sections = { sections = {
lualine_a = { 'mode' }, lualine_a = { 'mode' },
@ -23,7 +23,7 @@ function M.config()
lualine_c = { { 'filename', path = 1 } }, lualine_c = { { 'filename', path = 1 } },
lualine_x = { 'encoding', 'fileformat', 'filetype' }, lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' }, lualine_y = { 'progress' },
lualine_z = { 'location' } lualine_z = { 'location' },
}, },
inactive_sections = { inactive_sections = {
lualine_a = {}, lualine_a = {},
@ -31,16 +31,16 @@ function M.config()
lualine_c = { { 'filename', path = 1 } }, lualine_c = { { 'filename', path = 1 } },
lualine_x = { 'encoding', 'fileformat', 'filetype' }, lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' }, lualine_y = { 'progress' },
lualine_z = { 'location' } lualine_z = { 'location' },
}, },
tabline = {}, tabline = {},
winbar = { winbar = {
lualine_b = { { 'filename', path = 1 }, }, lualine_b = { { 'filename', path = 1 } },
lualine_c = { { navic.get_location, cond = navic.is_available } }, lualine_c = { { navic.get_location, cond = navic.is_available } },
lualine_y = { { 'require("lsp_signature").status_line(100).label' }, 'filetype' }, lualine_y = { { 'require("lsp_signature").status_line(100).label' }, 'filetype' },
}, },
inactive_winbar = {}, inactive_winbar = {},
extensions = { 'neo-tree' } extensions = { 'neo-tree' },
} }
end end

View file

@ -15,8 +15,8 @@ return {
end, end,
expr = true, remap = true, silent = true, mode = 'i', expr = true, remap = true, silent = true, mode = 'i',
}, },
{ '<tab>', function() require('luasnip').jump(1) end, mode = 's' }, { '<tab>', function() require('luasnip').jump(1) end, mode = 's' },
{ '<s-tab>', function() require('luasnip').jump(-1) end, mode = { 'i', 's' } }, { '<s-tab>', function() require('luasnip').jump( -1) end, mode = { 'i', 's' } },
-- { '<C-E>', -- { '<C-E>',
-- function() return require('luasnip').choice_active() and '<Plug>luasnip-next-choice' or '<C-E>' end, -- function() return require('luasnip').choice_active() and '<Plug>luasnip-next-choice' or '<C-E>' end,
-- mode = 'i', remap = true, expr = true, -- mode = 'i', remap = true, expr = true,

View file

@ -9,8 +9,8 @@ return {
{ 'lukas-reineke/indent-blankline.nvim', config = true, opts = { { 'lukas-reineke/indent-blankline.nvim', config = true, opts = {
show_current_context = true, show_current_context = true,
show_current_context_start = false, show_current_context_start = false,
} }, }, },
{ 'echasnovski/mini.trailspace', version = '*', config = function() require('mini.trailspace').setup({}) end }, { 'echasnovski/mini.trailspace', version = '*', config = function() require('mini.trailspace').setup({}) end },
-- stolen from LazyVim -- stolen from LazyVim
{ {
@ -19,12 +19,12 @@ return {
init = function() init = function()
---@diagnostic disable-next-line: duplicate-set-field ---@diagnostic disable-next-line: duplicate-set-field
vim.ui.select = function(...) vim.ui.select = function(...)
require('lazy').load({ plugins = { 'dressing.nvim', }, }) require('lazy').load({ plugins = { 'dressing.nvim' } })
return vim.ui.select(...) return vim.ui.select(...)
end end
---@diagnostic disable-next-line: duplicate-set-field ---@diagnostic disable-next-line: duplicate-set-field
vim.ui.input = function(...) vim.ui.input = function(...)
require('lazy').load({ plugins = { 'dressing.nvim', }, }) require('lazy').load({ plugins = { 'dressing.nvim' } })
return vim.ui.input(...) return vim.ui.input(...)
end end
end, end,
@ -78,7 +78,7 @@ return {
event = 'BufRead', event = 'BufRead',
config = function() config = function()
vim.g.matchup_matchparen_offscreen = {} vim.g.matchup_matchparen_offscreen = {}
end }, end, },
{ {
'echasnovski/mini.surround', 'echasnovski/mini.surround',
@ -86,7 +86,7 @@ return {
event = 'BufEnter', event = 'BufEnter',
config = function() config = function()
require('mini.surround').setup({}) require('mini.surround').setup({})
end end,
}, },
{ 'echasnovski/mini.statusline', { 'echasnovski/mini.statusline',
@ -98,8 +98,8 @@ return {
end, end,
}, },
{ 'fpob/nette.vim', ft = 'nette', }, { 'fpob/nette.vim', ft = 'nette' },
{ 'ziglang/zig.vim', ft = 'zig', }, { 'ziglang/zig.vim', ft = 'zig' },
{ {
'mfussenegger/nvim-jdtls', 'mfussenegger/nvim-jdtls',
@ -108,12 +108,12 @@ return {
{ {
'folke/trouble.nvim', 'folke/trouble.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons', }, dependencies = { 'nvim-tree/nvim-web-devicons' },
lazy = true, lazy = true,
cmd = { 'Trouble', 'TroubleToggle', }, cmd = { 'Trouble', 'TroubleToggle' },
keys = { keys = {
{ '<Leader>tt', '<Cmd>TroubleToggle<CR>', desc = 'Trouble toggle', }, { '<Leader>tt', '<Cmd>TroubleToggle<CR>', desc = 'Trouble toggle' },
{ '<Leader>td', '<Cmd>Trouble document_diagnostics<CR>', desc = 'Trouble toggle', }, { '<Leader>td', '<Cmd>Trouble document_diagnostics<CR>', desc = 'Trouble toggle' },
}, },
config = { config = {
mode = 'document_diagnostics', mode = 'document_diagnostics',

View file

@ -3,9 +3,9 @@ local M = {
branch = 'v2.x', branch = 'v2.x',
lazy = false, lazy = false,
keys = { keys = {
{ '<Space>ft', [[<Cmd>Neotree toggle<CR>]], desc = 'Toggle Neotree' }, { '<Space>ft', [[<Cmd>Neotree toggle<CR>]], desc = 'Toggle Neotree' },
{ '<Space>fr', [[<Cmd>Neotree reveal<CR>]], desc = 'Reveal current file in Neotree' }, { '<Space>fr', [[<Cmd>Neotree reveal<CR>]], desc = 'Reveal current file in Neotree' },
{ '<Space>gt', [[<Cmd>Neotree git_status<CR>]], desc = 'Neotree git status (Git Tree)' } { '<Space>gt', [[<Cmd>Neotree git_status<CR>]], desc = 'Neotree git status (Git Tree)' },
}, },
cmd = 'Neotree', cmd = 'Neotree',
dependencies = { dependencies = {
@ -35,14 +35,14 @@ function M.config()
event_handlers = { event_handlers = {
{ {
event = 'neo_tree_window_after_open', event = 'neo_tree_window_after_open',
handler = function (ev) handler = function(ev)
vim.api.nvim_win_set_option(ev.winid, 'statusline', ' %{fnamemodify(getcwd(),":~")}') vim.api.nvim_win_set_option(ev.winid, 'statusline', ' %{fnamemodify(getcwd(),":~")}')
end end,
} },
}, },
default_component_configs = { default_component_configs = {
container = { container = {
enable_character_fade = true enable_character_fade = true,
}, },
indent = { indent = {
indent_size = 2, indent_size = 2,
@ -89,7 +89,7 @@ function M.config()
unstaged = '', unstaged = '',
staged = '', staged = '',
conflict = '', conflict = '',
} },
}, },
}, },
window = { window = {
@ -125,7 +125,7 @@ function M.config()
-- some commands may take optional config options, see `:h neo-tree-mappings` for details -- some commands may take optional config options, see `:h neo-tree-mappings` for details
config = { config = {
show_path = 'none' -- "none", "relative", "absolute" show_path = 'none' -- "none", "relative", "absolute"
} },
}, },
['A'] = 'add_directory', -- also accepts the optional config.show_path option like "add". ['A'] = 'add_directory', -- also accepts the optional config.show_path option like "add".
['d'] = 'delete', ['d'] = 'delete',
@ -146,7 +146,7 @@ function M.config()
['?'] = 'show_help', ['?'] = 'show_help',
['<'] = 'prev_source', ['<'] = 'prev_source',
['>'] = 'next_source', ['>'] = 'next_source',
} },
}, },
nesting_rules = {}, nesting_rules = {},
filesystem = { filesystem = {
@ -195,8 +195,8 @@ function M.config()
['<c-x>'] = 'clear_filter', ['<c-x>'] = 'clear_filter',
['[g'] = 'prev_git_modified', ['[g'] = 'prev_git_modified',
[']g'] = 'next_git_modified', [']g'] = 'next_git_modified',
} },
} },
}, },
buffers = { buffers = {
follow_current_file = true, -- This will find and focus the file in the active buffer every follow_current_file = true, -- This will find and focus the file in the active buffer every
@ -208,7 +208,7 @@ function M.config()
['bd'] = 'buffer_delete', ['bd'] = 'buffer_delete',
['<bs>'] = 'navigate_up', ['<bs>'] = 'navigate_up',
['.'] = 'set_root', ['.'] = 'set_root',
} },
}, },
}, },
git_status = { git_status = {
@ -222,11 +222,10 @@ function M.config()
['gc'] = 'git_commit', ['gc'] = 'git_commit',
['gp'] = 'git_push', ['gp'] = 'git_push',
['gg'] = 'git_commit_and_push', ['gg'] = 'git_commit_and_push',
} },
} },
} },
}) })
end end
return M return M

View file

@ -37,17 +37,17 @@ function M.config()
-- documentation = cmp.config.window.bordered(), -- documentation = cmp.config.window.bordered(),
}, },
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4), ['<C-b>'] = cmp.mapping.scroll_docs( -4),
['<C-f>'] = cmp.mapping.scroll_docs(4), ['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete({}), ['<C-Space>'] = cmp.mapping.complete({}),
['<C-e>'] = cmp.mapping.abort(), ['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = false }) ['<CR>'] = cmp.mapping.confirm({ select = false }),
}), }),
snippet = { snippet = {
expand = function(args) expand = function(args)
require('luasnip').lsp_expand(args.body) require('luasnip').lsp_expand(args.body)
end end,
} },
}) })
-- --
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).

View file

@ -5,19 +5,19 @@ local M = {
{ {
'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' },
keys = { keys = {
{ '<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>T', [[<Cmd>Telescope<CR>]], desc = 'Telescope' },
{ '<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>Tr', [[<Cmd>Telescope resume<CR>]], desc = 'Telescope resume' },
} },
} }
function M.config() function M.config()
@ -28,7 +28,7 @@ function M.config()
telescope.setup { telescope.setup {
defaults = { defaults = {
preview = { preview = {
hide_on_startup = true hide_on_startup = true,
}, },
mappings = { mappings = {
i = { i = {
@ -36,8 +36,8 @@ function M.config()
}, },
n = { n = {
['<M-i>'] = layout_actions.toggle_preview, ['<M-i>'] = layout_actions.toggle_preview,
} },
} },
}, },
pickers = { pickers = {
buffers = { buffers = {
@ -51,9 +51,9 @@ function M.config()
}, },
n = { n = {
['<C-d>'] = actions.delete_buffer, ['<C-d>'] = actions.delete_buffer,
} },
} },
} },
}, },
} }
@ -72,9 +72,8 @@ function M.config()
imap <buffer> <C-a> <Cmd>Telescope builtin 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> nmap <buffer> <C-a> <Cmd>Telescope builtin initial_mode=insert<CR>
]], false) ]], false)
end end,
}) })
end end
return M return M

View file

@ -3,7 +3,7 @@ local M = {
dependencies = { dependencies = {
'nvim-treesitter/playground', 'nvim-treesitter/playground',
'nvim-treesitter/nvim-treesitter-textobjects', 'nvim-treesitter/nvim-treesitter-textobjects',
{ 'yioneko/nvim-yati', tag = 'legacy' } { 'yioneko/nvim-yati', tag = 'legacy' },
-- { dir = '/home/sogun/devel/nvim-yati/', } -- { dir = '/home/sogun/devel/nvim-yati/', }
}, },
event = 'BufRead', event = 'BufRead',
@ -17,8 +17,8 @@ function M.config()
enable = true, enable = true,
disable = { 'help' }, disable = { 'help' },
}, },
playground = { enable = true, }, playground = { enable = true },
yati = { enable = true, }, yati = { enable = true },
incremental_selection = { incremental_selection = {
enable = true, enable = true,
keymaps = { keymaps = {
@ -80,7 +80,7 @@ function M.config()
-- and should return true of false -- and should return true of false
include_surrounding_whitespace = true, include_surrounding_whitespace = true,
}, },
} },
} }
local ts_parsers = require 'nvim-treesitter.parsers'.get_parser_configs() local ts_parsers = require 'nvim-treesitter.parsers'.get_parser_configs()
@ -95,7 +95,6 @@ function M.config()
}, },
filetype = 'xml', -- if filetype does not match the parser name filetype = 'xml', -- if filetype does not match the parser name
} }
end end
return M return M

View file

@ -3,12 +3,12 @@ return {
config = function() config = function()
local wk = require('which-key') local wk = require('which-key')
wk.register({ wk.register({
['<Space>f'] = { name = "+file"}, ['<Space>f'] = { name = '+file' },
['<Space>g'] = { name = "+git"}, ['<Space>g'] = { name = '+git' },
['<Space>l'] = { name = "+LSP"}, ['<Space>l'] = { name = '+LSP' },
['<Space>t'] = { name = "+Trouble"}, ['<Space>t'] = { name = '+Trouble' },
['<Space>c'] = { name = "+Code"}, ['<Space>c'] = { name = '+Code' },
['<Space>cc'] = { name = "+calls"}, ['<Space>cc'] = { name = '+calls' },
}) })
end, end,
} }