Comments (7)
Hi, thanks for reporting this issue. Unfortunately I cannot reproduce this bug.
The following is the behavior of this plugin under normal mode, is this what you expected? If not, please provide the minimal config that can reproduce this bug and screen recording:
simplescreenrecorder-2023-03-31_09.49.22.mp4
from deadcolumn.nvim.
Should've mentioned that this bug doesn't occur when using $
to set cursor to last column of the line, sorry. Here's a demo with MRE.
https://user-images.githubusercontent.com/55766287/229184947-2f1b1f2c-26ac-4b12-b726-340f4b551901.mp4
-- ~/.config/nvim/init.lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- load installed plugins and their configurations
require("lazy").setup("plugins", {
performance = {
cache = {
enabled = true,
},
reset_packpath = true,
rtp = {
reset = true,
disabled_plugins = {
"gzip",
"matchit",
"matchparen",
"netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})
-- ~/.config/nvim/lua/plugins/ui.lua
return {
{
'Bekaboo/deadcolumn.nvim',
event = { 'BufReadPre', 'BufNewFile' },
opts = {
blending = {
threshold = 0.75,
},
warning = {
colorcode = '#ED8796',
}
}
}
}
from deadcolumn.nvim.
I found a naive solution which is to remove the WinScrolled
and CursorMoved
events from the redraw_colorcolumn
autocmd (this function somehow causes the editor to forget the cursor position) but I don't think this should be an accepted solution because it will of course break the plugin for users that want the color column to show in the normal mode scope. I think some vim api function is causing this breakage perhaps but I don't know which.
from deadcolumn.nvim.
Good catch, but the real problem here is not vim api functions, it is setting vim.wo.cc
that make neovim forget the cursor position. If you comment out all commands that set vim.wo.cc
in function redraw_colorcolumn
, the bug disappears, but that is not what we want. I think it is a neovim issue and not related to this plugin.
The reason why I conclude the problem comes from option setting is that if you open neovim with nvim --clean somefile
, first put your cursor at column, say, 10, then moves up and down, you can observe that the position is memorized; but if you put the cursor on an empty line then set an option in cmdline, for example, :set cc=30
or :set tw=79
, the cursor position will be lost.
This is beyond deadcolumn.nvim and I don't think there is an easy fix to this, maybe we should report it to neovim. PR is welcome.
from deadcolumn.nvim.
Interesting, thanks for the response and quick fix. I also noticed that this can be fixed by saving and restoring the window state. I tested both methods and I think with this way the cursor is always saved even when switching tabs or buffers for example, which will cause the cursor to reset with the current fix. But definitely not a big issue as the main problem is largely fixed. Still, if you're interested I will link the change and up to you if you want to do anything with this, thanks again:
ribru17@7eca7b1
from deadcolumn.nvim.
Seems that it is a better solution, please make a PR and I will be happy to accept it.
PS: is it still necessary to check vim.wo.cc
before setting it given that we now have winsaveview()
? Haven't tested myself.
from deadcolumn.nvim.
Sounds good, I'll make a PR very soon, going to eat now. And I'm not sure: I'll test that as well. As of now I don't know anything about vim.wo.cc
to tell you the truth.
from deadcolumn.nvim.
Related Issues (17)
- Repect
- Feature request: show column as usual when it would otherwise not show HOT 4
- Feature request: allow text on the column HOT 3
- Always show colorcolumn if a line crosses it HOT 18
- Plugin doesn't work out of the box HOT 9
- Normal mode when used with scope buffer works but throws below error while opening a file! HOT 2
- How exactly blending works? HOT 18
- Setup error HOT 1
- Errors on colors.lua:41: invalid key: create HOT 3
- Setting winhighlight conflicts with other plugins HOT 5
- Cursor Losing Column Position Issue in Nightly Version HOT 6
- Feature request: virtual text colorcolumn HOT 2
- Plugin un-setting colorcolumn setting HOT 15
- [Bug] deadcolumn works only in the first file HOT 6
- Consider tagging stable releases HOT 1
- This plugin doesn't work sometimes HOT 3
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 deadcolumn.nvim.