mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Compare commits
10 Commits
baa8f26bc2
...
v0.8.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43c1615822 | ||
|
|
509a8bce8c | ||
|
|
8b10be60d4 | ||
|
|
074d2bbdfd | ||
|
|
7f9af87185 | ||
|
|
bb0b0c5e25 | ||
|
|
7bb12e4b70 | ||
|
|
41da56b823 | ||
|
|
82f2332281 | ||
|
|
075326ee2e |
10
README.md
10
README.md
@@ -13,7 +13,7 @@
|
|||||||
<img alt="Latest release" src="https://img.shields.io/github/v/release/jdhao/nvim-config" />
|
<img alt="Latest release" src="https://img.shields.io/github/v/release/jdhao/nvim-config" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/neovim/neovim/releases/tag/stable">
|
<a href="https://github.com/neovim/neovim/releases/tag/stable">
|
||||||
<img src="https://img.shields.io/badge/Neovim-0.8.0-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/>
|
<img src="https://img.shields.io/badge/Neovim-0.8.1-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/jdhao/nvim-config/search?l=vim-script">
|
<a href="https://github.com/jdhao/nvim-config/search?l=vim-script">
|
||||||
<img src="https://img.shields.io/github/languages/top/jdhao/nvim-config" alt="Top languages"/>
|
<img src="https://img.shields.io/github/languages/top/jdhao/nvim-config" alt="Top languages"/>
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
<a href="https://github.com/jdhao/nvim-config/graphs/commit-activity">
|
<a href="https://github.com/jdhao/nvim-config/graphs/commit-activity">
|
||||||
<img src="https://img.shields.io/github/commit-activity/m/jdhao/nvim-config?style=flat-square" />
|
<img src="https://img.shields.io/github/commit-activity/m/jdhao/nvim-config?style=flat-square" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/jdhao/nvim-config/releases/tag/v0.8.0">
|
<a href="https://github.com/jdhao/nvim-config/releases/tag/v0.8.1">
|
||||||
<img src="https://img.shields.io/github/commits-since/jdhao/nvim-config/v0.8.0?style=flat-square" />
|
<img src="https://img.shields.io/github/commits-since/jdhao/nvim-config/v0.8.1?style=flat-square" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/jdhao/nvim-config/graphs/contributors">
|
<a href="https://github.com/jdhao/nvim-config/graphs/contributors">
|
||||||
<img src="https://img.shields.io/github/contributors/jdhao/nvim-config?style=flat-square" />
|
<img src="https://img.shields.io/github/contributors/jdhao/nvim-config?style=flat-square" />
|
||||||
@@ -79,7 +79,7 @@ and how to set up on different platforms (Linux, macOS, and Windows).
|
|||||||
+ Code editing using true nvim inside browser via [firenvim](https://github.com/glacambre/firenvim).
|
+ Code editing using true nvim inside browser via [firenvim](https://github.com/glacambre/firenvim).
|
||||||
+ Beautiful colorscheme via [sainnhe/gruvbox-material](https://github.com/sainnhe/gruvbox-material) and other colorschemes.
|
+ Beautiful colorscheme via [sainnhe/gruvbox-material](https://github.com/sainnhe/gruvbox-material) and other colorschemes.
|
||||||
+ Markdown writing and previewing via [vim-markdown](https://github.com/preservim/vim-markdown) and [markdown-preview.nvim](https://github.com/iamcco/markdown-preview.nvim).
|
+ Markdown writing and previewing via [vim-markdown](https://github.com/preservim/vim-markdown) and [markdown-preview.nvim](https://github.com/iamcco/markdown-preview.nvim).
|
||||||
+ LaTeX editing and previewing via [vimtex](https://github.com/lervag/vimtex) <sup id="a1">[1](#f1)</sup>.
|
+ LaTeX editing and previewing via [vimtex](https://github.com/lervag/vimtex)
|
||||||
+ Animated GUI style notification via [nvim-notify](https://github.com/rcarriga/nvim-notify).
|
+ Animated GUI style notification via [nvim-notify](https://github.com/rcarriga/nvim-notify).
|
||||||
+ Tags navigation via [vista](https://github.com/liuchengxu/vista.vim).
|
+ Tags navigation via [vista](https://github.com/liuchengxu/vista.vim).
|
||||||
+ Code formatting via [Neoformat](https://github.com/sbdchd/neoformat).
|
+ Code formatting via [Neoformat](https://github.com/sbdchd/neoformat).
|
||||||
@@ -216,5 +216,3 @@ You may also be interested in my posts on configuring Nvim:
|
|||||||
+ [Config nvim on Linux for Python development](https://jdhao.github.io/2018/12/24/centos_nvim_install_use_guide_en/)
|
+ [Config nvim on Linux for Python development](https://jdhao.github.io/2018/12/24/centos_nvim_install_use_guide_en/)
|
||||||
+ [Nvim config on Windows 10](https://jdhao.github.io/2018/11/15/neovim_configuration_windows/)
|
+ [Nvim config on Windows 10](https://jdhao.github.io/2018/11/15/neovim_configuration_windows/)
|
||||||
+ [Nvim-qt config on Windows 10](https://jdhao.github.io/2019/01/17/nvim_qt_settings_on_windows/)
|
+ [Nvim-qt config on Windows 10](https://jdhao.github.io/2019/01/17/nvim_qt_settings_on_windows/)
|
||||||
|
|
||||||
<b id="f1">1:</b> Not enabled for Linux, you need to tweak [`lua/plugins.lua`](lua/plugins.lua) and change the condition for installing vimtex.[↩](#a1)
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
set formatoptions-=o
|
set formatoptions-=o
|
||||||
set formatoptions-=r
|
set formatoptions-=r
|
||||||
|
|
||||||
nnoremap <silent> <F9> :luafile %<CR>
|
nnoremap <buffer><silent> <F9> :luafile %<CR>
|
||||||
|
|
||||||
" For delimitMate
|
" For delimitMate
|
||||||
let b:delimitMate_matchpairs = "(:),[:],{:}"
|
let b:delimitMate_matchpairs = "(:),[:],{:}"
|
||||||
|
|||||||
@@ -12,4 +12,4 @@ set foldmethod=expr foldexpr=utils#VimFolds(v:lnum) foldtext=utils#MyFoldText()
|
|||||||
" see `:h K` and https://stackoverflow.com/q/15867323/6064933
|
" see `:h K` and https://stackoverflow.com/q/15867323/6064933
|
||||||
set keywordprg=:help
|
set keywordprg=:help
|
||||||
|
|
||||||
nnoremap <silent> <F9> :source %<CR>
|
nnoremap <buffer><silent> <F9> :source %<CR>
|
||||||
|
|||||||
@@ -7,17 +7,19 @@ local M = {}
|
|||||||
-- Colorscheme to its directory name mapping, because colorscheme repo name is not necessarily
|
-- Colorscheme to its directory name mapping, because colorscheme repo name is not necessarily
|
||||||
-- the same as the colorscheme name itself.
|
-- the same as the colorscheme name itself.
|
||||||
M.colorscheme2dir = {
|
M.colorscheme2dir = {
|
||||||
gruvbox8 = "vim-gruvbox8",
|
|
||||||
onedark = "onedark.nvim",
|
onedark = "onedark.nvim",
|
||||||
edge = "edge",
|
edge = "edge",
|
||||||
sonokai = "sonokai",
|
sonokai = "sonokai",
|
||||||
gruvbox_material = "gruvbox-material",
|
gruvbox_material = "gruvbox-material",
|
||||||
nord = "nord.nvim",
|
nord = "nord.nvim",
|
||||||
doom_one = "doom-one.nvim",
|
|
||||||
everforest = "everforest",
|
everforest = "everforest",
|
||||||
nightfox = "nightfox.nvim",
|
nightfox = "nightfox.nvim",
|
||||||
kanagawa = "kanagawa.nvim",
|
kanagawa = "kanagawa.nvim",
|
||||||
catppuccin = "catppuccin",
|
catppuccin = "catppuccin",
|
||||||
|
rose_pine = "rose-pine",
|
||||||
|
onedarkpro = "onedarkpro.nvim",
|
||||||
|
monokai = "monokai.nvim",
|
||||||
|
material = "material.nvim",
|
||||||
}
|
}
|
||||||
|
|
||||||
M.gruvbox8 = function()
|
M.gruvbox8 = function()
|
||||||
@@ -50,6 +52,10 @@ M.sonokai = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
M.gruvbox_material = function()
|
M.gruvbox_material = function()
|
||||||
|
-- foreground option can be material, mix, or original
|
||||||
|
vim.g.gruvbox_material_foreground = "material"
|
||||||
|
--background option can be hard, medium, soft
|
||||||
|
vim.g.gruvbox_material_background = "soft"
|
||||||
vim.g.gruvbox_material_enable_italic = 1
|
vim.g.gruvbox_material_enable_italic = 1
|
||||||
vim.g.gruvbox_material_better_performance = 1
|
vim.g.gruvbox_material_better_performance = 1
|
||||||
|
|
||||||
@@ -88,6 +94,34 @@ M.catppuccin = function()
|
|||||||
vim.cmd([[colorscheme catppuccin]])
|
vim.cmd([[colorscheme catppuccin]])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.rose_pine = function()
|
||||||
|
require('rose-pine').setup({
|
||||||
|
--- @usage 'main' | 'moon'
|
||||||
|
dark_variant = 'moon',
|
||||||
|
})
|
||||||
|
|
||||||
|
-- set colorscheme after options
|
||||||
|
vim.cmd('colorscheme rose-pine')
|
||||||
|
end
|
||||||
|
|
||||||
|
M.onedarkpro = function()
|
||||||
|
require("onedarkpro").setup({
|
||||||
|
dark_theme = "onedark", -- The default dark theme
|
||||||
|
})
|
||||||
|
|
||||||
|
-- set colorscheme after options
|
||||||
|
vim.cmd('colorscheme onedarkpro')
|
||||||
|
end
|
||||||
|
|
||||||
|
M.monokai = function()
|
||||||
|
vim.cmd('colorscheme monokai_pro')
|
||||||
|
end
|
||||||
|
|
||||||
|
M.material = function ()
|
||||||
|
vim.g.material_style = "oceanic"
|
||||||
|
vim.cmd('colorscheme material')
|
||||||
|
end
|
||||||
|
|
||||||
--- Use a random colorscheme from the pre-defined list of colorschemes.
|
--- Use a random colorscheme from the pre-defined list of colorschemes.
|
||||||
M.rand_colorscheme = function()
|
M.rand_colorscheme = function()
|
||||||
local colorscheme = utils.rand_element(vim.tbl_keys(M.colorscheme2dir))
|
local colorscheme = utils.rand_element(vim.tbl_keys(M.colorscheme2dir))
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ nmap s <Nop>
|
|||||||
omap s <Nop>
|
omap s <Nop>
|
||||||
|
|
||||||
""""""""""""""""""""""""""""vimtex settings"""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""vimtex settings"""""""""""""""""""""""""""""
|
||||||
if ( g:is_win || g:is_mac ) && executable('latex')
|
if executable('latex')
|
||||||
" Hacks for inverse search to work semi-automatically,
|
" Hacks for inverse search to work semi-automatically,
|
||||||
" see https://jdhao.github.io/2021/02/20/inverse_search_setup_neovim_vimtex/.
|
" see https://jdhao.github.io/2021/02/20/inverse_search_setup_neovim_vimtex/.
|
||||||
function! s:write_server_name() abort
|
function! s:write_server_name() abort
|
||||||
|
|||||||
2
init.lua
2
init.lua
@@ -12,7 +12,7 @@ local api = vim.api
|
|||||||
local utils = require("utils")
|
local utils = require("utils")
|
||||||
|
|
||||||
-- check if we have the latest stable version of nvim
|
-- check if we have the latest stable version of nvim
|
||||||
local expected_ver = "0.8.0"
|
local expected_ver = "0.8.1"
|
||||||
local nvim_ver = utils.get_nvim_version()
|
local nvim_ver = utils.get_nvim_version()
|
||||||
|
|
||||||
if nvim_ver ~= expected_ver then
|
if nvim_ver ~= expected_ver then
|
||||||
|
|||||||
@@ -49,9 +49,9 @@ vim.api.nvim_create_autocmd('ColorScheme', {
|
|||||||
pattern = "*",
|
pattern = "*",
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.cmd [[
|
vim.cmd [[
|
||||||
hi GitSignsChangeInline guibg=fg guifg=bg
|
hi GitSignsChangeInline gui=reverse
|
||||||
hi GitSignsAddInline guibg=fg guifg=bg
|
hi GitSignsAddInline gui=reverse
|
||||||
hi GitSignsDeleteInline guibg=fg guifg=bg
|
hi GitSignsDeleteInline gui=reverse
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ cmp.setup {
|
|||||||
{ name = "ultisnips" }, -- For ultisnips user.
|
{ name = "ultisnips" }, -- For ultisnips user.
|
||||||
{ name = "path" }, -- for path completion
|
{ name = "path" }, -- for path completion
|
||||||
{ name = "buffer", keyword_length = 2 }, -- for buffer word completion
|
{ name = "buffer", keyword_length = 2 }, -- for buffer word completion
|
||||||
{ name = "omni" },
|
|
||||||
{ name = "emoji", insert = true }, -- emoji completion
|
{ name = "emoji", insert = true }, -- emoji completion
|
||||||
},
|
},
|
||||||
completion = {
|
completion = {
|
||||||
@@ -61,6 +60,15 @@ cmp.setup {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmp.setup.filetype("tex", {
|
||||||
|
sources = {
|
||||||
|
{ name = "omni" },
|
||||||
|
{ name = "ultisnips" }, -- For ultisnips user.
|
||||||
|
{ name = "buffer", keyword_length = 2 }, -- for buffer word completion
|
||||||
|
{ name = "path" }, -- for path completion
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
-- see https://github.com/hrsh7th/nvim-cmp/wiki/Menu-Appearance#how-to-add-visual-studio-code-dark-theme-colors-to-the-menu
|
-- see https://github.com/hrsh7th/nvim-cmp/wiki/Menu-Appearance#how-to-add-visual-studio-code-dark-theme-colors-to-the-menu
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
highlight! link CmpItemMenu Comment
|
highlight! link CmpItemMenu Comment
|
||||||
|
|||||||
@@ -8,11 +8,17 @@ local function spell()
|
|||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- show indicator for Chinese IME
|
||||||
local function ime_state()
|
local function ime_state()
|
||||||
if vim.g.is_mac then
|
if vim.g.is_mac then
|
||||||
-- ref: https://github.com/vim-airline/vim-airline/blob/master/autoload/airline/extensions/xkblayout.vim#L11
|
-- ref: https://github.com/vim-airline/vim-airline/blob/master/autoload/airline/extensions/xkblayout.vim#L11
|
||||||
local layout = fn.libcall(vim.g.XkbSwitchLib, "Xkb_Switch_getXkbLayout", "")
|
local layout = fn.libcall(vim.g.XkbSwitchLib, "Xkb_Switch_getXkbLayout", "")
|
||||||
if layout == "0" then
|
|
||||||
|
-- We can use `xkbswitch -g` on the command line to get current mode.
|
||||||
|
-- mode for macOS builtin pinyin IME: com.apple.inputmethod.SCIM.ITABC
|
||||||
|
-- mode for Rime: im.rime.inputmethod.Squirrel.Rime
|
||||||
|
local res = fn.match(layout, [[\v(Squirrel\.Rime|SCIM.ITABC)]])
|
||||||
|
if res ~= -1 then
|
||||||
return "[CN]"
|
return "[CN]"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ local function packer_ensure_install()
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local fresh_install = packer_ensure_install()
|
local fresh_install = packer_ensure_install()
|
||||||
|
|
||||||
-- Load packer.nvim
|
-- Load packer.nvim
|
||||||
@@ -124,17 +123,19 @@ packer.startup {
|
|||||||
use { "nvim-telescope/telescope-symbols.nvim", after = "telescope.nvim" }
|
use { "nvim-telescope/telescope-symbols.nvim", after = "telescope.nvim" }
|
||||||
|
|
||||||
-- A list of colorscheme plugin you may want to try. Find what suits you.
|
-- A list of colorscheme plugin you may want to try. Find what suits you.
|
||||||
use { "lifepillar/vim-gruvbox8", opt = true }
|
|
||||||
use { "navarasu/onedark.nvim", opt = true }
|
use { "navarasu/onedark.nvim", opt = true }
|
||||||
use { "sainnhe/edge", opt = true }
|
use { "sainnhe/edge", opt = true }
|
||||||
use { "sainnhe/sonokai", opt = true }
|
use { "sainnhe/sonokai", opt = true }
|
||||||
use { "sainnhe/gruvbox-material", opt = true }
|
use { "sainnhe/gruvbox-material", opt = true }
|
||||||
use { "shaunsingh/nord.nvim", opt = true }
|
use { "shaunsingh/nord.nvim", opt = true }
|
||||||
use { "NTBBloodbath/doom-one.nvim", opt = true }
|
|
||||||
use { "sainnhe/everforest", opt = true }
|
use { "sainnhe/everforest", opt = true }
|
||||||
use { "EdenEast/nightfox.nvim", opt = true }
|
use { "EdenEast/nightfox.nvim", opt = true }
|
||||||
use { "rebelot/kanagawa.nvim", opt = true }
|
use { "rebelot/kanagawa.nvim", opt = true }
|
||||||
use { "catppuccin/nvim", as = "catppuccin", opt = true }
|
use { "catppuccin/nvim", as = "catppuccin", opt = true }
|
||||||
|
use({ "rose-pine/neovim", as = 'rose-pine', opt = true })
|
||||||
|
use { "olimorris/onedarkpro.nvim", opt = true }
|
||||||
|
use { "tanvirtin/monokai.nvim", opt = true }
|
||||||
|
use { "marko-cerovac/material.nvim", opt = true }
|
||||||
|
|
||||||
use { "kyazdani42/nvim-web-devicons", event = "VimEnter" }
|
use { "kyazdani42/nvim-web-devicons", event = "VimEnter" }
|
||||||
|
|
||||||
@@ -289,7 +290,7 @@ packer.startup {
|
|||||||
use { "michaeljsmith/vim-indent-object", event = "VimEnter" }
|
use { "michaeljsmith/vim-indent-object", event = "VimEnter" }
|
||||||
|
|
||||||
-- Only use these plugin on Windows and Mac and when LaTeX is installed
|
-- Only use these plugin on Windows and Mac and when LaTeX is installed
|
||||||
if vim.g.is_win or vim.g.is_mac and utils.executable("latex") then
|
if utils.executable("latex") then
|
||||||
use { "lervag/vimtex", ft = { "tex" } }
|
use { "lervag/vimtex", ft = { "tex" } }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
2
plugin/abbrev.vim
Normal file
2
plugin/abbrev.vim
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
" some abbreviations
|
||||||
|
iabbrev reqire require
|
||||||
Reference in New Issue
Block a user