Skip to content

Commit

Permalink
feat(none-ls.nvim): migrate from 'nvim-lint' to 'none-ls.nvim'
Browse files Browse the repository at this point in the history
  • Loading branch information
linrongbin16 committed Oct 2, 2023
1 parent 3b56731 commit bbd799b
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 18 deletions.
34 changes: 27 additions & 7 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ function NvimConfig()
Message "install $NVIM_HOME for neovim on windows"
TryBackup $env:USERPROFILE\.nvim
Start-Process powershell "cmd /c mklink $env:USERPROFILE\.nvim $NVIM_HOME /D" -Verb RunAs -Wait
# lsp management

# mason-lspconfig.nvim
$MasonLspconfigHome = "$NVIM_HOME\lua\configs\williamboman\mason-lspconfig-nvim"
$MasonLspconfigEnsureInstalled = "$MasonLspconfigHome\ensure_installed.lua"
if (-not(TestReparsePoint $MasonLspconfigEnsureInstalled) -and -not(Test-Path $MasonLspconfigEnsureInstalled))
Expand All @@ -154,18 +155,37 @@ function NvimConfig()
{
Copy-Item -Path "$MasonLspconfigHome\setup_handlers_sample.lua" -Destination "$MasonLspconfigSetupHandlers"
}

# mason-null-ls.nvim
$MasonNulllsHome = "$NVIM_HOME\lua\configs\jay-babu\mason-null-ls-nvim"
$MasonNulllsEnsureInstalled = "$MasonNulllsHome\ensure_installed.lua"
if (-not(TestReparsePoint $MasonNulllsEnsureInstalled) -and -not(Test-Path $MasonNulllsEnsureInstalled))
{
Copy-Item -Path "$MasonNulllsHome\ensure_installed_sample.lua" -Destination "$MasonNulllsEnsureInstalled"
}
$MasonNulllsSetupHandlers = "$MasonNulllsHome\setup_handlers.lua"
if (-not(TestReparsePoint $MasonNulllsSetupHandlers) -and -not(Test-Path $MasonNulllsSetupHandlers))
{
Copy-Item -Path "$MasonNulllsHome\setup_handlers_sample.lua" -Destination "$MasonNulllsSetupHandlers"
}

# conform.nvim
$ConformHome = "$NVIM_HOME\lua\configs\stevearc\conform-nvim"
$ConformFormattersByFt = "$ConformHome\formatters_by_ft.lua"
if (-not(TestReparsePoint $ConformFormattersByFt) -and -not(Test-Path $ConformFormattersByFt))
{
Copy-Item -Path "$ConformHome\formatters_by_ft_sample.lua" -Destination "$ConformFormattersByFt"
}
$NvimLintHome="$NVIM_HOME\lua\configs\mfussenegger\nvim-lint"
$NvimLintLintersByFt="$NvimLintHome\linters_by_ft.lua"
if (-not(TestReparsePoint $NvimLintLintersByFt) -and -not(Test-Path $NvimLintLintersByFt))
{
Copy-Item -Path "$NvimLintHome\linters_by_ft_sample.lua" -Destination "$NvimLintLintersByFt"
}

# nvim-lint
# $NvimLintHome="$NVIM_HOME\lua\configs\mfussenegger\nvim-lint"
# $NvimLintLintersByFt="$NvimLintHome\linters_by_ft.lua"
# if (-not(TestReparsePoint $NvimLintLintersByFt) -and -not(Test-Path $NvimLintLintersByFt))
# {
# Copy-Item -Path "$NvimLintHome\linters_by_ft_sample.lua" -Destination "$NvimLintLintersByFt"
# }

