Sharing code as an image directly from Neovim
Tags: vim, neovim, tooling, developer
Published: 2024-03-05 11:59:25


## Carbon-Now.nvim

![Carbon-now](https://repository-images.githubusercontent.com/462087595/043b3f75-5a16-4cad-9615-6d5a6d7cb5f6)


Sharing code via Neovim has become easier than ever. Now you can share your codes as photos by simply copying them.

You can get information about the configurations from the following github address:

[https://github.com/ellisonleao/carbon-now.nvim](https://github.com/ellisonleao/carbon-now.nvim)


If you are using the Lazy package installer, you can easily share it with the configurations I shared below. All you have to do is personalize these settings according to your wishes.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/llnuiek6x61j6r260kqv.png)


First, let's look at where these settings come from. When you click on the settings icon on the Carbon.now.sh web page, the names of the settings will appear.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f8jv6883vyevfcnsi92p.png)

When you change the values here, you will see a change in the relevant option value in the page URL.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qf77r6t8kzsvf6uaepgf.png)


SampleURL: 
```html
https://carbon.now.sh/?bg=midnightblue&t=verminal&wt=boxy&l=lua&width=680&ds=false&dsyoff=20px&dsblur=68px&wc=true&wa=true&pv=56px&ph=56px&ln=true&fl=1&fm=Monoid&fs=18px&lh=133%25&si=false&es=2x&wm=false&code=%2509print%28%27hello%2520World%21%27%29&tb=Made%2520with%2520carbon-now.nvim
```
when we parsed this URL using [freeformatter.com](https://www.freeformatter.com/url-parser-query-string-splitter.html) HTML Query String looks like this: 

```html 

-Query String-
'bg':	midnightblue
't':	verminal
'wt':	boxy
'l':	lua
'width':	680
'ds':	false
'dsyoff':	20px
'dsblur':	68px
'wc':	true
'wa':	true
'pv':	56px
'ph':	56px
'ln':	true
'fl':	1
'fm':	Monoid
'fs':	18px
'lh':	133%
'si':	false
'es':	2x
'wm':	false
'code':	%09print('hello%20World!')
'tb':	Made%20with%20carbon-now.nvim


```


This means when we change bg value background changes. You can compare remains if you desire. Whatever, in our configuration parameters changes these values. 

```Lua 
	{
		"ellisonleao/carbon-now.nvim",
		lazy = true,
		cmd = "CarbonNow",
		config = function()
			local carbon = require("carbon-now")
			carbon.setup({
                open_cmd  = "chromium-browser",
                base_url = "https://carbon.now.sh/",
				options = {
					font_family = "Monoid",
					theme = "verminal",
                    bg = "midnightblue",
                    drop_shadow = true, -- true, false 
                    drop_shadow_blur = "68px",
                    drop_shadow_offset_y = "20px",
                    font_size = "18px",
                    line_height = "133%",
                    line_numbers = true, -- true,false 
                    titlebar = "@gokayburuc with carbon-now.nvim",
                    watermark = false, -- true, false 
                    window_theme = "boxy", -- sharp, none, boxy, bw 
				},
			})
		end,
	},

```

I'm using chromium-browser so i changed `open_cmd` with this value. And I changed titlebar option with my own message.

## Usage 

Once you have adjusted everything and shut down the Lazy screen, launch the screen you wish to copy. Enter CarbonNow into the command line after selecting the text to copy from this screen in Virtual Mode. With your code, it will take you straight to the carbon.now website. Send your code as a PNG file or tweet it. 

That is it!