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. "208b190a65c8b9175f770872a8ef00ca638029a7" and "86e3b29730cf569c32d7fc03f36afdb8c9f43022" have entirely different histories.

8 changed files with 43 additions and 48 deletions

View File

@ -74,7 +74,7 @@ and how to set up on different platforms (Linux, macOS, and Windows).
+ Asynchronous code execution via [asyncrun.vim](https://github.com/skywind3000/asyncrun.vim). + Asynchronous code execution via [asyncrun.vim](https://github.com/skywind3000/asyncrun.vim).
+ Code highlighting via [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter). + Code highlighting via [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter).
+ 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. + Color theme via [vim-gruvbox8](https://github.com/lifepillar/vim-gruvbox8) and other beautiful themes.
+ Markdown writing and previewing via [vim-markdown](https://github.com/plasticboy/vim-markdown) and [markdown-preview.nvim](https://github.com/iamcco/markdown-preview.nvim). + Markdown writing and previewing via [vim-markdown](https://github.com/plasticboy/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) <sup id="a1">[1](#f1)</sup>.
+ 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).

View File

@ -1,7 +1,7 @@
scriptencoding utf-8 scriptencoding utf-8
" Plugin specification and lua stuff " Plugin specification and lua stuff
lua require('plugins') lua require('lua-init')
" Use short names for common plugin manager commands to simplify typing. " Use short names for common plugin manager commands to simplify typing.
" To use these shortcuts: first activate command line with `:`, then input the " To use these shortcuts: first activate command line with `:`, then input the

View File

@ -1,12 +1,10 @@
--- This module will load a random colorscheme on nvim startup process.
local utils = require('utils') local utils = require('utils')
local M = {} local M = {}
-- Colorscheme to its directory name mapping, because colorscheme repo name is not necessarily -- Theme to directory name mapping, because theme repo name is not necessarily
-- the same as the colorscheme name itself. -- the same as the theme name itself.
M.colorscheme2dir = { M.theme2dir = {
gruvbox8 = "vim-gruvbox8", gruvbox8 = "vim-gruvbox8",
onedark = 'onedark.nvim', onedark = 'onedark.nvim',
edge = 'edge', edge = 'edge',
@ -91,36 +89,35 @@ M.catppuccin = function()
end end
--- Use a random colorscheme from the pre-defined list of colorschemes. --- Use a random theme from the pre-defined list of themes.
M.rand_colorscheme = function () M.rand_theme = function ()
local colorscheme = utils.rand_element(vim.tbl_keys(M.colorscheme2dir)) local theme = utils.rand_element(vim.tbl_keys(M.theme2dir))
if not vim.tbl_contains(vim.tbl_keys(M), colorscheme) then if not vim.tbl_contains(vim.tbl_keys(M), theme) then
local msg = "Invalid colorscheme: " .. colorscheme local msg = "Invalid theme: " .. theme
vim.notify(msg, vim.log.levels.ERROR, { title = 'nvim-config' }) vim.notify(msg, vim.log.levels.ERROR, { title = 'nvim-config' })
return return
end end
-- Load the colorscheme, because all the colorschemes are declared as opt plugins, so the colorscheme isn't loaded yet. -- Load the theme, because all the themes are declared as opt plugins, the theme isn't loaded yet.
local status = utils.add_pack(M.colorscheme2dir[colorscheme]) local status = utils.add_pack(M.theme2dir[theme])
if not status then if not status then
local msg = string.format("Colorscheme %s is not installed. Run PackerSync to install.", colorscheme) local msg = string.format("Theme %s is not installed. Run PackerSync to install.", theme)
vim.notify(msg, vim.log.levels.ERROR, { title = 'nvim-config' }) vim.notify(msg, vim.log.levels.ERROR, { title = 'nvim-config' })
return return
end end
-- Load the colorscheme and its settings -- Set the theme.
M[colorscheme]() M[theme]()
if vim.g.logging_level == 'debug' then if vim.g.logging_level == 'debug' then
local msg = "Colorscheme: " .. colorscheme local msg = "Colorscheme: " .. theme
vim.notify(msg, vim.log.levels.DEBUG, { title = 'nvim-config' }) vim.notify(msg, vim.log.levels.DEBUG, { title = 'nvim-config' })
end end
end end
-- Load a random colorscheme M.rand_theme()
M.rand_colorscheme()

View File

@ -245,7 +245,6 @@ fi
echo "Setting up config and installing plugins" echo "Setting up config and installing plugins"
if [[ -d "$NVIM_CONFIG_DIR" ]]; then if [[ -d "$NVIM_CONFIG_DIR" ]]; then
rm -rf "$NVIM_CONFIG_DIR.backup"
mv "$NVIM_CONFIG_DIR" "$NVIM_CONFIG_DIR.backup" mv "$NVIM_CONFIG_DIR" "$NVIM_CONFIG_DIR.backup"
fi fi

View File

@ -21,12 +21,12 @@ if nvim_ver ~= expected_ver then
end end
local core_conf_files = { local core_conf_files = {
"globals.vim", -- some global settings "globals.vim",
"options.vim", -- setting options in nvim "options.vim",
"autocommands.vim", -- various autocommands "autocommands.vim",
"mappings.vim", -- all the user-defined mappings "mappings.vim",
"plugins.vim", -- all the plugins installed and their configurations "plugins.vim",
"colorschemes.lua", -- colorscheme settings "themes.lua",
} }
-- source all the core config files -- source all the core config files

View File

@ -1,6 +1,3 @@
local api = vim.api
local exclude_ft = { "help", "git", "markdown", "snippets", "text", "gitconfig", "alpha" }
require("indent_blankline").setup({ require("indent_blankline").setup({
-- U+2502 may also be a good choice, it will be on the middle of cursor. -- U+2502 may also be a good choice, it will be on the middle of cursor.
-- U+250A is also a good choice -- U+250A is also a good choice
@ -8,22 +5,19 @@ require("indent_blankline").setup({
show_end_of_line = false, show_end_of_line = false,
disable_with_nolist = true, disable_with_nolist = true,
buftype_exclude = { "terminal" }, buftype_exclude = { "terminal" },
filetype_exclude = exclude_ft, filetype_exclude = { "help", "git", "markdown", "snippets", "text", "gitconfig", "alpha" },
}) })
local gid = api.nvim_create_augroup("indent_blankline", { clear = true }) vim.cmd([[
api.nvim_create_autocmd("InsertEnter", { function! Should_activate_indentblankline() abort
pattern = "*", if index(g:indent_blankline_filetype_exclude, &filetype) == -1
group = gid, IndentBlanklineEnable
command = "IndentBlanklineDisable" endif
}) endfunction
api.nvim_create_autocmd("InsertLeave", { augroup indent_blankline
pattern = "*", autocmd!
group = gid, autocmd InsertEnter * IndentBlanklineDisable
callback = function() autocmd InsertLeave * call Should_activate_indentblankline()
if not vim.tbl_contains(exclude_ft, vim.bo.filetype) then augroup END
vim.cmd [[IndentBlanklineEnable]] ]])
end
end
})

View File

@ -34,7 +34,7 @@ cmp.setup({
{ name = 'nvim_lsp' }, -- For nvim-lsp { name = 'nvim_lsp' }, -- For nvim-lsp
{ 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 = 4 }, -- for buffer word completion
{ name = 'omni' }, { name = 'omni' },
{ name = 'emoji', insert = true, } -- emoji completion { name = 'emoji', insert = true, } -- emoji completion
}, },
@ -55,7 +55,7 @@ cmp.setup({
path = "[Path]", path = "[Path]",
buffer = "[Buffer]", buffer = "[Buffer]",
emoji = "[Emoji]", emoji = "[Emoji]",
omni = "[Omni]", omni = "[Omni]",
}), }),
}), }),
}, },

5
lua/lua-init.lua Normal file
View File

@ -0,0 +1,5 @@
-- Some utility stuff
require 'utils'
-- plugin installation
require 'plugins'