From bdbae28b247a15ea8d162de4f62d5e35bcf9c8d9 Mon Sep 17 00:00:00 2001 From: Brady Phillips Date: Sat, 20 Mar 2021 03:05:20 +0000 Subject: Fix indent size Indent size should equal shiftwidth, unless shiftwidth is 0 in which case tabstop should be used. --- lua/nvim-treesitter/indent.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'lua') diff --git a/lua/nvim-treesitter/indent.lua b/lua/nvim-treesitter/indent.lua index 7bd97b86d..cdbf66489 100644 --- a/lua/nvim-treesitter/indent.lua +++ b/lua/nvim-treesitter/indent.lua @@ -39,10 +39,6 @@ local get_indents = utils.memoize_by_buf_tick(function(bufnr) } end) -local function get_indent_size() - return vim.bo.softtabstop > 0 and vim.bo.shiftwidth or vim.bo.tabstop -end - function M.get_indent(lnum) local parser = parsers.get_parser() if not parser or not lnum then return -1 end @@ -52,7 +48,7 @@ function M.get_indent(lnum) local node = get_node_at_line(root, lnum-1) local indent = 0 - local indent_size = get_indent_size() + local indent_size = vim.fn.shiftwidth() -- to get corret indetation when we land on an empty line (for instance by typing `o`), we try -- to use indentation of previous nonblank line, this solves the issue also for languages that -- cgit v1.2.3-70-g09d2