Use stylua

This commit is contained in:
Jiří Štefka 2023-03-14 19:02:50 +01:00
parent 84bf31cb41
commit a8b3645148

116
init.lua

@ -65,7 +65,7 @@ local config = {
-- Tlist_Close_On_Select = 1, -- Tlist_Close_On_Select = 1,
-- MarkdownPreview -- MarkdownPreview
mkdp_auto_close = 0 mkdp_auto_close = 0,
}, },
}, },
-- If you need more control, you can use the function()...end notation -- If you need more control, you can use the function()...end notation
@ -155,8 +155,10 @@ local config = {
mappings = { mappings = {
-- first key is the mode -- first key is the mode
n = { n = {
["<leader>fT"] = { function() require("telescope.builtin").colorscheme { enable_preview = true } end, desc = ["<leader>fT"] = {
"Find themes" }, function() require("telescope.builtin").colorscheme { enable_preview = true } end,
desc = "Find themes",
},
-- second key is the lefthand side of the map -- second key is the lefthand side of the map
-- mappings seen under group name "Buffer" -- mappings seen under group name "Buffer"
["<leader>bb"] = { "<cmd>tabnew<cr>", desc = "New tab" }, ["<leader>bb"] = { "<cmd>tabnew<cr>", desc = "New tab" },
@ -182,39 +184,21 @@ local config = {
["<leader>d"] = { name = "Debugger" }, ["<leader>d"] = { name = "Debugger" },
["<leader>dl"] = { name = "Load launch.json" }, ["<leader>dl"] = { name = "Load launch.json" },
-- Config loading -- Config loading
["<leader>dlc"] = { function() require("dap.ext.vscode").load_launchjs(nil, { cppdbg = { "c", "cpp", "asm" } }) end, desc = ["<leader>dlc"] = {
"C/C++/asm" }, function() require("dap.ext.vscode").load_launchjs(nil, { cppdbg = { "c", "cpp", "asm" } }) end,
["<leader>dln"] = { function() require("dap.ext.vscode").load_launchjs(nil, { node2 = { "javascript", "javascriptreact", "typescriptreact", "typescript" }}) end, desc = desc = "C/C++/asm",
"Node" }, },
["<leader>dln"] = {
function()
require("dap.ext.vscode").load_launchjs(
nil,
{ node2 = { "javascript", "javascriptreact", "typescriptreact", "typescript" } }
)
end,
desc = "Node",
},
-- Load launch.json for all supported languages -- Load launch.json for all supported languages
["<leader>dla"] = { function() require("dap.ext.vscode").load_launchjs(nil, nil) end, desc = "All" }, ["<leader>dla"] = { function() require("dap.ext.vscode").load_launchjs(nil, nil) end, desc = "All" },
-- Function keys mappings
["<F5>"] = { function() require("dap").continue() end, desc = "Debugger: Start" },
["<F17>"] = { function() require("dap").terminate() end, desc = "Debugger: Stop" }, -- Shift+F5
["<F29>"] = { function() require("dap").restart_frame() end, desc = "Debugger: Restart" }, -- Control+F5
["<F6>"] = { function() require("dap").pause() end, desc = "Debugger: Pause" },
["<F9>"] = { function() require("dap").toggle_breakpoint() end, desc = "Debugger: Toggle Breakpoint" },
["<F10>"] = { function() require("dap").step_over() end, desc = "Debugger: Step Over" },
["<F11>"] = { function() require("dap").step_into() end, desc = "Debugger: Step Into" },
["<F23>"] = { function() require("dap").step_out() end, desc = "Debugger: Step Out" }, -- Shift+F11
-- Breakpoints
["<leader>db"] = { function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint (F9)" },
["<leader>dB"] = { function() require("dap").clear_breakpoints() end, desc = "Clear Breakpoints" },
-- Session actions
["<leader>dc"] = { function() require("dap").continue() end, desc = "Start/Continue (F5)" },
["<leader>dp"] = { function() require("dap").pause() end, desc = "Pause (F6)" },
["<leader>dr"] = { function() require("dap").restart_frame() end, desc = "Restart (C-F5)" },
["<leader>dq"] = { function() require("dap").close() end, desc = "Close Session" },
["<leader>dQ"] = { function() require("dap").terminate() end, desc = "Terminate Session (S-F5)" },
-- Step
["<leader>di"] = { function() require("dap").step_into() end, desc = "Step Into (F11)" },
["<leader>do"] = { function() require("dap").step_over() end, desc = "Step Over (F10)" },
["<leader>dO"] = { function() require("dap").step_out() end, desc = "Step Out (S-F11)" },
-- Repls (debugger)
["<leader>dR"] = { function() require("dap").repl.toggle() end, desc = "Toggle REPL" },
-- Dap-UI
["<leader>du"] = { function() require("dapui").toggle() end, desc = "Toggle Debugger UI" },
["<leader>dh"] = { function() require("dap.ui.widgets").hover() end, desc = "Debugger Hover" },
-- Mardown preview -- Mardown preview
["<leader>m"] = { name = "Markdown" }, ["<leader>m"] = { name = "Markdown" },
["<leader>mp"] = { "<cmd>MarkdownPreview<cr>", desc = "Markdown preview" }, ["<leader>mp"] = { "<cmd>MarkdownPreview<cr>", desc = "Markdown preview" },
@ -293,7 +277,7 @@ local config = {
-- Theme -- Theme
{ {
"folke/tokyonight.nvim", "folke/tokyonight.nvim",
event = "UIEnter" event = "UIEnter",
}, },
-- You can disable default plugins as follows: -- You can disable default plugins as follows:
-- { "max397574/better-escape.nvim", enabled = false }, -- { "max397574/better-escape.nvim", enabled = false },
@ -353,7 +337,7 @@ local config = {
-- }, -- },
{ {
"dstein64/vim-startuptime", "dstein64/vim-startuptime",
cmd = "StartupTime" cmd = "StartupTime",
}, },
{ {
@ -367,10 +351,15 @@ local config = {
local luasnip = require "luasnip" local luasnip = require "luasnip"
-- modify the mapping part of the table -- modify the mapping part of the table
opts.mapping["<CR>"] = cmp.mapping.confirm { select = false } opts.mapping["<CR>"] = cmp.mapping.confirm { select = false }
opts.mapping["<Tab>"] = cmp.mapping(function(fallback) opts.mapping["<Tab>"] = cmp.mapping(
vim.api.nvim_feedkeys(vim.fn['copilot#Accept'](vim.api.nvim_replace_termcodes('<Tab>', true, true, true)), 'n', function(fallback)
true) vim.api.nvim_feedkeys(
end) vim.fn["copilot#Accept"](vim.api.nvim_replace_termcodes("<Tab>", true, true, true)),
"n",
true
)
end
)
if luasnip.expandable() then if luasnip.expandable() then
luasnip.expand() luasnip.expand()
elseif luasnip.expand_or_jumpable() then elseif luasnip.expand_or_jumpable() then
@ -378,7 +367,7 @@ local config = {
fallback() fallback()
end end
opts.experimental = { opts.experimental = {
ghost_text = false -- this feature conflict with copilot.vim's preview. ghost_text = false, -- this feature conflict with copilot.vim's preview.
} }
-- return the new table to be used -- return the new table to be used
return opts return opts
@ -388,7 +377,7 @@ local config = {
-- Editorconfig -- Editorconfig
{ {
"editorconfig/editorconfig-vim", "editorconfig/editorconfig-vim",
event = "User AstroFile" event = "User AstroFile",
}, },
-- You can also add new plugins here as well: -- You can also add new plugins here as well:
@ -397,13 +386,13 @@ local config = {
-- Plugins for other plugins -- Plugins for other plugins
{ {
"tyru/open-browser.vim", "tyru/open-browser.vim",
cmd = { "OPenBrowser", "OpenBrowserSearch", "OpenBrowserSmartSearch" } cmd = { "OPenBrowser", "OpenBrowserSearch", "OpenBrowserSmartSearch" },
}, },
--Social --Social
{ {
"andweeb/presence.nvim", "andweeb/presence.nvim",
event = "UIEnter" event = "UIEnter",
}, },
{ {
"ellisonleao/carbon-now.nvim", "ellisonleao/carbon-now.nvim",
@ -425,7 +414,7 @@ local config = {
width = "680", width = "680",
watermark = false, watermark = false,
}, },
} },
}, },
-- Comments -- Comments
@ -437,32 +426,32 @@ local config = {
{ {
"folke/trouble.nvim", "folke/trouble.nvim",
-- cmd = { "TroubleToggle", "TodoTrouble" } -- cmd = { "TroubleToggle", "TodoTrouble" }
cmd = "TroubleToggle" cmd = "TroubleToggle",
}, },
-- TOC (functions, macros, ...) -- TOC (functions, macros, ...)
{ {
"yegappan/taglist", "yegappan/taglist",
cmd = "TlistToggle" cmd = "TlistToggle",
}, },
-- Code completion -- Code completion
{ {
"github/copilot.vim", "github/copilot.vim",
event = "User AstroFile" event = "User AstroFile",
}, },
-- PlatformIO -- PlatformIO
{ {
"normen/vim-pio", "normen/vim-pio",
-- event = "BufEnter" -- event = "BufEnter"
cmd = { "PIO", "PIOInit", "PIOInstall", "PIOUninstall", "PIONewProject", "PIOAddLibrary", "PIORemoveLibrary" } cmd = { "PIO", "PIOInit", "PIOInstall", "PIOUninstall", "PIONewProject", "PIOAddLibrary", "PIORemoveLibrary" },
}, },
-- Text related -- Text related
{ {
-- LaTeX -- LaTeX
"lervag/vimtex", "lervag/vimtex",
event = "BufEnter *.tex" event = "BufEnter *.tex",
}, },
{ {
"iamcco/markdown-preview.nvim", "iamcco/markdown-preview.nvim",
@ -477,27 +466,36 @@ local config = {
}, },
{ {
"aklt/plantuml-syntax", "aklt/plantuml-syntax",
event = "BufEnter *.uml" event = "BufEnter *.uml",
}, },
-- Basic editor functionality -- Basic editor functionality
{ {
"Pocco81/auto-save.nvim", "Pocco81/auto-save.nvim",
event = "User AstroFile", event = "User AstroFile",
config = function() config = function() require("auto-save").setup() end,
require("auto-save").setup()
end,
}, },
-- Tasks.json -- Tasks.json
{ {
"stevearc/overseer.nvim", "stevearc/overseer.nvim",
cmd = { "OverseerOpen", "OverseerClose", "OverseerToggle", "OverseerSaveBundle", "OverseerLoadBundle", cmd = {
"OverseerDeleteBundle", "OverseerRunCmd", "OverseerRun", "OverseerInfo", "OverseerBuild", "OverseerQuickAction", "OverseerOpen",
"OverseerTaskAction ", "OverseerClearCache" }, "OverseerClose",
opts = {} "OverseerToggle",
"OverseerSaveBundle",
"OverseerLoadBundle",
"OverseerDeleteBundle",
"OverseerRunCmd",
"OverseerRun",
"OverseerInfo",
"OverseerBuild",
"OverseerQuickAction",
"OverseerTaskAction ",
"OverseerClearCache",
},
opts = {},
}, },
-- { -- {
-- "ray-x/lsp_signature.nvim", -- "ray-x/lsp_signature.nvim",