From 528bdae845b7611201184eb151e25bd264a4c8c3 Mon Sep 17 00:00:00 2001 From: baldeau Date: Fri, 20 Sep 2024 19:05:33 +0200 Subject: [PATCH] finally fix indentation on neovim so that it just works like on vscode --- lua/main/init.lua | 20 +++++++++----------- lua/plugins/colorizer.lua | 1 + lua/plugins/flutter.lua | 36 +++++++++++++++++++++++++++++++++++- lua/plugins/prettier.lua | 6 ++++++ lua/plugins/treesitter.lua | 7 +++++++ 5 files changed, 58 insertions(+), 12 deletions(-) diff --git a/lua/main/init.lua b/lua/main/init.lua index 0623412..956baa1 100644 --- a/lua/main/init.lua +++ b/lua/main/init.lua @@ -5,8 +5,15 @@ vim.g.moonflyTransparent = true -- set termguicolors, needed for the colorizer vim.opt.termguicolors = true -vim.opt["tabstop"] = 4 -vim.opt["shiftwidth"] = 4 +vim.opt["tabstop"] = 2 +vim.opt["shiftwidth"] = 2 +vim.opt["autoindent"] = false +vim.opt["smartindent"] = false +-- vim.opt["cindent"] = true +vim.opt["expandtab"] = true + +-- vim.opt["softtabstop"] = 4 +-- vim.opt["smarttab"] = true vim.wo.relativenumber = true @@ -34,14 +41,5 @@ vim.api.nvim_create_autocmd("BufWritePre", { end, }) -require("flutter-tools").setup({ - dev_log = { - enabled = true, - filter = nil, -- optional callback to filter the log - notify_errors = false, -- notify the user if the is an error whilst running - open_cmd = "tabedit", - }, -}) - -- activate exrc to allow to run per project custom configs from .nvim.lua vim.opt.exrc = true diff --git a/lua/plugins/colorizer.lua b/lua/plugins/colorizer.lua index 30a6904..2b2f507 100644 --- a/lua/plugins/colorizer.lua +++ b/lua/plugins/colorizer.lua @@ -2,6 +2,7 @@ return { "norcalli/nvim-colorizer.lua", opts = {}, config = function() + -- requires termguicolors vim.opt.termguicolors = true require("colorizer").setup() end, diff --git a/lua/plugins/flutter.lua b/lua/plugins/flutter.lua index f728d04..f5a055e 100644 --- a/lua/plugins/flutter.lua +++ b/lua/plugins/flutter.lua @@ -5,5 +5,39 @@ return { "nvim-lua/plenary.nvim", "stevearc/dressing.nvim", -- optional for vim.ui.select }, - config = true, + config = function() + require("flutter-tools").setup({ + dev_log = { + enabled = true, + filter = nil, -- optional callback to filter the log + notify_errors = false, -- notify the user if the is an error whilst running + open_cmd = "tabedit", + }, + widget_guides = { + enabled = true, + }, + closing_tags = { + enabled = true, + }, + lsp = { + color = { + enabled = true, + background = false, + foreground = false, + background_color = { r = 19, g = 17, b = 24 }, + + virtual_text = true, + virtual_text_str = "■", + }, + settings = { + showTodos = true, + completeFunctionCalls = true, + analysisExcludedFolders = { + vim.fn.expand("$HOME/.pub-cache"), + }, + lineLength = 120, + }, + }, + }) + end, } diff --git a/lua/plugins/prettier.lua b/lua/plugins/prettier.lua index b5cc892..cf82d30 100644 --- a/lua/plugins/prettier.lua +++ b/lua/plugins/prettier.lua @@ -14,4 +14,10 @@ return { require("Comment").setup() end, }, + { + "nmac427/guess-indent.nvim", + config = function() + require("guess-indent").setup({}) + end, + }, } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 2d2e368..f57e7e6 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -13,5 +13,12 @@ return { }, auto_install = true, }, + config = function() + require("nvim-treesitter.configs").setup({ + indent = { + enable = true, + }, + }) + end, }, }