diff --git a/nvim/lua/config/lsp.lua b/nvim/lua/config/lsp.lua index 07302807..5efd9511 100644 --- a/nvim/lua/config/lsp.lua +++ b/nvim/lua/config/lsp.lua @@ -3,6 +3,10 @@ ------------- -- See ~/.dotfiles/vim/plugins.vim for the Plug directives +if not pcall(require, 'lspconfig') then + print("Warning: lspconfig not available, skipping configuration.") + return +end local lspconfig = require('lspconfig') -- lsp_signature diff --git a/nvim/lua/config/statusline.lua b/nvim/lua/config/statusline.lua index f3f119f6..6fb635dc 100644 --- a/nvim/lua/config/statusline.lua +++ b/nvim/lua/config/statusline.lua @@ -1,5 +1,9 @@ -- Statusline config: lualine.nvim +if not pcall(require, 'lualine') then + print("Warning: lualine not available, skipping configuration.") + return +end -- From nvim-lualine/lualine.nvim/wiki/Component-snippets --- @param trunc_width number trunctates component when screen width is less then trunc_width diff --git a/nvim/lua/config/telescope.lua b/nvim/lua/config/telescope.lua index 7ffe65ea..df0469ac 100644 --- a/nvim/lua/config/telescope.lua +++ b/nvim/lua/config/telescope.lua @@ -3,6 +3,11 @@ --------------- -- @see :help telescope.setup -- @see https://github.com/nvim-telescope/telescope.nvim#telescope-setup-structure +-- +if not pcall(require, 'telescope') then + print("Warning: telescope not available, skipping configuration.") + return +end local telescope = require("telescope") if not pcall(require, 'telescope.actions.layout') then diff --git a/nvim/lua/config/treesitter.lua b/nvim/lua/config/treesitter.lua index 89a59872..39142a17 100644 --- a/nvim/lua/config/treesitter.lua +++ b/nvim/lua/config/treesitter.lua @@ -2,6 +2,7 @@ -- https://github.com/nvim-treesitter/nvim-treesitter if not pcall(require, 'nvim-treesitter') then + print("Warning: treesitter not available, skipping configuration.") return end diff --git a/vim/plugins.vim b/vim/plugins.vim index 610e3755..6dd640c3 100644 --- a/vim/plugins.vim +++ b/vim/plugins.vim @@ -95,7 +95,7 @@ if has('nvim-0.5.0') else Plug 'airblade/vim-gitgutter' endif -if has('nvim-0.5.0') +if has('nvim-0.7.0') Plug 'sindrets/diffview.nvim' endif if has('nvim-0.4.0') && exists('*nvim_open_win') @@ -175,10 +175,12 @@ if has('nvim-0.5.0') Plug 'nvim-neo-tree/neo-tree.nvim', {'branch': 'main'} Plug 'MunifTanjim/nui.nvim' Plug 'nvim-lua/plenary.nvim' - Plug 'nvim-telescope/telescope.nvim', PinIf(!has('nvim-0.6.0'), {'commit': '80cdb00'}) +endif +if has('nvim-0.7.0') + Plug 'nvim-telescope/telescope.nvim' endif -if has('nvim-0.6.1') +if has('nvim-0.7.0') " Treesitter (see ~/.config/nvim/lua/config/treesitter.lua) function! TSUpdate(arg) abort if luaeval('pcall(require, "nvim-treesitter")') @@ -208,12 +210,12 @@ endif " Syntax, Completion, Language Servers, etc. " ------------------------------------------ -let g:dotfiles_completion_backend = has('nvim-0.5.0') ? '@lsp' : '' +let g:dotfiles_completion_backend = has('nvim-0.7.0') ? '@lsp' : '' " 1. [Neovim 0.5.0 LSP] " See also for more config: ~/.config/nvim/lua/config/lsp.lua if g:dotfiles_completion_backend == '@lsp' - Plug 'neovim/nvim-lspconfig', PinIf(!has('nvim-0.7'), {'tag': 'v0.1.3'}) + Plug 'neovim/nvim-lspconfig' Plug 'williamboman/nvim-lsp-installer' Plug 'folke/lua-dev.nvim' diff --git a/vim/vimrc b/vim/vimrc index 06c5b20a..81285c66 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -16,9 +16,15 @@ endif " Check neovim version. if has('nvim') && !has('nvim-0.7.0') - let s:warning_msg = 'Please upgrade to latest neovim (0.7.0+). Support for neovim <= 0.6 will be dropped soon. ' - let s:install_command_hint = printf('(Try: %s install neovim)', has('mac') ? 'brew' : 'dotfiles') - autocmd VimEnter * echohl WarningMsg | echom s:warning_msg . s:install_command_hint | echohl None + let s:warning_msg = 'Please upgrade to latest neovim (0.7.0+). Support for neovim < 0.7 will be dropped soon. ' + let s:warning_msg .= printf('(Try: %s install neovim)', has('mac') ? 'brew' : 'dotfiles') + if exists('*luaeval') + autocmd VimEnter * call timer_start(100, { -> + \ luaeval("vim.notify(_A[1], _A[2], _A[3])", [s:warning_msg, 'error', {'title': 'Deprecation Warning'}]) + \ }) + else + autocmd VimEnter * echohl WarningMsg | echom s:warning_msg | echohl None + endif endif """""""""""""""""""""""""""""""""""""""""