Skip to content

sholland1/dotnet-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

.NET Commands plugin

A Neovim plugin that provides convenient commands for managing .NET projects, solutions, and packages.

Features

  • Nuget Packages - add, update, remove
  • Project References - add, remove
  • Projects in Solution - add, remove
  • Add new project from templates
  • Add new file from templates
  • Previews
  • List available commands
  • Powershell, sh
  • Update all nuget packages command
  • Add package, choose version
  • Update single package, choose version
  • Other nuget sources
  • New project, choose target framework
  • New project, choose language
  • Handle fsproj and vbproj

Installation

lazy.nvim

  {
    -- required config
    "sholland1/dotnet-plugin",
    dependencies = "nvim-telescope/telescope.nvim",

    -- optional config
    opts = {
      shell = vim.fn.has('win32') == 1 and "powershell" or "sh",
      --execute_with = "cmd_line",
      -- or
      --execute_with = "terminal",
    },
    keys = {
      {'<leader>.', '<cmd>Telescope dotnet-plugin theme=ivy<cr>', { desc = '.NET Command List' }},
    },
  },

Options

Name Choices Default Description
shell sh, powershell sh Specifies the shell to use for executing commands.
execute_with cmd_line, terminal cmd_line Determines how commands are executed. (command line or terminal window)

Exports

The following lua functions are exported.

  -- declare desired telescope opts
  local telescope_opts = {}

  -- require the plugin
  local dotnet = require("dotnet-plugin")

  -- call a function
  dotnet.plugin_command_list(telescope_opts)
  dotnet.dotnet_new_item(telescope_opts)
  dotnet.dotnet_new_project(telescope_opts)
  dotnet.dotnet_nuget_add(telescope_opts)
  dotnet.dotnet_nuget_remove(telescope_opts)
  dotnet.dotnet_nuget_update(telescope_opts)
  dotnet.dotnet_nuget_update_all()
  dotnet.dotnet_reference_add(telescope_opts)
  dotnet.dotnet_reference_remove(telescope_opts)
  dotnet.dotnet_sln_project_add(telescope_opts)
  dotnet.dotnet_sln_project_remove(telescope_opts)

Powershell configuration

To configure Neovim to use powershell instead of cmd on Windows, put the following in your Neovim config.

if vim.fn.has('win32') == 1 then
    vim.opt.shell = 'powershell'
    vim.opt.shellcmdflag = [[-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues['Out-File:Encoding']='utf8';]]
    vim.opt.shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode'
    vim.opt.shellpipe  = '2>&1 | %%{ "$_" } | tee %s; exit $LastExitCode'
    vim.opt.shellquote = ''
    vim.opt.shellxquote = ''
end

Dependencies

  • .NET SDK (dotnet)
  • telescope.nvim

Required shell commands (Linux)

cd, curl, dirname, find, git, ls-files, popd, pushd, realpath, sed, sort, tail, xargs

Other .NET Neovim plugins

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published