1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Compare commits

..

3 Commits

Author SHA1 Message Date
jdhao
6e60475f3f Use gx.nvim for browsing in Browser 2024-08-16 00:03:43 +02:00
jdhao
d90273df8e remove lua_ls conf in favor of lazydev.nvim
The removed settings are already set by lazydev.nvim.
2024-08-15 23:44:50 +02:00
jdhao
659f410b9e move version check into function 2024-08-15 23:38:31 +02:00
5 changed files with 41 additions and 48 deletions

View File

@ -11,26 +11,10 @@
-- StackOverflow: https://stackoverflow.com/users/6064933/jdhao
vim.loader.enable()
local version = vim.version
local utils = require("utils")
-- check if we have the latest stable version of nvim
local expected_ver_str = "0.10.1"
local expect_ver = version.parse(expected_ver_str)
local actual_ver = vim.version()
if expect_ver == nil then
local msg = string.format("Unsupported version string: %s", expected_ver_str)
vim.api.nvim_err_writeln(msg)
return
end
local result = version.cmp(expect_ver, actual_ver)
if result ~= 0 then
local _ver = string.format("%s.%s.%s", actual_ver.major, actual_ver.minor, actual_ver.patch)
local msg = string.format("Expect nvim %s, but got %s instead. Use at your own risk!", expected_ver_str, _ver)
vim.api.nvim_err_writeln(msg)
end
local expected_version = "0.10.1"
utils.is_compatible_version(expected_version)
local core_conf_files = {
"globals.lua", -- some global settings

View File

@ -230,22 +230,6 @@ if utils.executable("lua-language-server") then
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT",
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { "vim" },
},
workspace = {
-- Make the server aware of Neovim runtime files,
-- see also https://luals.github.io/wiki/settings/#workspacelibrary
library = {
vim.env.VIMRUNTIME,
fn.stdpath("config"),
-- make lua_ls aware of functions under vim.uv
"${3rd}/luv/library"
},
maxPreload = 2000,
preloadFileSize = 50000,
},
},
},
capabilities = capabilities,

View File

@ -223,7 +223,12 @@ local plugin_specs = {
-- For Windows and Mac, we can open an URL in the browser. For Linux, it may
-- not be possible since we maybe in a server which disables GUI.
{
"tyru/open-browser.vim",
"chrishrb/gx.nvim",
keys = { { "gx", "<cmd>Browse<cr>", mode = { "n", "x" } } },
cmd = { "Browse" },
init = function()
vim.g.netrw_nogx = 1 -- disable netrw gx
end,
enabled = function()
if vim.g.is_win or vim.g.is_mac then
return true
@ -231,7 +236,9 @@ local plugin_specs = {
return false
end
end,
event = "VeryLazy",
dependencies = { "nvim-lua/plenary.nvim" },
config = true, -- default settings
submodules = false, -- not needed, submodules are required only for tests
},
-- Only install these plugins if ctags are installed on the system

View File

@ -1,4 +1,5 @@
local fn = vim.fn
local version = vim.version
local M = {}
@ -50,4 +51,32 @@ function M.rand_element(seq)
return seq[idx]
end
--- check if the current nvim version is compatible with the allowed version
--- @param expected_version string
--- @return boolean
function M.is_compatible_version(expected_version)
-- check if we have the latest stable version of nvim
local expect_ver = version.parse(expected_version)
local actual_ver = vim.version()
if expect_ver == nil then
local msg = string.format("Unsupported version string: %s", expected_version)
vim.api.nvim_err_writeln(msg)
return false
end
local result = version.cmp(expect_ver, actual_ver)
if result ~= 0 then
local _ver = string.format("%s.%s.%s", actual_ver.major, actual_ver.minor, actual_ver.patch)
local msg = string.format(
"Expect nvim version %s, but your current nvim version is %s. Use at your own risk!",
expected_version,
_ver
)
vim.api.nvim_err_writeln(msg)
end
return true
end
return M

View File

@ -113,17 +113,6 @@ let g:Lf_PreviewResult = {
\ 'Gtags': 0
\}
""""""""""""""""""""""""""""open-browser.vim settings"""""""""""""""""""
if g:is_win || g:is_mac
" Disable netrw's gx mapping.
let g:netrw_nogx = 1
" Use another mapping for the open URL method
nmap <leader>ob <Plug>(openbrowser-smart-search)
xmap <leader>ob <Plug>(openbrowser-smart-search)
nmap ob <cmd>echoerr "Use <leader>ob instead!"<CR>
endif
""""""""""""""""""""""""""" vista settings """"""""""""""""""""""""""""""""""
let g:vista#renderer#icons = {
\ 'member': '',