Code Monkey home page Code Monkey logo

baleia.nvim's People

Contributors

m00qek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

baleia.nvim's Issues

Some lines not colored

Approx. half of the lines (depending on log message) that are added to the buffer are not colored properly:

image

Here's my lua config:

local baleia = require('baleia').setup { }

vim.api.nvim_create_autocmd({ 'BufWinEnter' }, {
    pattern = '*flutter-dev',
    callback = function ()
        baleia.automatically(vim.fn.bufnr(vim.fn.expand('%')))
    end
})
❯ nvim --version
NVIM v0.9.0-dev-497+g3217a31f9-dirty
Build type: Release
LuaJIT 2.1.0-beta3

attempt to call field 'once' (a nil value)

Not sure what am I doing wrong

Here is my setup:


-- log colrizer
local baleia = require('baleia')
function BaleiaColorize()
    baleia.setup({})
    baleia.once(vim.fn.bufnr('%'))
end
vim.cmd('command! BaleiaColorize call v:lua.BaleiaColorize()')


Running fails with:


:BaleiaColorize
...
attempt to call field 'once' (a nil value)

Sporadic "start_row out of bounds" error after updating

Hello,

Over the last few days, I've started seeing this error happen sporadically while developing Clojure code with Conjure. I'm not sure what's causing it. I am using the development branch of nvim (nvim --version returns NVIM v0.7.0-dev), and I know that it's been updated recently, whereas the last commit of Baleia is from October, so I suspect that it might be related to some change in Neovim?

Error executing vim.schedule lua callback: /home/dave/.vim/bundle/baleia.nvim/lua/baleia.lua:51: start_row out of bounds
stack traceback:
        [C]: in function 'nvim_buf_set_text'
        /home/dave/.vim/bundle/baleia.nvim/lua/baleia.lua:51: in function </home/dave/.vim/bundle/baleia.nvim/lua/baleia.lua:46>

Leaks memory

Every time you run baleia.once to colorize a buffer, some new memory is reserved that is never freed. If your nvim process stays alive for a very long time, this will eventually consume all the memory in your system and trigger swapping.

I suspect the culprit is dynamically created syntax highlighting groups that are never cleaned up, but I didn't investigate that deeply.

Possibility to use colors from colorscheme

The following is the comparison between a kaocha test result when run from conjure (with baleia enabled on the buffer) and when run in the terminal. My understanding is that the latter works because the terminal emulator has ANSI colors properly mapped. Would it be possible to have the same behavior when using baleia

Screen Shot 2022-04-22 at 19 42 32

Screen Shot 2022-04-22 at 19 42 46

Expected Lua number in function 'is_empty' on latest Neovim

After updating Neovim this morning (I use the unstable branch), I get this error every time I open a Clojure buffer:

Error executing vim.schedule lua callback: .../dave/.vim/bundle/baleia.nvim/lua/baleia/nvim/buffer.lua:99: Expected Lua number                                                
stack traceback:                                                                                                                                                              
        [C]: in function 'nvim_buf_line_count'                                                                                                                                
        .../dave/.vim/bundle/baleia.nvim/lua/baleia/nvim/buffer.lua:99: in function 'is_empty'                                                                                
        /home/dave/.vim/bundle/baleia.nvim/lua/baleia.lua:53: in function </home/dave/.vim/bundle/baleia.nvim/lua/baleia.lua:52>    

I'm guessing this is related to colorizing the Conjure log buffer, which is why this is only happening when opening a Clojure buffer.

I followed the instructions in the README in an attempt to get logs, but when I ran :BaleiaLogs, I got this error:

E121: Undefined variable: g:baleia  

Doesn't work in read-only buffers, even with strip_ansi_codes = false

I have:

  let s:baleia = luaeval("require('baleia').setup({ strip_ansi_codes = false, log = 'DEBUG' })")
  command! BaleiaColorize call s:baleia.once(bufnr('%'))
  command! BaleiaLogs call s:baleia.logger.show()

