Skip to content

cjodo/convert.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

convert.nvim

assets_demo.mov

Dependencies

Features

  • Convert css units with one simple command
  • track base font size on save to convert px to rems accurately (Single file support only)

Installation:

Use your favourite plugin manager

  • Lazy:
return {
  'cjodo/convert.nvim',
  dependencies = {
    'MunifTanjim/nui.nvim'
  },
  keys = {
    { "<leader>cn", "<cmd>ConvertFindNext<CR>", desc = "Find next convertable unit" },
    { "<leader>cc", "<cmd>ConvertFindCurrent<CR>", desc = "Find convertable unit in current line" },
    { "<leader>ca", "<cmd>ConvertAll<CR>", desc = "Convert all of a specified unit" },
  },
}

Usage

You can choose you're own custom keys for the ui menu

  config = function()
    local convert = require('convert')
    -- defaults
    convert.setup({
      keymaps = {
        focus_next = { "j", "<Down>", "<Tab>" },
        focus_prev = { "k", "<Up>", "<S-Tab>" },
        close = { "<Esc>", "<C-c>", 'qq' },
        submit = { "<CR>", "<Space>" },
      }
    })
  end

Commands:

Command Description
:ConvertFindNext Finds the next convertible unit
:ConvertFindCurrent Finds the convertible unit in the current line (starting from cursor)
:ConvertAll Converts all instances of a given unit to another