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

Compare commits

..

No commits in common. "6e60475f3f956ee4b7a2a2deea47f44d9676ed9a" and "a602d9881982ec209218299bad200c98f53b2259" have entirely different histories.

5 changed files with 48 additions and 41 deletions

View File

@ -11,10 +11,26 @@
-- StackOverflow: https://stackoverflow.com/users/6064933/jdhao
vim.loader.enable()
local utils = require("utils")
local version = vim.version
local expected_version = "0.10.1"
utils.is_compatible_version(expected_version)
-- 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 core_conf_files = {
"globals.lua", -- some global settings

View File

@ -230,6 +230,22 @@ 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,12 +223,7 @@ 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.
{
"chrishrb/gx.nvim",
keys = { { "gx", "<cmd>Browse<cr>", mode = { "n", "x" } } },
cmd = { "Browse" },
init = function()
vim.g.netrw_nogx = 1 -- disable netrw gx
end,
"tyru/open-browser.vim",
enabled = function()
if vim.g.is_win or vim.g.is_mac then
return true
@ -236,9 +231,7 @@ local plugin_specs = {
return false
end
end,
dependencies = { "nvim-lua/plenary.nvim" },
config = true, -- default settings
submodules = false, -- not needed, submodules are required only for tests
event = "VeryLazy",
},
-- Only install these plugins if ctags are installed on the system

View File

@ -1,5 +1,4 @@
local fn = vim.fn
local version = vim.version
local M = {}
@ -51,32 +50,4 @@ 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,6 +113,17 @@ 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': '',