mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Compare commits
3 Commits
a602d98819
...
6e60475f3f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e60475f3f | ||
|
|
d90273df8e | ||
|
|
659f410b9e |
22
init.lua
22
init.lua
@ -11,26 +11,10 @@
|
|||||||
-- StackOverflow: https://stackoverflow.com/users/6064933/jdhao
|
-- StackOverflow: https://stackoverflow.com/users/6064933/jdhao
|
||||||
vim.loader.enable()
|
vim.loader.enable()
|
||||||
|
|
||||||
local version = vim.version
|
local utils = require("utils")
|
||||||
|
|
||||||
-- check if we have the latest stable version of nvim
|
local expected_version = "0.10.1"
|
||||||
local expected_ver_str = "0.10.1"
|
utils.is_compatible_version(expected_version)
|
||||||
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 = {
|
local core_conf_files = {
|
||||||
"globals.lua", -- some global settings
|
"globals.lua", -- some global settings
|
||||||
|
|||||||
@ -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)
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
version = "LuaJIT",
|
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,
|
capabilities = capabilities,
|
||||||
|
|||||||
@ -223,7 +223,12 @@ local plugin_specs = {
|
|||||||
-- For Windows and Mac, we can open an URL in the browser. For Linux, it may
|
-- 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.
|
-- 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()
|
enabled = function()
|
||||||
if vim.g.is_win or vim.g.is_mac then
|
if vim.g.is_win or vim.g.is_mac then
|
||||||
return true
|
return true
|
||||||
@ -231,7 +236,9 @@ local plugin_specs = {
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
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
|
-- Only install these plugins if ctags are installed on the system
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
local fn = vim.fn
|
local fn = vim.fn
|
||||||
|
local version = vim.version
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
@ -50,4 +51,32 @@ function M.rand_element(seq)
|
|||||||
return seq[idx]
|
return seq[idx]
|
||||||
end
|
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
|
return M
|
||||||
|
|||||||
@ -113,17 +113,6 @@ let g:Lf_PreviewResult = {
|
|||||||
\ 'Gtags': 0
|
\ '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 """"""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""" vista settings """"""""""""""""""""""""""""""""""
|
||||||
let g:vista#renderer#icons = {
|
let g:vista#renderer#icons = {
|
||||||
\ 'member': '',
|
\ 'member': '',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user