ciao bella 🥰
mvllow / modes.nvim Goto Github PK
View Code? Open in Web Editor NEWPrismatic line decorations for the adventurous vim user
Prismatic line decorations for the adventurous vim user
ciao bella 🥰
Hi there! Nice plugin!
I like the plugin, and It works pretty well, except for the fact that the cursor color is not resetting to the default when I come from another mode (visual or yank)
Any clues why this might be happening?
THanks!
Hi. When starting Neovim my normal CursorLine highlights are used but after going into insert or visual mode and returning into normal mode or if I press escape after startup, staying in normal mode, the CursorLine highlight isn't properly applied.
After entering insert/visual mode and returning to normal mode or pressing escape:
The result of me running :hi CursorLine
shows me that its guibg value is Grey40
, rather than the expected hex value. The highlight is defined by my colorscheme. I believe what I'm seeing is some sort of fallback highlight, which isn't based on the CursorLine highlight.
Thanks
I really like it.
I use neo-tree
for my file browser and recently noticed that the fuzzy_search
functionality in it, when combined with modes.nvim, leaves my cursorline
invisible in insert mode. The cursorline
works as expected when I disable modes.nvim
. My config has neo-tree
& the neo-tree-popup
in the ignore_filetypes
and I still am getting an invisible cursorline in the fuzzy_search
mode.
My relevant modes config:
local modes = require('modes')
modes.setup({
colors = {
visual = '#F959FF',
},
ignore_filetypes = {
'neo-tree',
'neo-tree-popup',
'TelescopePrompt',
},
})
Here's a gif of the bug in action:
Here's a gif with modes removed & neo-tree
working as expected:
It's 100% related to this single nvim_autocmd
, when I remove it, the plugin works mostly as expected:
vim.api.nvim_create_autocmd('WinLeave', {
pattern = '*',
callback = M.disable_managed_ui,
})
A fix would be to change the pattern to only act on non-excluded filetypes, or just live with the fact that it's going to highlight the other windows. I'm not sure what a proper fix to this is, but it makes it very difficult to use neo-tree
.
The reason this occurs is because when a switch happens to the fuzzy finder, it invokes a WinLeave
event which this then catches and disables the cursorlin
e for, disabling the ability to actively browse the file tree with the search window up.
When I state mostly
, there is also an issue with the insertenter
not respecting the filetype beneath because it's setting the cursorline
green when really it's just a picker.
The other way to fix this is to remove this single section in disable_managed_ui
:
if config.set_cursorline then
vim.opt.cursorline = false
end
When the above is removed it also works mostly as expected.
A potential way to "fix" this is to make a note of it in the docs and mention setting the cursorline
to false in the setup and setting vim.opt.cursorline = true
elsewhere by the user.
In the modes.nvim
setup function, passing set_cursorline = false
then setting vim.opt.cursorline = true
elsewhere in the configuration works, but exited windows still keep their cursorlines
as modes
is no longer managing the WinLeave
events to disable the cursorline
.
Usually when something is added or changed in modes, I test locally and push up. Unfortunately, issues arise almost every update due to how different everyone's environment is.
I would love to learn more about tests in lua, but also am unaware of what exactly to test. PR's are welcome and appreciated 😌
After #36, Rosé Pine theme (dark variant) doesn't use the colorscheme's palette. Light mode works as expected.
Users can pin to tag = v0.2.0
if using a theme that is affected by this.
I'd like to add an option not extend the cursorline in certain modes behind the line number and sign column. Currently, the cursorline is not extended when in Normal mode but is extended for other modes. Perhaps after this option is added we may want to extend the cursorline in Normal mode when extend is true.
This plugins resets highlight when switching between windows, and that breaks Styler plugin https://github.com/folke/styler.nvim
Styler allows setting a colorscheme per filetype and even per buffer. It does so by making use of vim.api.nvim_set_hl, but modes
resets that...
Could you make this plugin work with Styler ?
Let's say I'm in Normal mode, then when I use my hotkey to go definition of the symbol under my cursor (vim.lsp.buf.definition()), the cursor line changes to visual mode color even though it's normal mode. If I press ESC, then it goes back to normal mode color.
I think other LSP functions are also affected by this too.
(See bottom for a quick fix to skip all the troubleshooting, not sure if it's the best fix, but it does work)
The commit, 4e69c2a and later commits, have lead to some issues for my configuration. When pointing packer directly at that commit and later commits I get the following error:
Error executing vim.schedule lua callback: ...im/site/pack/packer/start/modes.nvim/lua/modes/utils.lua:7: Expected lua string
stack traceback:
[C]: in function 'nvim_get_color_by_name'
...im/site/pack/packer/start/modes.nvim/lua/modes/utils.lua:7: in function 'get_color'
...im/site/pack/packer/start/modes.nvim/lua/modes/utils.lua:29: in function 'blend'
...are/nvim/site/pack/packer/start/modes.nvim/lua/modes.lua:89: in function 'define'
...are/nvim/site/pack/packer/start/modes.nvim/lua/modes.lua:163: in function ''
vim/_editor.lua: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
This occurs both on the latest stable neovim 0.7
& on the latest version of neovim 0.8
I have traced it down to the removal of a fallback for the normal
group, adding back the fallback:
default_colors = {
cursor_line = utils.get_bg('CursorLine'),
cursor_line_nr = utils.get_bg('CursorLineNr'),
mode_msg = utils.get_fg('ModeMsg'),
normal = utils.get_bg('Normal', 'Normal'), -- <<<< here
visual = utils.get_bg('Visual'),
}
clears this error for me.
This error popped up for me due to tokyonight.nvim's transparency options. When I comment out vim.g.tokyonight_transparent*
the error referenced above goes away.
I suspect this is because the group gets set to none
by the transparency options.
Taking a look at the blended colors groups, I noticed the bg
color passed to blend
is the default_colors.normal
:
blended_colors = {
copy = utils.blend(
colors.copy,
default_colors.normal,
config.line_opacity.copy
),
delete = utils.blend(
colors.delete,
default_colors.normal,
-- snip
and the default_colors.normal
is defined as
default_colors = {
-- snip
normal = utils.get_bg('Normal'),
-- snip
}
and as best I can tell utils.get_bg
is the core of the problem here.
M.get_bg = function(name, fallback)
vim.notify(vim.inspect(name))
local id = vim.api.nvim_get_hl_id_by_name(name)
vim.notify(vim.inspect(id))
if not id then
return fallback
end
local background = vim.fn.synIDattr(id, 'bg')
vim.notify(vim.inspect(background))
if not background or background == '' then
return fallback
end
return background
end
I've popped in a few notify statements, and here's the output for the normal group:
"Normal" <- The name passed in, seems fine
64 <- We get a valid ID back
"none" <- synIDattr fails to get the background :/
The issue is with vim.fn.synIDattr
, it's giving back a none
value and since no fallback is defined this entire function throws back a none
value leading to the error up top.
To recreate the error you can pass in the following commands to neovim's command line (assuming you have a proper installation of modes):
At this point above, no errors should be shown as the Normal
bg
group is not none
.
Now the error should appear.
The most expedient way to resolve this is to add back the fallback for the normal group:
default_colors = {
-- snip
normal = utils.get_bg('Normal', 'Normal'),
-- snip
}
It looks like passing partial options, eg. require('modes').setup({ colors = { copy = '#fa8072' } })
replaces the defaults. This would require passing no options or all options. Instead, user config should extend the default config.
Set opacity of the cursor line based per mode. For example. to set a higher opacity in visual mode, and lower on other modes
Not sure if this is a bug or intended feature.
Yet if it is a feature, my question is why?
The color of the replace
mode changes because of certain actions.
When you first enter replace
, it is the color of normal
mode.
After you enter yank
mode, replace
mode is now the color of yank
mode.
After you enter delete
mode, replace
mode is now the color of delete
.
Once it changes color to yank
or delete
, it will not change back to normal
.
It is not affected by any other modes.
Hi. It is now possible to set the highlight of the cursor line in the sign and fold column too with the highlight groups CursorLineSign and CursorLineFold. It would be nice if this plugin supported it.
Thanks xx
If I set the set_number=true
it will still apply the color the number section in nvim for delete and insert modes.
I use telescope for switching and finding new files. With this plug-in installed, when I use :Telescope git_files
and press <C-v>
to open the selected file in a new vertical split it just doesn't.
Any idea what might cause this?
Thanks. I love this plug-in otherwise!
I use <C-c>
to go back to normal mode instead of Escape however the very first time I get this error:
Error executing vim.on_key Lua callback: vim.lua:498: Error executing 'on_key' with ns_ids '5'
Messages: Keyboard interrupt
stack traceback:
[C]: in function 'error'
vim.lua:498: in function <vim.lua:485>
The following patch fixes it however it breaks getting out of visual mode:
local on_key = vim.on_key or vim.register_keystroke_callback
on_key(function(key)
+ if key == util.get_termcode('<C-c>') then
+ return
+ end
+
local current_mode = vim.fn.mode()
first off- thank you for the plugin. really nicely made and exactly what i needed
now to my request
would it be possible to integrate other plugins into modes?
my specific issue is this:
i dont want to see a cursorline when im in normal mode but want to have it in insert mode.
at first i did that via auto commands which diabled the cursorline in normal mode but with your plugin i basically set the normal mode cursorline color to the background color.
this leads to the same issue i had when i did it via autocommands. i dont have a cursorline in nvim tree
so would it be possible that i set a specific cursorline color for nvim tree with your plugin?
Hi,
Recently, after an update, I got this error:
Error detected while processing /home/mort/.config/nvim/init.lua:
E5113: Error while calling lua chunk: vim/shared.lua:0: after the second argument: expected table, got nil
stack traceback:
[C]: in function 'error'
vim/shared.lua: in function 'validate'
vim/shared.lua: in function 'tbl_extend'
/home/mort/.local/share/nvim/lazy/modes.nvim/lua/modes.lua:204: in function 'setup'
/home/mort/.config/nvim/lua/theme.lua:120: in main chunk
[C]: in function 'require'
/home/mort/.config/nvim/init.lua:8: in main chunk
My config:
require('modes').setup()
Nvim version:
NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1693350652
modes.nvim not working.
My config:
--- init.lua
vim.o.cursorline = true
-- modes.lua
require('modes').setup({
colors = {
copy = "#f5c359",
delete = "#c75c6a",
insert = "#78ccc5",
visual = "#9745be",
},
line_opacity = 0.9
})
nvim --version
NVIM v0.6.0-dev+43-g02bf251bb
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Great package!!!
After the most recent update I've started getting the following error when trying to start Neovim:
E5113: Error while calling lua chunk: ~/.vim/plugged/modes.nvim/lua/modes/init.lua:127: attempt to index local 'opts'
(a nil value)
Plz halp!
users may have options like these in their config.
vim.opt.guicursor = "a:block" -- no more line or underline cursors, just block and all block
by design, modes.nvim
overwrites any user defined settings as it applies its own stuff.
(e.g. i-ci-ve:ver25-ModesInsert
)
"well zahimeen, why not just do the setting after setup
?"
the problem there is that the settings made by modes.nvim
don't care. either they hold higher presidency for a reason i dont know about, or it could be that the plugin constantly sets the guicursor
values, and because its the latest setting, it holds higher value.
when set_cursor = false
, everything works dandy cause the plugin doesnt have to redefine guicursor
. but i want my block cursor and highlights :(
idk whats going on man but this plugin is sick much love <3
Hey 👋🏾
in your README you advertise the option to define the highlights directly in a traditional way without hex color values in the setup function call. I like that. The problem: it doesn't work. I looked into the code and you actually redefine the highlights very time the mode changes. That makes it impossible to set them as user. I set the highlight, the plugins overwrites them.
A very simple but effective solution would be to add the default
argument (:help :highlight-default
).
But honestly I'm not sure if redefining the highlight over and over and over again makes actually sense. I mean why? Isn't it also performance threatening? Setting a highlight causes a couple of more actions by NeoVim in background.
Looking forward to discuss this. Maybe you actually have a very good reason to do it like that. I'm open to make a PR myself.
It would be nice if this plugin would support select mode as well, as this is used by snippet engines like luasnip.
Hello! I would like to remove the colored backgrounds from modes, especially in visual. Is it possible?
edit: to clarify, I just would like it to make it possible that modes.nvim does not alter colors for modes like v-snip, because it creates a conflict with the implementation of configurable themes in my setup
Hi,
Not sure if I should post it here or on neo-tree issues.
I thought, at least I report it, so it is known.
But when using neo-tree, it has a fuzzy search functionality (default /
when tree is open), where it opens a one-line floating window at the bottom of the tree window to type the search term in, it will then filter the tree to only show matching files (in tree form). While the cursor is in the floating window, it should have a cursorline highlight in the tree showing the current selected tree node, which can be altered with <up>
and <down>
. This highlight should be shown while the cursor remains in insert mode in the floating window with the search term.
When modes.nvim is installed, the described cursorline highlight is not visible.
I tried add the filetype 'neo-tree' to the ignore_filetypes
configuration option, but that didn't seem to help.
If line_opacity
is set to a near opaque number, eg. line_opacity = 0.9
then the foreground should automatically change to black/white depending on contrast.
Bold (and possibly italic or other styles) are removed when the line number highlight changes. The correct format is restored once modes is no longer changing the line number highlight.
Can be reproduced via:
:set termguicolors
:colorscheme lunaperche
:set number
:set cursorline
The active line number should be bold by default. Once using a modes modifier, e.g. y
, the entire line changes to yellow and the line number is no longer bold.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.