From 18dfa001be3794ff6544a8088795fd7f73f11568 Mon Sep 17 00:00:00 2001 From: Darius Auding <Darius.auding@gmx.de> Date: Sun, 28 May 2023 15:08:20 +0200 Subject: [PATCH] Add stylua lua formatter --- init.lua | 54 +++--- lua/codecraft/core/colorschemeconfig.lua | 230 +++++++++++------------ lua/codecraft/plugin/lsp/null-ls.lua | 2 + 3 files changed, 144 insertions(+), 142 deletions(-) diff --git a/init.lua b/init.lua index 87c3acf..b97237e 100644 --- a/init.lua +++ b/init.lua @@ -1,39 +1,39 @@ --- leader -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' +-- leader +vim.g.mapleader = " " +vim.g.maplocalleader = " " -- load locale -require('codecraft.vimlocale') +require("codecraft.vimlocale") -- load plugins -require('codecraft.plugin-setup') +require("codecraft.plugin-setup") -- core codecrafturation -require('codecraft.core.options') -require('codecraft.core.keymaps') -require('codecraft.core.colorschemeconfig') -require('codecraft.core.colorscheme') +require("codecraft.core.options") +require("codecraft.core.keymaps") +require("codecraft.core.colorschemeconfig") +require("codecraft.core.colorscheme") -- plugin codecrafturation -require('codecraft.plugin.bufferline') -require('codecraft.plugin.nvimtree') -require('codecraft.plugin.gitsigns') -require('codecraft.plugin.lualine') -require('codecraft.plugin.telescope') -require('codecraft.plugin.treesitter') -require('codecraft.plugin.indent-comments') -require('codecraft.plugin.neodev') -require('codecraft.plugin.tmux-nvim-navigation') -require('codecraft.plugin.projects') +require("codecraft.plugin.bufferline") +require("codecraft.plugin.nvimtree") +require("codecraft.plugin.gitsigns") +require("codecraft.plugin.lualine") +require("codecraft.plugin.telescope") +require("codecraft.plugin.treesitter") +require("codecraft.plugin.indent-comments") +require("codecraft.plugin.neodev") +require("codecraft.plugin.tmux-nvim-navigation") +require("codecraft.plugin.projects") -- LSP -require('codecraft.plugin.lsp.navic') -require('codecraft.plugin.lsp.lsp') -require('codecraft.plugin.lsp.completion') -require('codecraft.plugin.lsp.null-ls') -require('codecraft.plugin.lsp.rust-tools') +require("codecraft.plugin.lsp.navic") +require("codecraft.plugin.lsp.lsp") +require("codecraft.plugin.lsp.completion") +require("codecraft.plugin.lsp.null-ls") +require("codecraft.plugin.lsp.rust-tools") -- DAP -require('codecraft.plugin.dap.dap') -require('codecraft.plugin.dap.virtual-text') -require('codecraft.plugin.dap.dapui') +require("codecraft.plugin.dap.dap") +require("codecraft.plugin.dap.virtual-text") +require("codecraft.plugin.dap.dapui") diff --git a/lua/codecraft/core/colorschemeconfig.lua b/lua/codecraft/core/colorschemeconfig.lua index 795514f..8d2d2a2 100644 --- a/lua/codecraft/core/colorschemeconfig.lua +++ b/lua/codecraft/core/colorschemeconfig.lua @@ -1,128 +1,128 @@ -- ONEDARK -require('onedark').setup { - -- Main options -- - style = 'dark', -- Default theme style. Choose between 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer' and 'light' - transparent = true, -- Show/hide background - term_colors = false, -- Change terminal color as per the selected theme style - ending_tildes = false, -- Show the end-of-buffer tildes. By default they are hidden - cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu +require("onedark").setup({ + -- Main options -- + style = "dark", -- Default theme style. Choose between 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer' and 'light' + transparent = true, -- Show/hide background + term_colors = false, -- Change terminal color as per the selected theme style + ending_tildes = false, -- Show the end-of-buffer tildes. By default they are hidden + cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu - -- toggle theme style --- - toggle_style_key = nil, -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "<leader>ts" - toggle_style_list = { 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer', 'light' }, -- List of styles to toggle between + -- toggle theme style --- + toggle_style_key = nil, -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "<leader>ts" + toggle_style_list = { "dark", "darker", "cool", "deep", "warm", "warmer", "light" }, -- List of styles to toggle between - -- Change code style --- - -- Options are italic, bold, underline, none - -- You can configure multiple style with comma seperated, For e.g., keywords = 'italic,bold' - code_style = { - comments = 'italic', - keywords = 'none', - functions = 'none', - strings = 'none', - variables = 'none' - }, + -- Change code style --- + -- Options are italic, bold, underline, none + -- You can configure multiple style with comma seperated, For e.g., keywords = 'italic,bold' + code_style = { + comments = "italic", + keywords = "none", + functions = "none", + strings = "none", + variables = "none", + }, - -- Lualine options -- - lualine = { - transparent = true, -- lualine center bar transparency - }, + -- Lualine options -- + lualine = { + transparent = true, -- lualine center bar transparency + }, - -- Custom Highlights -- - colors = {}, -- Override default colors - highlights = {}, -- Override highlight groups + -- Custom Highlights -- + colors = {}, -- Override default colors + highlights = {}, -- Override highlight groups - -- Plugins Config -- - diagnostics = { - darker = true, -- darker colors for diagnostic - undercurl = true, -- use undercurl instead of underline for diagnostics - background = false, -- use background color for virtual text - }, -} + -- Plugins Config -- + diagnostics = { + darker = true, -- darker colors for diagnostic + undercurl = true, -- use undercurl instead of underline for diagnostics + background = false, -- use background color for virtual text + }, +}) -- CATPUCCIN require("catppuccin").setup({ - flavour = "mocha", -- latte, frappe, macchiato, mocha - background = { -- :h background - light = "latte", - dark = "mocha", - }, - transparent_background = true, - show_end_of_buffer = false, -- show the '~' characters after the end of buffers - term_colors = false, - dim_inactive = { - enabled = false, - shade = "dark", - percentage = 0.15, - }, - no_italic = false, -- Force no italic - no_bold = false, -- Force no bold - styles = { - comments = { "italic" }, - conditionals = { "italic" }, - loops = {}, - functions = {}, - keywords = {}, - strings = {}, - variables = {}, - numbers = {}, - booleans = {}, - properties = {}, - types = {}, - operators = {}, - }, - color_overrides = {}, - custom_highlights = {}, - integrations = { - cmp = true, - gitsigns = true, - nvimtree = true, - telescope = true, - notify = false, - mini = false, - -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) - }, + flavour = "mocha", -- latte, frappe, macchiato, mocha + background = { -- :h background + light = "latte", + dark = "mocha", + }, + transparent_background = true, + show_end_of_buffer = false, -- show the '~' characters after the end of buffers + term_colors = false, + dim_inactive = { + enabled = false, + shade = "dark", + percentage = 0.15, + }, + no_italic = false, -- Force no italic + no_bold = false, -- Force no bold + styles = { + comments = { "italic" }, + conditionals = { "italic" }, + loops = {}, + functions = {}, + keywords = {}, + strings = {}, + variables = {}, + numbers = {}, + booleans = {}, + properties = {}, + types = {}, + operators = {}, + }, + color_overrides = {}, + custom_highlights = {}, + integrations = { + cmp = true, + gitsigns = true, + nvimtree = true, + telescope = true, + notify = false, + mini = false, + -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) + }, }) -- DRACULA -require('dracula').setup({ - -- customize dracula color palette - colors = { - bg = "#282A36", - fg = "#F8F8F2", - selection = "#44475A", - comment = "#6272A4", - red = "#FF5555", - orange = "#FFB86C", - yellow = "#F1FA8C", - green = "#50fa7b", - purple = "#BD93F9", - cyan = "#8BE9FD", - pink = "#FF79C6", - bright_red = "#FF6E6E", - bright_green = "#69FF94", - bright_yellow = "#FFFFA5", - bright_blue = "#D6ACFF", - bright_magenta = "#FF92DF", - bright_cyan = "#A4FFFF", - bright_white = "#FFFFFF", - menu = "#21222C", - visual = "#3E4452", - gutter_fg = "#4B5263", - nontext = "#3B4048", - }, - -- show the '~' characters after the end of buffers - show_end_of_buffer = false, -- default false - -- use transparent background - transparent_bg = true, -- default false - -- set custom lualine background color - lualine_bg_color = nil, -- default nil - -- set italic comment - italic_comment = true, -- default false - -- overrides the default highlights see `:h synIDattr` - overrides = { - -- Examples - -- NonText = { fg = dracula.colors().white }, -- set NonText fg to white - -- NvimTreeIndentMarker = { link = "NonText" }, -- link to NonText highlight - -- Nothing = {} -- clear highlight of Nothing - }, +require("dracula").setup({ + -- customize dracula color palette + colors = { + bg = "#282A36", + fg = "#F8F8F2", + selection = "#44475A", + comment = "#6272A4", + red = "#FF5555", + orange = "#FFB86C", + yellow = "#F1FA8C", + green = "#50fa7b", + purple = "#BD93F9", + cyan = "#8BE9FD", + pink = "#FF79C6", + bright_red = "#FF6E6E", + bright_green = "#69FF94", + bright_yellow = "#FFFFA5", + bright_blue = "#D6ACFF", + bright_magenta = "#FF92DF", + bright_cyan = "#A4FFFF", + bright_white = "#FFFFFF", + menu = "#21222C", + visual = "#3E4452", + gutter_fg = "#4B5263", + nontext = "#3B4048", + }, + -- show the '~' characters after the end of buffers + show_end_of_buffer = false, -- default false + -- use transparent background + transparent_bg = true, -- default false + -- set custom lualine background color + lualine_bg_color = nil, -- default nil + -- set italic comment + italic_comment = true, -- default false + -- overrides the default highlights see `:h synIDattr` + overrides = { + -- Examples + -- NonText = { fg = dracula.colors().white }, -- set NonText fg to white + -- NvimTreeIndentMarker = { link = "NonText" }, -- link to NonText highlight + -- Nothing = {} -- clear highlight of Nothing + }, }) diff --git a/lua/codecraft/plugin/lsp/null-ls.lua b/lua/codecraft/plugin/lsp/null-ls.lua index 431b76c..0ef3680 100644 --- a/lua/codecraft/plugin/lsp/null-ls.lua +++ b/lua/codecraft/plugin/lsp/null-ls.lua @@ -10,6 +10,7 @@ local formatters_linters = { prettier = {}, rustfmt = {}, black = {}, + stylua = {}, } mason_null_ls.setup({ @@ -20,6 +21,7 @@ null_ls.setup ({ formatting.prettier, formatting.rustfmt, formatting.black, + formatting.stylua, }, on_attach = function(current_client, bufnr) if current_client.supports_method("textDocument/formatting") then -- GitLab