# neoconf.nvim
$Neoconf = "$NVIM_HOME\neoconf.json"
if (-not(TestReparsePoint $Neoconf) -and -not(Test-Path $Neoconf))
{
Expand Down
32 changes: 25 additions & 7 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ nvim_config() {
mkdir -p $HOME/.config
try_backup $HOME/.nvim
ln -s $NVIM_HOME $HOME/.nvim
# lsp management

# mason-lspconfig.nvim
local mason_lspconfig_home="$NVIM_HOME/lua/configs/williamboman/mason-lspconfig-nvim"
local mason_lspconfig_ensure_installed="$mason_lspconfig_home/ensure_installed.lua"
if [ ! -f $mason_lspconfig_ensure_installed ]; then
Expand All @@ -97,16 +98,33 @@ nvim_config() {
if [ ! -f $mason_lspconfig_setup_handlers ]; then
cp $mason_lspconfig_home/setup_handlers_sample.lua $mason_lspconfig_setup_handlers
fi

# mason-null-ls.nvim
local mason_null_ls_home="$NVIM_HOME/lua/configs/jay-babu/mason-null-ls-nvim"
local mason_null_ls_ensure_installed="$mason_null_ls_home/ensure_installed.lua"
if [ ! -f $mason_null_ls_ensure_installed ]; then
cp $mason_null_ls_home/ensure_installed_sample.lua $mason_null_ls_ensure_installed
fi
local mason_null_ls_setup_handlers="$mason_null_ls_home/setup_handlers.lua"
if [ ! -f $mason_null_ls_setup_handlers ]; then
cp $mason_null_ls_home/setup_handlers_sample.lua $mason_null_ls_setup_handlers
fi

# conform.nvim
local conform_home="$NVIM_HOME/lua/configs/stevearc/conform-nvim"
local conform_formatters_by_ft="$conform_home/formatters_by_ft.lua"
if [ ! -f $conform_formatters_by_ft ]; then
cp $conform_home/formatters_by_ft_sample.lua $conform_formatters_by_ft
fi
local nvim_lint_home="$NVIM_HOME/lua/configs/mfussenegger/nvim-lint"
local nvim_lint_linters_by_ft="$nvim_lint_home/linters_by_ft.lua"
if [ ! -f $nvim_lint_linters_by_ft ]; then
cp $nvim_lint_home/linters_by_ft_sample.lua $nvim_lint_linters_by_ft
fi

# nvim-lint
# local nvim_lint_home="$NVIM_HOME/lua/configs/mfussenegger/nvim-lint"
# local nvim_lint_linters_by_ft="$nvim_lint_home/linters_by_ft.lua"
# if [ ! -f $nvim_lint_linters_by_ft ]; then
# cp $nvim_lint_home/linters_by_ft_sample.lua $nvim_lint_linters_by_ft
# fi

# neoconf.nvim
local neoconf="$NVIM_HOME/neoconf.json"
if [ ! -f $neoconf ]; then
cp $NVIM_HOME/neoconf_sample.json $neoconf
Expand Down Expand Up @@ -156,4 +174,4 @@ npm_dependency
guifont_dependency
nvim_config

message "install for $OS - done"
message "install for $OS - done"
13 changes: 9 additions & 4 deletions lua/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -200,22 +200,27 @@ local M = {
config = lua_config("williamboman/mason-lspconfig.nvim"),
},
{
"stevearc/conform.nvim",
"nvimtools/none-ls.nvim",
event = { VeryLazy, BufReadPre, BufNewFile, CmdlineEnter },
},
{
"jay-babu/mason-null-ls.nvim",
event = { VeryLazy, BufReadPre, BufNewFile, CmdlineEnter },
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"nvimtools/none-ls.nvim",
},
config = lua_config("stevearc/conform.nvim"),
config = lua_config("jay-babu/mason-null-ls.nvim"),
},
{
"mfussenegger/nvim-lint",
"stevearc/conform.nvim",
event = { VeryLazy, BufReadPre, BufNewFile, CmdlineEnter },
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
},
config = lua_config("mfussenegger/nvim-lint"),
config = lua_config("stevearc/conform.nvim"),
},
-- Auto-complete engine
{
Expand Down

0 comments on commit bbd799b

Please sign in to comment.