Skip to content

ardanlabs/ardango.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ardango.nvim

This plugin exposes utility functions to enhance coding Go in Neovim.

Exposed functions:

  • RunCurrTest: Runs the test under the cursor and shows the results in a popup window.
  • BuildCurrPackage: Build the package in the current dir.
  • OrgBufImports: Update imports of the current buffer.
  • SignatureInStatusLine: Shows the element under the cursor signature info on hover in the status line.
  • AddTagToField: Adds go tag element to the struct field under the cursor, can handle exisiting elements. If no value is passed the snake cased field name will be the element value.
  • AddTagsToStruct: Adds go tag element to all fields inside the struct under the cursor, can handle exisiting elements. If no value is passed the snake cased field name will be the element value.
  • RemoveTagFromField: Removes a tag element from the field under the cursor.
  • RemoveTagsFromStruct: Removes a tag element from all the fields inside the struct under the cursor.

Dependencies

Install

With the dependencies installed add to your favorite package manager:

use 'ardanlabs/ardango.nvim'
Plug 'ardanlabs/ardango.nvim'

How to use

Setting as an autocommand:

local ardango = require "ardango"

-- Update imports on save.
vim.api.nvim_create_autocmd("BufWritePre", {
  group = "my_augroup",
  pattern = "*.go",
  callback = function() ardango.OrgBufImports(1000) end,
})

Setting as a keymap:

local ardango = require "ardango"

local opts = { noremap = true, silent = true }
-- Set the keymap to test the package under the cursor.
vim.keymap.set('n', '<leader>gt', ardango.RunCurrTest, opts)
-- Set the keymap to build the package under the cursor.
vim.keymap.set('n', '<leader>gp', ardango.BuildCurrPackage, opts)
-- Adds tag element to the field under the cursor field.
vim.keymap.set('n', '<leader>taf', ardango.AddTagToField, { buffer = 0 })
-- Adds tag element to all fields of the struct under the cursor field.
vim.keymap.set('n', '<leader>tas', ardango.AddTagsToStruct, { buffer = 0 })
-- Removes tag element from the field under the cursor.
vim.keymap.set('n', '<leader>trf', ardango.RemoveTagFromField, { buffer = 0 })
-- Removes tag element from the all fields of the struct under the cursor.
vim.keymap.set('n', '<leader>trs', ardango.RemoveTagsFromStruct, { buffer = 0 })

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published