mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Compare commits
No commits in common. "ab88c112ffc6270e7b37e33cbc5181fa5c63f94d" and "84d73660fa551f85c6a5236950c13b51e9756da4" have entirely different histories.
ab88c112ff
...
84d73660fa
@ -36,7 +36,7 @@
|
|||||||
# Introduction
|
# Introduction
|
||||||
|
|
||||||
This repo hosts my Nvim configuration for Linux, macOS, and Windows.
|
This repo hosts my Nvim configuration for Linux, macOS, and Windows.
|
||||||
`init.lua` is the config entry point for terminal Nvim,
|
`init.vim` is the config entry point for terminal Nvim,
|
||||||
and `ginit.vim` is the additional config file for [GUI client of Nvim](https://github.com/neovim/neovim/wiki/Related-projects#gui).
|
and `ginit.vim` is the additional config file for [GUI client of Nvim](https://github.com/neovim/neovim/wiki/Related-projects#gui).
|
||||||
|
|
||||||
My configurations are heavily documented to make it as clear as possible.
|
My configurations are heavily documented to make it as clear as possible.
|
||||||
|
|||||||
@ -87,7 +87,7 @@ xnoremap > >gv
|
|||||||
inoremap <expr> <tab> pumvisible() ? "\<c-n>" : "\<tab>"
|
inoremap <expr> <tab> pumvisible() ? "\<c-n>" : "\<tab>"
|
||||||
inoremap <expr> <s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"
|
inoremap <expr> <s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"
|
||||||
|
|
||||||
" Edit and reload nvim config file quickly
|
" Edit and reload init.vim quickly
|
||||||
nnoremap <silent> <leader>ev :<C-U>tabnew $MYVIMRC <bar> tcd %:h<cr>
|
nnoremap <silent> <leader>ev :<C-U>tabnew $MYVIMRC <bar> tcd %:h<cr>
|
||||||
nnoremap <silent> <leader>sv :<C-U>silent update $MYVIMRC <bar> source $MYVIMRC <bar>
|
nnoremap <silent> <leader>sv :<C-U>silent update $MYVIMRC <bar> source $MYVIMRC <bar>
|
||||||
\ call v:lua.vim.notify("Nvim config successfully reloaded!", 'info', {'title': 'nvim-config'})<cr>
|
\ call v:lua.vim.notify("Nvim config successfully reloaded!", 'info', {'title': 'nvim-config'})<cr>
|
||||||
|
|||||||
34
init.lua
34
init.lua
@ -1,34 +0,0 @@
|
|||||||
-- This is my personal Nvim configuration supporting Mac, Linux and Windows, with various plugins configured.
|
|
||||||
-- This configuration evolves as I learn more about Nvim and become more proficient in using Nvim.
|
|
||||||
-- Since it is very long (more than 1000 lines!), you should read it carefully and take only the settings that suit you.
|
|
||||||
-- I would not recommend cloning this repo and replace your own config. Good configurations are personal,
|
|
||||||
-- built over time with a lot of polish.
|
|
||||||
--
|
|
||||||
-- Author: Jie-dong Hao
|
|
||||||
-- Email: jdhao@hotmail.com
|
|
||||||
-- Blog: https://jdhao.github.io/
|
|
||||||
|
|
||||||
local utils = require "utils"
|
|
||||||
local match_res = utils.check_version_match()
|
|
||||||
|
|
||||||
if not match_res.match then
|
|
||||||
local msg = string.format("Nvim version mistmatch: %s expected, but got %s instead!", match_res.expected, match_res.actual)
|
|
||||||
vim.api.nvim_echo({ { msg, "ErrorMsg" } }, false, {})
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local core_conf_files = {
|
|
||||||
"globals.vim",
|
|
||||||
"options.vim",
|
|
||||||
"autocommands.vim",
|
|
||||||
"mappings.vim",
|
|
||||||
"plugins.vim",
|
|
||||||
"themes.vim",
|
|
||||||
}
|
|
||||||
|
|
||||||
-- source all the core config files
|
|
||||||
for _, name in ipairs(core_conf_files) do
|
|
||||||
local path = string.format("%s/core/%s", vim.fn.stdpath('config'), name)
|
|
||||||
local source_cmd = "source " .. path
|
|
||||||
vim.cmd(source_cmd)
|
|
||||||
end
|
|
||||||
31
init.vim
Normal file
31
init.vim
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
" This is my personal Nvim configuration supporting Mac, Linux and Windows, with various plugins configured.
|
||||||
|
" This configuration evolves as I learn more about Nvim and become more proficient in using Nvim.
|
||||||
|
" Since it is very long (more than 1000 lines!), you should read it carefully and take only the settings that suit you.
|
||||||
|
" I would not recommend cloning this repo and replace your own config. Good configurations are personal,
|
||||||
|
" built over time with a lot of polish.
|
||||||
|
"
|
||||||
|
" Author: Jie-dong Hao
|
||||||
|
" Email: jdhao@hotmail.com
|
||||||
|
" Blog: https://jdhao.github.io/
|
||||||
|
|
||||||
|
" check if we have the lastest stable version of nvim
|
||||||
|
let s:expect_ver = printf('nvim-%s', '0.7.2')
|
||||||
|
let s:actual_ver = matchstr(execute('version'), 'NVIM v\zs[^\n]*')
|
||||||
|
|
||||||
|
if !has(s:expect_ver)
|
||||||
|
echohl Error | echomsg printf("%s required, but got nvim %s!", s:expect_ver, s:actual_ver) | echohl None
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:core_conf_files = [
|
||||||
|
\ 'globals.vim',
|
||||||
|
\ 'options.vim',
|
||||||
|
\ 'autocommands.vim',
|
||||||
|
\ 'mappings.vim',
|
||||||
|
\ 'plugins.vim',
|
||||||
|
\ 'themes.vim'
|
||||||
|
\ ]
|
||||||
|
|
||||||
|
for s:fname in s:core_conf_files
|
||||||
|
execute printf('source %s/core/%s', stdpath('config'), s:fname)
|
||||||
|
endfor
|
||||||
@ -139,7 +139,7 @@ packer.startup({
|
|||||||
use({ "akinsho/bufferline.nvim", event = "VimEnter", config = [[require('config.bufferline')]] })
|
use({ "akinsho/bufferline.nvim", event = "VimEnter", config = [[require('config.bufferline')]] })
|
||||||
|
|
||||||
-- fancy start screen
|
-- fancy start screen
|
||||||
use { 'glepnir/dashboard-nvim', event = "VimEnter", config = [[require('config.dashboard-nvim')]] }
|
use { 'glepnir/dashboard-nvim', config = [[require('config.dashboard-nvim')]] }
|
||||||
|
|
||||||
use({
|
use({
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
|
|||||||
@ -25,23 +25,4 @@ function M.may_create_dir()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.check_version_match()
|
|
||||||
-- check if we have the lastest stable version of nvim
|
|
||||||
local expected_ver = {major = 0, minor = 7, patch = 2}
|
|
||||||
local actual_ver = vim.version()
|
|
||||||
|
|
||||||
local ver_match = true
|
|
||||||
for key, val in pairs(expected_ver) do
|
|
||||||
if val ~= actual_ver[key] then
|
|
||||||
ver_match = false
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local expect_ver_str = string.format("%s.%s.%s", expected_ver.major, expected_ver.minor, expected_ver.patch)
|
|
||||||
local nvim_ver_str = string.format("%s.%s.%s", actual_ver.major, actual_ver.minor, actual_ver.patch)
|
|
||||||
|
|
||||||
return {match=ver_match, expected=expect_ver_str, actual=nvim_ver_str}
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user