Comments (4)
In the end, I decided to leave writing these rules to user. There are examples for common situations in mini.nvim-disabling-recipes
help tag.
Thanks for suggestion nevertheless!
from mini.nvim.
Thanks for your feedback!
I considered this early on, but decided to stick with current mechanism using global and buffer "disabling" variables. It enables quite flexible behavior while being very fast. Having settings specifically for filetypes will be either a duplication (which doesn't quite align with plugin idea of balancing between features and support) or separate mechanism which might slow things down (which is crucial for something that is executed on every CursorMoved). This also might be a precedent to include another conditions in setup()
, which I don't really want. Currently I have strong opinion about this subject, but for the time being I'll keep this open as a reminder to try and reconsider.
What might be a more appropriate thing to do is to provide in help more explicit code snippets for most common scenarios. I just tried really quickly to implement your case (I admit, should be a quite common one) with autocmd
and it is not trivial. This plugin is designed more towards "disable this module under these handful of conditions" and not "enable ... conditions", which might be a problem for not experienced users. I'll think about it.
from mini.nvim.
I see, in such case it may be more reasonable to rely on disabling for selected filetypes. Actually, the outcome is similar to desired.
vim.cmd [[ autocmd BufReadPost *.md let b:minicursorword_disable=v:true ]]
I've been thinking for a moment on the setup for possible snippet and indeed this is more complex. The best, low effort idea I've came up with would be toggling global state of module, what itself just seems odd.
use {
'echasnovski/mini.nvim',
config = function()
vim.g.minicursorword_disable = true
require'mini.cursorword'.setup()
end
}
vim.cmd [[ autocmd BufReadPost *.md let g:minicursorword_disable=v:true ]]
vim.cmd [[ autocmd BufReadPost *.php,*.js,*.html,*.css let g:minicursorword_disable=v:false ]]
from mini.nvim.
Yep, it this was an intended use case. You can also use it with FileType
autocommand (autocmd FileType markdown ...
) or with filetype plugins.
The most straightforward way to "enable only for certain file types" is to explicitly say "disable only if filetype is not a desired one". Using some Vimscript, this becomes something like:
vim.cmd([[au FileType * if index(['lua', 'python'], &ft) < 0 | let b:minicursorword_disable=v:true | endif]])
Note: of course, this can be improved (for example, it won't work if 'filetype' has changed after buffer is opened; which would require an else
clause here), but it might become overcomplicated for small benefit.
from mini.nvim.
Related Issues (20)
- mini.statusline: Status is not drawn on setup() HOT 2
- IndentScope: Hangs on long folds HOT 4
- Is it possible to perform an operation on the original text after duplication ? HOT 4
- some user-defined keymaps may be overwritten by hard-coded keymaps in starter.mini HOT 4
- save pwd into detected sessions list HOT 3
- cmdheight=0 cause mini.statusline disappear or flicker on <cmd> keymap HOT 3
- Line operations HOT 2
- Problem with mini.ai inside/around tag (`it`/`at`) HOT 1
- mini.statusline: Statusline is not updated when NeoTree is toggled. HOT 1
- mini.animate causes incorrect tab count HOT 3
- verbose autoread error message if no session file is found HOT 1
- Resizing windows with mouse is slow HOT 1
- How to apply border for the completion list? HOT 1
- FR: keep cursor column when multiplying linewise HOT 2
- FR: trim when replacing linewise register into charwise text object HOT 1
- Plugins to do project wide search and replace and show diagnostics. HOT 3
- Hints of keymap help g? in the mini.files interface HOT 1
- Option to set line number for mini.files HOT 6
- mini.surround can't work properly with tag <router-outlet> HOT 1
- (mini.map): Code highlight feature 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 mini.nvim.