Giter VIP home page Giter VIP logo

ansicolors.lua's People

Contributors

agladysh avatar doriangray avatar hoelzro avatar kikito avatar robertwahler avatar rrthomas 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansicolors.lua's Issues

Readme fix

It's something very minor, in the usage section the third print raises an error because of "underlined" instead of "underline".

Please make new LuaRock release

I agree completely that LuaRocks releases should be automated; mine are! See for example luaposix/luaposix's Makefile.am, and note that because you use LuaRocks's built-in build system you don't need the "foo-release" branch bit, so the code will be that bit simpler. Do ask if I can help.

[this issue its not for this, but i need help] related problem

hey, very nice lua file.
im trying to use this in neovim lua configuration.

but when trying to print this:

local colored = require("ansi-colors")


function copy_current_line_to_clipboard()
	vim.cmd("execute 'normal \"+yy'")
	print(colored("%{red}line copied to clipboard%{reset}"))
end

nnoremap("<C-c>", "<cmd> lua copy_current_line_to_clipboard()<CR>")
inoremap("<C-c>", "<C-o><cmd> lua copy_current_line_to_clipboard()<CR>")

i get this:
image

i've tested the file in my terminal:
image

with this:

local colored = require("ansi-colors")
print(colored("%{red}line copied to clipboard%{reset}"))

so the plugin works.

apparently, vim cannot display ansi codes.

how do i make neovim display ansi codes in command-line area?

Windows behaviour

Windows has gained suppprt for ANSI sequences (since 2019, a specific release of 2010 added it).

  • ANSI sequences are available
  • might not be enabled by default
  • Windows API function setconsolemode() can be used to enable it
  • It can also be enabled by using os.execute as a workaround

So imho the behaviour of this library should be adjusted. But it is slightly problematic I think;

  • enabling colors on Windows by default is breaking behaviour
  • on Posix it is assumed that the caller of the library wants to use colors (since there are no checks whatsoever, eg using an isapty function to detect a pty)
  • so enabling color by default on Windows would make sense... though support for it might not be enabled...

So I see 2 options:

  • follow Posix behaviour and enable colors by default, if the caller doesn't want colors, then just don't use the lib.
    • Caller is responsible for proper checks and balances, as well as setup.
    • Lines up best with the Posix behaviour
    • breaking
  • enable colors, but make the calls to enable color support (using an external lib to call setconsolemode or use the os.execute workaround.
    • Doing the setup for the caller.
    • less breaking
    • Responsibilities are different from Posix (since caller doesn't do the setup)

wdyt?

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.