But in read-only buffers (e.g. quickfix / fireplace's :Last command) colors aren't highlighted, just ignored:

ERROR vim.api.nvim_buf_set_text
    | {
    |   params = {
    |     buffer = 16,
    |     end_col = 53,
    |     end_row = 14,
    |     lines = { "... removed ..." },
    |     start_col = 0,
    |     start_row = 0
    |   },
    |   result = "Buffer is not 'modifiable'"
    | }

some highlighting seems to take place, but it doesn't colour the text it's supposed to.

Unable to make it work

I output program into quickfix. Here is how it looks:
quickfix.txt
And here is my setup:

local config_group = vim.api.nvim_create_augroup('Config', {})
vim.api.nvim_create_autocmd({ 'BufWinEnter' }, {
  pattern = 'quickfix',
  group = config_group,
  callback = function()
    print(vim.api.nvim_get_current_buf())
    local baleia = require('baleia').setup({})
    baleia.automatically(vim.api.nvim_get_current_buf())
  end,
})

When I open quickfix I i prints buffer index (because I put print to check if I created autocmd correctly), but there is not highlighting.
Also for some reason I don't heave the mentioned :BaleiaColorize from the README.md.

Flutter logs

Hi, I am using another plugin akinsho/flutter-tools and I am trying to colorize the logs. I have tried to configure your plugin but I can't seem to make it work. I have seen a similar issue but it has been inactive for quite some time now.
Screenshot 2024-03-01 at 11 20 13
This is the most I could do.
I am using LazyVim configuration and here is the autocommand

vim.api.nvim_create_autocmd("BufWinEnter", {
  pattern = "__FLUTTER_DEV_LOG__",
  callback = function()
    local buffnr = vim.fn.bufnr()
    local baleia = require("baleia").setup({ log = "DEBUG", strip_ansi_codes = false })
    baleia.automatically(buffnr)
  end,
})

that I have set that does not seem to work at all. The above screenshot is made by using
lua lua require('baleia').setup({log ="DEBUG"}).automatically(vim.fn.bufnr(vim.fn.expand('%'))) .
I have tried looking up for logs but there are none.

module 'baleia' not found

Hello,

I'm trying Conjure for Clojure and found this plugin in the Ansi Color thread (link).

I installed Baleia with Plug

  Plug 'm00qek/baleia.nvim', { 'tag': 'v1.1.0' }
  let g:conjure#log#strip_ansi_escape_sequences_line_limit = 0
  let s:baleia = luaeval("require('baleia').setup { line_starts_at = 3 }")
  autocmd BufWinEnter conjure-log-* call s:baleia.automatically(bufnr('%'))

but I faced an errer while running this luaeval("require('baleia').setup { line_starts_at = 3 }")

E5108: Error executing lua [string "luaeval()"]:1: module 'baleia' not found:
        no field package.preload['baleia']
        no file './baleia.lua'
        no file '/usr/local/Cellar/luajit-openresty/2.1-20211210/share/luajit-2.1.0-beta3/baleia.lua'
        no file '/usr/local/share/lua/5.1/baleia.lua'
        no file '/usr/local/share/lua/5.1/baleia/init.lua'
        no file '/usr/local/Cellar/luajit-openresty/2.1-20211210/share/lua/5.1/baleia.lua'
        no file '/usr/local/Cellar/luajit-openresty/2.1-20211210/share/lua/5.1/baleia/init.lua'
        no file './baleia.so'
        no file '/usr/local/lib/lua/5.1/baleia.so'
        no file '/usr/local/Cellar/luajit-openresty/2.1-20211210/lib/lua/5.1/baleia.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'require'
        [string "luaeval()"]:1: in main chunk

It seems luaeval can't find baleia. How could I fix this?

Thanks.

Any way to use with command window / more-pager?

I'm trying to use this to colorize git push and git commit output (because sr.ht outputs color when you have an associated CI build, and because pre-commit hooks also have color.

Example:

Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: ^[[1mBuild started:^[[0m
remote: ^[[94mhttps://builds.sr.ht/~hwrd/job/1125600^[[0m [mirror.yml]
To git.sr.ht:~hwrd/nvim-config
 + 6709920...f06e48a main -> main (forced update)
Press ENTER or type command to continue

However, these just output into the command pager (:h pager). As far as I can tell, there's no buffer associated with this?

Is there any way I can use baleia to colorize this output?

Attempt to perform arithmetic on upvalue 'ansi' (a table value)

Today, I started seeing this error pop up while running tests via Conjure:

Error executing vim.schedule lua callback: /home/dave/.vim/bundle/baleia.nvim/lua/baleia/styles.lua:97: attempt to perform arithmetic on upvalue 'ansi' (a table value)
stack traceback:
        /home/dave/.vim/bundle/baleia.nvim/lua/baleia/styles.lua:97: in function 'to_style'
        /home/dave/.vim/bundle/baleia.nvim/lua/baleia/locations.lua:14: in function 'linelocs'
        /home/dave/.vim/bundle/baleia.nvim/lua/baleia/locations.lua:33: in function 'extract'
        /home/dave/.vim/bundle/baleia.nvim/lua/baleia/highlight.lua:57: in function 'all'
        /home/dave/.vim/bundle/baleia.nvim/lua/baleia.lua:12: in function </home/dave/.vim/bundle/baleia.nvim/lua/baleia.lua:11>

I tried following the instructions here to collect logs, but when I ran :BaleiaLogs, I got this error:

E121: Undefined variable: g:baleia

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.