From 57537c837042265929f653a9743f2f45a70e3f2b Mon Sep 17 00:00:00 2001 From: thek4n Date: Tue, 16 Jan 2024 16:59:48 +0300 Subject: [PATCH] nvim indent --- home/user/.config/nvim/after/ftplugin/cpp.lua | 2 +- home/user/.config/nvim/lua/base/options.lua | 4 ++-- home/user/.config/nvim/lua/base/plugins/lualine.lua | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/home/user/.config/nvim/after/ftplugin/cpp.lua b/home/user/.config/nvim/after/ftplugin/cpp.lua index 24ad15f..53435a1 100644 --- a/home/user/.config/nvim/after/ftplugin/cpp.lua +++ b/home/user/.config/nvim/after/ftplugin/cpp.lua @@ -2,4 +2,4 @@ local opt = vim.opt_local opt.tabstop = 2 opt.softtabstop = 2 -opt.shiftwidth = 2 +opt.shiftwidth = vim.bo.tabstop diff --git a/home/user/.config/nvim/lua/base/options.lua b/home/user/.config/nvim/lua/base/options.lua index b81e79a..0eb772b 100644 --- a/home/user/.config/nvim/lua/base/options.lua +++ b/home/user/.config/nvim/lua/base/options.lua @@ -29,9 +29,9 @@ opt.hidden = true opt.expandtab = true -- spaces instead of tab opt.smarttab = true -opt.tabstop = 4 -- 1 tab = .tabstop spaces +opt.tabstop = 4 -- 1 tab appears number spaces opt.softtabstop = 4 -opt.shiftwidth = 4 -- width of 1 tab in spaces +opt.shiftwidth = vim.bo.tabstop -- insert tab or shift inserting .shiftwidth*.tabstop spaces or .shiftwidth/.tabstop tabs opt.autoindent = true opt.smartindent = true opt.showtabline = 2 diff --git a/home/user/.config/nvim/lua/base/plugins/lualine.lua b/home/user/.config/nvim/lua/base/plugins/lualine.lua index 083986a..8828198 100644 --- a/home/user/.config/nvim/lua/base/plugins/lualine.lua +++ b/home/user/.config/nvim/lua/base/plugins/lualine.lua @@ -15,11 +15,10 @@ function get_formatted_virtual_env() end function detect_indent_type() - local shiftwidth = vim.bo.shiftwidth if vim.bo.expandtab then - return shiftwidth .. " spaces" + return "indent: " .. vim.bo.tabstop .. "s" else - return shiftwidth .. " tab" + return "indent: " .. 1 .. "t = " .. vim.bo.tabstop .. "s" end end