pwsh & rustfmt
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
function! neoformat#formatters#pwsh#enabled() abort
|
||||||
|
return ['pwshfmt']
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! neoformat#formatters#pwsh#pwshfmt() abort
|
||||||
|
if has('win32') || has('win64')
|
||||||
|
let l:args = [
|
||||||
|
\ '-NoProfile',
|
||||||
|
\ '-Command',
|
||||||
|
\ 'Invoke-Formatter',
|
||||||
|
\ ]
|
||||||
|
else
|
||||||
|
let l:args = [
|
||||||
|
\ '-NoProfile',
|
||||||
|
\ '-Command',
|
||||||
|
\ '"Import-Module (Resolve-Path \"/opt/powershell-editor-services/PSScriptAnalyzer/*/PSScriptAnalyzer.psd1\" | Select-Object -ExpandProperty Path); Invoke-Formatter -ScriptDefinition (\$input | Out-String)"'
|
||||||
|
\ ]
|
||||||
|
endif
|
||||||
|
|
||||||
|
return {
|
||||||
|
\ 'exe': 'pwsh',
|
||||||
|
\ 'args': l:args,
|
||||||
|
\ 'stdin': 1,
|
||||||
|
\ }
|
||||||
|
endfunction
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
local bufnr = vim.api.nvim_get_current_buf()
|
||||||
|
vim.keymap.set(
|
||||||
|
"n",
|
||||||
|
"<leader>a",
|
||||||
|
function()
|
||||||
|
vim.cmd.RustLsp('codeAction') -- supports rust-analyzer's grouping
|
||||||
|
-- or vim.lsp.buf.codeAction() if you don't want grouping.
|
||||||
|
end,
|
||||||
|
{ silent = true, buffer = bufnr }
|
||||||
|
)
|
||||||
|
vim.keymap.set(
|
||||||
|
"n",
|
||||||
|
"K", -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions
|
||||||
|
function()
|
||||||
|
vim.cmd.RustLsp({'hover', 'actions'})
|
||||||
|
end,
|
||||||
|
{ silent = true, buffer = bufnr }
|
||||||
|
)
|
||||||
@@ -12,7 +12,8 @@ M.plugin = {
|
|||||||
vim.g.neoformat_enabled_sh = { "shfmt" }
|
vim.g.neoformat_enabled_sh = { "shfmt" }
|
||||||
vim.g.neoformat_enabled_bash = { "shfmt" }
|
vim.g.neoformat_enabled_bash = { "shfmt" }
|
||||||
vim.g.neoformat_enabled_zsh = { "shfmt" }
|
vim.g.neoformat_enabled_zsh = { "shfmt" }
|
||||||
vim.g.neoformat_enabled_powershell = { "pwshfmt" } -- experimental
|
vim.g.neoformat_enabled_rust = { "rustfmt" }
|
||||||
|
vim.g.neoformat_enabled_pwsh = { "pwshfmt" }
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ prettier.setup({
|
|||||||
"json",
|
"json",
|
||||||
"less",
|
"less",
|
||||||
"markdown",
|
"markdown",
|
||||||
|
"rust",
|
||||||
"scss",
|
"scss",
|
||||||
"typescript",
|
"typescript",
|
||||||
"typescriptreact",
|
"typescriptreact",
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ return {
|
|||||||
---@type render.md.UserConfig
|
---@type render.md.UserConfig
|
||||||
opts = require "config.format.markdown",
|
opts = require "config.format.markdown",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'mrcjkb/rustaceanvim',
|
||||||
|
version = '^9',
|
||||||
|
-- lazy = false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ $packages = @(
|
|||||||
"GNU.Wget2",
|
"GNU.Wget2",
|
||||||
"GnuWin32.UnZip",
|
"GnuWin32.UnZip",
|
||||||
"GnuWin32.Gzip",
|
"GnuWin32.Gzip",
|
||||||
"7zip.7zip"
|
"7zip.7zip",
|
||||||
|
"PSScriptAnalyzer"
|
||||||
)
|
)
|
||||||
|
|
||||||
for ($i = 0; $i -lt $packages.Count; $i++) {
|
for ($i = 0; $i -lt $packages.Count; $i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user