summaryrefslogtreecommitdiff
path: root/lua/nvim-treesitter/indent.lua
diff options
context:
space:
mode:
authorSenghan Bright <senghan.bright@deltaprojects.com>2020-12-16 10:55:10 +0100
committerThomas Vigouroux <tomvig38@gmail.com>2020-12-16 11:43:03 +0100
commitd3180720f1072937696719ca21df429219306057 (patch)
tree273a272a158a2bc8adf843dfdbfe0488300ec37d /lua/nvim-treesitter/indent.lua
parent5f20329e9605169a1818f237035ac0d515f0219b (diff)
fix: support shiftwidth for indents.
Diffstat (limited to 'lua/nvim-treesitter/indent.lua')
-rw-r--r--lua/nvim-treesitter/indent.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/lua/nvim-treesitter/indent.lua b/lua/nvim-treesitter/indent.lua
index cfc3f8a9..ffbb8c0b 100644
--- a/lua/nvim-treesitter/indent.lua
+++ b/lua/nvim-treesitter/indent.lua
@@ -50,11 +50,12 @@ function M.get_indent(lnum)
node = node:parent()
end
+ local ind_size = vim.bo.softtabstop < 0 and vim.bo.shiftwidth or vim.bo.tabstop
local ind = 0
while node do
node = node:parent()
if indents[tostring(node)] then
- ind = ind + vim.bo.tabstop
+ ind = ind + ind_size
end
end