Skip to content

roobert/f-string-toggle.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

🧶 f-string-toggle

f-string-toggle

A modularised version of this reddit post by u/ddmenddes_ - all credit goes to the original author!

Install

{
  "roobert/f-string-toggle.nvim",
  config = function()
    require("f-string-toggle").setup({
      key_binding = "<leader>f",
      key_binding_desc = "Toggle f-string"
      filetypes = { "python" },
    })
  end,
}

Configure

Disable default mapping

If you would prefer not to use the default key binding, you can set key_binding = false and directly call toggle_fstring(). Here is an example with lazy.nvim:

{
  "roobert/f-string-toggle.nvim",
  keys = {
    { "<leader>fs", function() require("f-string-toggle").toggle_fstring() end, desc = "Toggle f-string" }
  },
  config = function()
    require("f-string-toggle").setup({
      key_binding = false,
    })
  end,
}

If you want to set the mapping outside lazy.nvim, you can use:

vim.keymap.set('n', '<leader>f', function() require('f-string-toggle').toggle_fstring() end, { desc = "Toggle f-string" })

Usage

Within a string press leader-f to toggle if it's an f-string or not.

About

🧶 A Neovim plugin to toggle python f-strings

Resources

Stars

Watchers

Forks

Contributors 5

Languages