Comments (19)
How did you set these options in your config? How did you load nvim-treesitter?
from neovim.
In my lua config, I have the following 2 lines
vim.opt.tabstop = 2
vim.opt.expandtab = true
I use the "lazy" plugin manager. I have this line in my main plugin lua file
{'nvim-treesitter/nvim-treesitter', build = ":TSUpdate"},
Then my setup for treesitter is
require'nvim-treesitter.configs'.setup {
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "php", "javascript", "json5", "tsx",
"typescript", "html", "vue", "json", "bash", "python", "diff", "markdown", "sql"},
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
-- indent = {
-- enable = true
-- }
}
from neovim.
Run nvim with the -V1
option and try:
:verbose set expandtab?
:verbose set tabstop?
and see where this option is set.
from neovim.
When I run nvim -V1 -p file1.php file2.php
when in the first tab for the first file it says
expandtab
Last set from ~/.config/nvim/lua/options.lua line 8
tabstop=2
Last set from ~/.config/nvim/lua/options.lua line 7
when in the second tab for the second file it says
noexpandtab
tabstop=8
from neovim.
Please remember to provide full reproducible steps as instructed in the issue template. If one has to make a guess, the lines 7, 8 in ~/.config/nvim/lua/options.lua
seems to be:
vim.opt.tabstop = 2
vim.opt.expandtab = true
The noexpandtab
tabstop=8
config for the second tab seems to be the factory default, and I don't think this has something to do with nvim-treesitter.
from neovim.
In my lua config, I have the following 2 lines, for line numbers 7 & 8.
vim.opt.tabstop = 2
vim.opt.expandtab = true
This problem doesn't exist with the exact same config files and neovim version 0.9.5
from neovim.
Can you reproduce this with a file containing only these two lines and nvim --clean -u test.lua ...
?
from neovim.
when running the following with the nightly
vi -V1 -p --clean -u ~/test.lua file1.php file2.php
it works as expected, the issue isn't present
test.lua only contains the following 2 lines as suggested
vim.opt.tabstop = 2
vim.opt.expandtab = true
from neovim.
Then your problem lies somewhere in your config. Add stuff to the minimal test file until you can reproduce. (The issue is usually some plugin.)
from neovim.
If I don't load the nvim-treesitter plugin it works fine. I tried opening a bug with nvim-treesitter and they closed it saying it can't be caused by that...
from neovim.
But is nvim-treesitter the only plugin you load? What is your configuration for thst plugin? (Don't install all languages blindly.)
from neovim.
I use the "lazy" plugin manager and install the following plugins
return {
{'folke/tokyonight.nvim', lazy = false, priority = 1000},
{'neovim/nvim-lspconfig', lazy = true},
{'nvim-treesitter/nvim-treesitter', build = ":TSUpdate"},
{'lewis6991/gitsigns.nvim', lazy = true},
{'stevearc/aerial.nvim', lazy = true},
{'tpope/vim-fugitive', cmd = "Git", lazy = true},
{ 'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons', lazy = true }
},
{
'nvim-telescope/telescope.nvim',
dependencies = { {'nvim-lua/plenary.nvim', lazy = true} },
},
}
My config for nvim-treesitter is
require'nvim-treesitter.configs'.setup {
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "php", "javascript", "json5", "tsx",
"typescript", "html", "vue", "json", "bash", "python", "diff", "markdown", "sql"},
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
--indent = {
-- enable = true
--}
}
from neovim.
Yeah, that's too many. Reduce to the absolute minimum.
from neovim.
I tried several things based on your snippets, but I still can't reproduce the issue OP is describing, with and without nvim-treesitter. Once you manage to find a full, self-contained, clear reproduction steps based on https://github.com/neovim/neovim/blob/master/contrib/minimal.lua (please don't use lazy.nvim), please feel free to ask further help.
from neovim.
I tried some more things this morning to try and get it to happen on the nightly without using lazy and very minimal config, but wasn't able to get it to happen that way. I'm just going to go back to neovim 0.9.5 for now where this problem doesn't occur and hope that whatever the underlying issue is gets fixed when 0.10 gets fully released.
from neovim.
Neovim 0.10 is being released right now. So keep testing.
from neovim.
@jthemenace have you tried adding:
vim.opt.shiftwidth = 2
vim.opt.expandtab = true
or
vim.opt.tabstop = 2
vim.opt.shiftwidth = 0
vim.opt.expandtab = true
both works for me, while:
vim.opt.tabstop = 2
vim.opt.expandtab = true
(without shiftwidth) will make the tab size be 8 spaces.
Looks like a bug to me, I am on v0.10.0
from neovim.
I have the same or similar issue but the way to reproduce it is different. I'm on macOS, neovim 0.10.0 installed with brew and many plugins for Go dev.
So if I open 2 Go files, i.e nvim -V1 -p f1.go f1_test.go
, ts
is correctly set to 4
as per my ~/.config/nvim/init.lua
definition of vim.opt.tabstop = 4
.
But if I navigate to a different file via LSP go to definition vim.lsp.buf.definition()
, the opened file has the ts
set to 2
as per /opt/homebrew/Cellar/neovim/0.10.0/share/nvim/runtime/lua/editorconfig.lua
.
This was not happening in neovim 0.9.5.
from neovim.
After this issue was closed, I opened one with lazy.nvim here
Someone mentioned it was a duplicate of this one that had the fix / answer.
I had to put my expandtab / tabstop setting(along with a few others) in my config BEFORE the lazy plugin manager is loaded. Once I did that it started working fine.
from neovim.
Related Issues (20)
- nvim_set_hl does not work in (v0.9.4 / macOS v14.4.1) HOT 2
- glibc 2.29 not found error in v0.10.0+ HOT 1
- Conceal characters on cursor line except at cursor position HOT 2
- Please bring back `diff` in nvim windows binary HOT 3
- Neovim(nvim) doesn't resize to full terminal width upon opening HOT 3
- :Man softwrap (vim.g.man_hardwrap = 0) breaks table formatting HOT 1
- LSP client should be able to handle snippets that use $0 as a tabstop HOT 6
- `vim._with()` does not properly restore global-local options HOT 3
- signcolumn="yes" + cursorline results in line being visually indented backwards when going from unindented line to indented line HOT 2
- "autocmd BufRead" not working when "nvim a.lua" HOT 3
- Swapfile message (E325) doesn't use the default colorscheme HOT 1
- Incomplete Documentation for `vim.diagnostic.open_float` Options HOT 3
- Which plugins use :UpdateRemotePlugins ? HOT 4
- Cmake parser code is bad HOT 4
- Online doc strange highlights and offset display HOT 1
- Don't send "no information available" on `vim.lsp.buf.hover` if at least one attached server has information HOT 1
- Nightly release tsserver omnifunc doesn't complete partial identifier
- Nightly release: tsserver wrong autoimports with multiline imports
- Built-in LSP completion not filtering on label
- In the old version of glibc and O2 is enabled, replacing the strncmp argument with a macro will cause the compilation to fail
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neovim.