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

21 Commits

Author SHA1 Message Date
jdhao
cb8c9208e1 update which-key conf and some mappings 2024-07-25 04:00:17 +08:00
jdhao
ce1e13e2c9 use plugin nvim-autopairs for autopair
delimitMate is not updated for a long time.
2024-07-14 05:17:49 +08:00
jdhao
2af616bb0d Update hop.nvim conf to support Chinese 2024-06-26 03:33:24 +08:00
jdhao
3694d3c237 Update config for GitSigns 2024-06-26 03:25:01 +08:00
jdhao
69d8543495 remove emmylua since neovim has builtin annotation
Seee also this https://github.com/neovim/neovim/pull/24493
2024-05-20 22:09:07 +02:00
jdhao
be3d134c37 use vim.uv instead of vim.loop 2024-05-20 21:52:52 +02:00
jdhao
601396f700 upgrade neovim to latest stable
The way to compare versions are changed due to a bug in comparing
versions in the neovim core: https://github.com/neovim/neovim/issues/28782
2024-05-20 21:33:38 +02:00
jdhao
e462ebcbcc Enable treesitter folding for Python and Lua 2024-05-08 03:46:45 +08:00
jdhao
2f8482639d update some mappings
1. fix a typo in gJ mapping when setting the mark, the correct syntax is
   `mz` (set mark `z`), not `zm`

2. fix bug with `iB` text object: previously `viB` does not work as
   expected, because it does not select the entire buffer as expected.
   After much investigation, I found it is because the `<cmd>` mapping
   argument. If we use `<cmd>` argument for mapping, the mode does not
   change. So if we use `viB`, inititally we are still in visual mode.
   Later in the implementation, when we use `` normal! `<V`>  `` to
   select the entire buffer, it interferes with original visual mode. As
   a result, the entire buffer is not selected. In the text obj
   implementation, we can use `exe "normal! \<Esc>"` to clear the visual
   mode and make `viB`, but this is not ideal. I think it is eaiser to
   just not use the `<cmd>` argument and use `:<C-U>` instead.
2024-02-28 06:36:05 +08:00
jdhao
050eacaee2 Stop showing percent location
The percent location is useless and just noise.
2024-02-23 06:11:21 +08:00
jdhao
01bc4b40d3 update used plugins 2024-02-02 03:52:26 +08:00
jdhao
c06d46e84d remove lazylock
I don't use this feature at all.
2024-02-02 03:43:55 +08:00
jdhao
7cf70f31af Update colorscheme conf
1. remove some colorscheme that doesn't work well with Markdown
2. change how the colorscheme conf is organized.
2024-02-02 03:40:11 +08:00
jdhao
8416508686 Enable nvim-tree to open dir during startup
Now when you open a directory when starting nvim, nvim-tree will be
opened to handle the directory correctly, see also issue #257.
2024-01-07 15:24:47 +01:00
jdhao
df9491b05b bump neovim version to 0.9.5 2024-01-07 14:45:29 +01:00
jdhao
17d2e3ab3e Deal with other variant of unix timestamp 2023-10-21 00:53:15 +02:00
jdhao
2c9948300d Add diffview.nvim for viewing diffs 2023-10-18 22:10:11 +02:00
jdhao
dfaa3d97a5 update plugin spec 2023-10-12 23:26:43 +02:00
jdhao
8d74fcb75c Remove obsolete options for nvim-tree 2023-10-11 20:43:24 +02:00
jdhao
b1f0ef63ef Rename vimscript conf directory 2023-10-11 20:41:25 +02:00
jdhao
54ca6d4191 update to nvim 0.9.4 2023-10-11 20:35:50 +02:00
20 changed files with 147 additions and 300 deletions

View File

@@ -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.9.2-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/> <img src="https://img.shields.io/badge/Neovim-0.9.5-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.9.2"> <a href="https://github.com/jdhao/nvim-config/releases/tag/v0.9.5">
<img src="https://img.shields.io/github/commits-since/jdhao/nvim-config/v0.9.2?style=flat-square" /> <img src="https://img.shields.io/github/commits-since/jdhao/nvim-config/v0.9.5?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" />
@@ -64,7 +64,7 @@ and how to set up on different platforms (Linux, macOS, and Windows).
+ Better escaping from insert mode via [better-escape.vim](https://github.com/nvim-zh/better-escape.vim). + Better escaping from insert mode via [better-escape.vim](https://github.com/nvim-zh/better-escape.vim).
+ Ultra-fast project-wide fuzzy searching via [LeaderF](https://github.com/Yggdroot/LeaderF). + Ultra-fast project-wide fuzzy searching via [LeaderF](https://github.com/Yggdroot/LeaderF).
+ Faster code commenting via [vim-commentary](https://github.com/tpope/vim-commentary). + Faster code commenting via [vim-commentary](https://github.com/tpope/vim-commentary).
+ Faster matching pair insertion and jump via [delimitMate](https://github.com/Raimondi/delimitMate). + Faster matching pair insertion and jump via [nvim-autopairs](https://github.com/windwp/nvim-autopairs).
+ Smarter and faster matching pair management (add, replace or delete) via [vim-sandwich](https://github.com/machakann/vim-sandwich). + Smarter and faster matching pair management (add, replace or delete) via [vim-sandwich](https://github.com/machakann/vim-sandwich).
+ Fast buffer jump via [hop.nvim](https://github.com/phaazon/hop.nvim). + Fast buffer jump via [hop.nvim](https://github.com/phaazon/hop.nvim).
+ Powerful snippet insertion via [Ultisnips](https://github.com/SirVer/ultisnips). + Powerful snippet insertion via [Ultisnips](https://github.com/SirVer/ultisnips).

View File

@@ -34,6 +34,3 @@ function s:create_term_buf(_type, size) abort
endif endif
execute 'resize ' . a:size execute 'resize ' . a:size
endfunction endfunction
" For delimitMate
let b:delimitMate_matchpairs = "(:),[:],{:}"

View File

@@ -4,5 +4,6 @@ set formatoptions-=r
nnoremap <buffer><silent> <F9> :luafile %<CR> nnoremap <buffer><silent> <F9> :luafile %<CR>
" For delimitMate " Use nvim-treesitter for folding
let b:delimitMate_matchpairs = "(:),[:],{:}" set foldmethod=expr
set foldexpr=nvim_treesitter#foldexpr()

View File

@@ -13,5 +13,6 @@ set softtabstop=4 " number of spaces in tab when editing
set shiftwidth=4 " number of spaces to use for autoindent set shiftwidth=4 " number of spaces to use for autoindent
set expandtab " expand tab to spaces so that tabs are spaces set expandtab " expand tab to spaces so that tabs are spaces
" For delimitMate " Use nvim-treesitter for folding
let b:delimitMate_matchpairs = "(:),[:],{:}" set foldmethod=expr
set foldexpr=nvim_treesitter#foldexpr()

View File

@@ -128,11 +128,22 @@ endfunction
" Output current time or unix timestamp in human-readable format. " Output current time or unix timestamp in human-readable format.
function! utils#iso_time(timestamp) abort function! utils#iso_time(timestamp) abort
if a:timestamp " Get current datetime
return strftime('%Y-%m-%d %H:%M:%S%z', a:timestamp) if !a:timestamp
return strftime('%Y-%m-%d %H:%M:%S%z')
endif endif
return strftime('%Y-%m-%d %H:%M:%S%z') " this timestamp in expressed in milliseconds
if len(a:timestamp) == 13
let l:timestamp = a:timestamp[:-4]
" this timestamp in expressed in microseconds
elseif len(a:timestamp) == 16
let l:timestamp = a:timestamp[:-7]
else
let l:timestamp = a:timestamp
endif
return strftime('%Y-%m-%d %H:%M:%S%z', l:timestamp)
endfunction endfunction
" Check if we are inside a Git repo. " Check if we are inside a Git repo.

View File

@@ -14,11 +14,13 @@ vim.loader.enable()
local version = vim.version local version = vim.version
-- check if we have the latest stable version of nvim -- check if we have the latest stable version of nvim
local expected_ver = "0.9.2" local expected_ver = "0.10.0"
local ev = version.parse(expected_ver) local ev = version.parse(expected_ver)
local actual_ver = version() local actual_ver = version()
if version.cmp(ev, actual_ver) ~= 0 then local result = version.cmp(ev, {actual_ver.major, actual_ver.minor, actual_ver.patch})
if result ~= 0 then
local _ver = string.format("%s.%s.%s", actual_ver.major, actual_ver.minor, actual_ver.patch) 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, _ver) local msg = string.format("Expect nvim %s, but got %s instead. Use at your own risk!", expected_ver, _ver)
vim.api.nvim_err_writeln(msg) vim.api.nvim_err_writeln(msg)
@@ -33,10 +35,11 @@ local core_conf_files = {
"colorschemes.lua", -- colorscheme settings "colorschemes.lua", -- colorscheme settings
} }
local viml_conf_dir = vim.fn.stdpath("config") .. "/viml_conf"
-- source all the core config files -- source all the core config files
for _, file_name in ipairs(core_conf_files) do for _, file_name in ipairs(core_conf_files) do
if vim.endswith(file_name, 'vim') then if vim.endswith(file_name, 'vim') then
local path = string.format("%s/core/%s", vim.fn.stdpath("config"), file_name) local path = string.format("%s/%s", viml_conf_dir, file_name)
local source_cmd = "source " .. path local source_cmd = "source " .. path
vim.cmd(source_cmd) vim.cmd(source_cmd)
else else

View File

@@ -1,87 +0,0 @@
{
"LeaderF": { "branch": "master", "commit": "a77f45791edeaa82fa75c5959ca73a59d7549549" },
"asyncrun.vim": { "branch": "master", "commit": "61cc3081963a12048e00e89f8cedc8bd1cb83b8c" },
"better-escape.vim": { "branch": "master", "commit": "6b16a45a839727977277f6ab11bded63e9ed86bb" },
"bufferline.nvim": { "branch": "main", "commit": "357cc8f8eeb64702e6fcf2995e3b9becee99a5d3" },
"catppuccin": { "branch": "main", "commit": "7a4bcdadafc59a5bedbd866c643fa486d8cca4a1" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"cmp-nvim-ultisnips": { "branch": "main", "commit": "24bca5c3e137b28cd87442d4fc51a2b312dd99cc" },
"cmp-omni": { "branch": "main", "commit": "4ef610bbd85a5ee4e97e09450c0daecbdc60de86" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"committia.vim": { "branch": "master", "commit": "0b4df1a7f48ffbc23b009bd14d58ee1be541917c" },
"dashboard-nvim": { "branch": "master", "commit": "b2637e92a294068d79cde7929094f050981c5969" },
"delimitMate": { "branch": "master", "commit": "537a1da0fa5eeb88640425c37e545af933c56e1b" },
"dressing.nvim": { "branch": "master", "commit": "8f4d62b7817455896a3c73cab642002072c114bc" },
"edge": { "branch": "master", "commit": "a4fd4f458331d42677d992f428235c491b2016aa" },
"emmylua-nvim": { "branch": "master", "commit": "79f8dd69ebbfa068efbd093bdaa5df9b4579defe" },
"everforest": { "branch": "master", "commit": "83b666410d7ae0eccf96dbbe3b4b6ac5b8172d38" },
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
"firenvim": { "branch": "master", "commit": "138424db463e6c0e862a05166a4ccc781cd7c19d" },
"gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
"gitsigns.nvim": { "branch": "main", "commit": "b14b9fba7d085ed8c11392aa51e575de84822bb1" },
"gruvbox-material": { "branch": "master", "commit": "b5f8c6a6c1cda630c53b061b765068a0898d47a3" },
"hop.nvim": { "branch": "master", "commit": "1cbaa79457e6b5e9b04e6d5d8d19bd6b65ffa2be" },
"indent-blankline.nvim": { "branch": "master", "commit": "ce2e8e410bc8b46a6938bfa3520bc6b85ca8a743" },
"kanagawa.nvim": { "branch": "master", "commit": "c19b9023842697ec92caf72cd3599f7dd7be4456" },
"lazy.nvim": { "branch": "main", "commit": "59335c5b9d116f5d3948f833288a89e2a829a005" },
"lspkind-nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
"markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" },
"material.nvim": { "branch": "main", "commit": "176f5995f07a241e4e0da29a8d4208cdcfb81bd2" },
"monokai.nvim": { "branch": "master", "commit": "b8bd44d5796503173627d7a1fc51f77ec3a08a63" },
"neoformat": { "branch": "master", "commit": "aedb6f9d3f53d5da229095f7d761d749f8c5c7e0" },
"nightfox.nvim": { "branch": "main", "commit": "fe2fc7b93d66349eff2c5baa6cec922ee3958f56" },
"nord.nvim": { "branch": "master", "commit": "15fbfc38a83980b93e169b32a1bf64757f1e2bf4" },
"nvim-bqf": { "branch": "main", "commit": "8784eebf34371049b641646d00232c2603215297" },
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
"nvim-hlslens": { "branch": "main", "commit": "f0281591a59e95400babf61a96e59ba20e5c9533" },
"nvim-lspconfig": { "branch": "master", "commit": "ac478757efcde1ac346f7044ab774e7cbb482533" },
"nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" },
"nvim-tree.lua": { "branch": "master", "commit": "7dcda5d3b6d2fce7b7baa471b7ad6525383e27bb" },
"nvim-treesitter": { "branch": "master", "commit": "d96c216c54cc2d48d3c66ba7f0fc3c7c5b71b3b1" },
"nvim-web-devicons": { "branch": "master", "commit": "45d0237c427baba8cd05e0ab26d30e2ee58c2c82" },
"onedark.nvim": { "branch": "master", "commit": "dac8c39812dae025255c9069a260e1f69d967927" },
"onedarkpro.nvim": { "branch": "main", "commit": "7c02b4eeb310173ef6d741e60200d72b76923eae" },
"open-browser.vim": { "branch": "master", "commit": "7d4c1d8198e889d513a030b5a83faa07606bac27" },
"plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" },
"sonokai": { "branch": "master", "commit": "17308ee6d9c764bfc1e0fa97213e7a99701b4144" },
"tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" },
"targets.vim": { "branch": "master", "commit": "642d3a4ce306264b05ea3219920b13ea80931767" },
"telescope-symbols.nvim": { "branch": "master", "commit": "f2060117d965df4a626f068a4ebbd8ee051aa076" },
"telescope.nvim": { "branch": "master", "commit": "8c69f58427f98b2ca39a90a36db830c06e30351c" },
"ultisnips": { "branch": "master", "commit": "f6d1501b630cb783b0af8507c5588328f826d40f" },
"unicode.vim": { "branch": "master", "commit": "bc20d0fb3331a7b41708388c56bb8221c2104da7" },
"vim-auto-save": { "branch": "master", "commit": "2e3e54ea4c0fc946c21b0a4ee4c1c295ba736ee8" },
"vim-commentary": { "branch": "master", "commit": "e87cd90dc09c2a203e13af9704bd0ef79303d755" },
"vim-conflicted": { "branch": "master", "commit": "068c320796f807ac4961618e3e62316773803996" },
"vim-eunuch": { "branch": "master", "commit": "67f3dd32b4dcd1c427085f42ff5f29c7adc645c6" },
"vim-flog": { "branch": "master", "commit": "58c1d39ec42f92d23a1204b1869e5d1dece8b86c" },
"vim-fugitive": { "branch": "master", "commit": "99db68d9b3304580bd383da7aaee05c7a954a344" },
"vim-grammarous": { "branch": "master", "commit": "db46357465ce587d5325e816235b5e92415f8c05" },
"vim-highlighturl": { "branch": "master", "commit": "012fee983e03913db6ba6393307eac434999b896" },
"vim-indent-object": { "branch": "master", "commit": "5c5b24c959478929b54a9e831a8e2e651a465965" },
"vim-markdown": { "branch": "master", "commit": "4e9b4deda11d05a157ab34e97f76089669b5b7af" },
"vim-markdownfootnotes": { "branch": "master", "commit": "2b288149f48cfaf7465d25bb094ed62898f5e5b0" },
"vim-matchup": { "branch": "master", "commit": "6dbe108230c7dbbf00555b7d4d9f6a891837ef07" },
"vim-mundo": { "branch": "master", "commit": "b53d35fb5ca9923302b9ef29e618ab2db4cc675e" },
"vim-obsession": { "branch": "master", "commit": "fe9d3e1a9a50171e7d316a52e1e56d868e4c1fe5" },
"vim-python-pep8-indent": { "branch": "master", "commit": "60ba5e11a61618c0344e2db190210145083c91f8" },
"vim-pythonsense": { "branch": "master", "commit": "9200a57629c904ed2ab8c9b2e8c5649d311794ba" },
"vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" },
"vim-sandwich": { "branch": "master", "commit": "c5a2cc438ce6ea2005c556dc833732aa53cae21a" },
"vim-scriptease": { "branch": "master", "commit": "18511d389675d773994215ddb572ccdc2b72f52b" },
"vim-snippets": { "branch": "master", "commit": "ccc2fa1529d372f7ac16d5eb07a385a72b50e05d" },
"vim-swap": { "branch": "master", "commit": "9358bfdc5e377aa13e7c2c2dd8699ba32b0dcf83" },
"vim-tmux": { "branch": "master", "commit": "cfe76281efc29890548cf9eedd42ad51c7a1faf0" },
"vim-toml": { "branch": "main", "commit": "d36caa6b1cf508a4df1c691f915572fc02143258" },
"vim-xkbswitch": { "branch": "master", "commit": "42b55bfec8f6dbd715135ce582a6f769831face1" },
"vimtex": { "branch": "master", "commit": "7d453a61b0256337f341a1195ca9eb3f3890a7df" },
"vista.vim": { "branch": "master", "commit": "58dabc027909330970ac549e52bf799a723878c5" },
"which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" },
"whitespace.nvim": { "branch": "master", "commit": "f0fc9e9c4ce3f7d2166e9e5a069b64b9ca4a3f15" },
"wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" },
"yanky.nvim": { "branch": "main", "commit": "590a713b0372485f595eea36e7e3ab2069946794" },
"zen-mode.nvim": { "branch": "main", "commit": "68f554702de63f4b7b6b6d4bcb10178f41a0acc7" }
}

View File

@@ -6,51 +6,23 @@ 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.colorscheme_conf = {
onedark = "onedark.nvim", onedark = function()
edge = "edge",
sonokai = "sonokai",
gruvbox_material = "gruvbox-material",
nord = "nord.nvim",
everforest = "everforest",
nightfox = "nightfox.nvim",
kanagawa = "kanagawa.nvim",
catppuccin = "catppuccin",
onedarkpro = "onedarkpro.nvim",
monokai = "monokai.nvim",
material = "material.nvim",
}
M.gruvbox8 = function()
-- Italic options should be put before colorscheme setting,
-- see https://github.com/morhetz/gruvbox/wiki/Terminal-specific#1-italics-is-disabled
vim.g.gruvbox_italics = 1
vim.g.gruvbox_italicize_strings = 1
vim.g.gruvbox_filetype_hi_groups = 1
vim.g.gruvbox_plugin_hi_groups = 1
vim.cmd([[colorscheme gruvbox8_hard]])
end
M.onedark = function()
vim.cmd([[colorscheme onedark]]) vim.cmd([[colorscheme onedark]])
end end,
edge = function()
M.edge = function()
vim.g.edge_enable_italic = 1 vim.g.edge_enable_italic = 1
vim.g.edge_better_performance = 1 vim.g.edge_better_performance = 1
vim.cmd([[colorscheme edge]]) vim.cmd([[colorscheme edge]])
end end,
sonokai = function()
M.sonokai = function()
vim.g.sonokai_enable_italic = 1 vim.g.sonokai_enable_italic = 1
vim.g.sonokai_better_performance = 1 vim.g.sonokai_better_performance = 1
vim.cmd([[colorscheme sonokai]]) vim.cmd([[colorscheme sonokai]])
end end,
gruvbox_material = function()
M.gruvbox_material = function()
-- foreground option can be material, mix, or original -- foreground option can be material, mix, or original
vim.g.gruvbox_material_foreground = "material" vim.g.gruvbox_material_foreground = "material"
--background option can be hard, medium, soft --background option can be hard, medium, soft
@@ -59,59 +31,38 @@ M.gruvbox_material = function()
vim.g.gruvbox_material_better_performance = 1 vim.g.gruvbox_material_better_performance = 1
vim.cmd([[colorscheme gruvbox-material]]) vim.cmd([[colorscheme gruvbox-material]])
end end,
everforest = function()
M.nord = function()
vim.cmd([[colorscheme nord]])
end
M.doom_one = function()
vim.cmd([[colorscheme doom-one]])
end
M.everforest = function()
vim.g.everforest_enable_italic = 1 vim.g.everforest_enable_italic = 1
vim.g.everforest_better_performance = 1 vim.g.everforest_better_performance = 1
vim.cmd([[colorscheme everforest]]) vim.cmd([[colorscheme everforest]])
end end,
nightfox = function()
M.nightfox = function()
vim.cmd([[colorscheme nordfox]]) vim.cmd([[colorscheme nordfox]])
end end,
catppuccin = function()
M.kanagawa = function()
vim.cmd([[colorscheme kanagawa]])
end
M.catppuccin = function()
-- available option: latte, frappe, macchiato, mocha -- available option: latte, frappe, macchiato, mocha
vim.g.catppuccin_flavour = "frappe" vim.g.catppuccin_flavour = "frappe"
require("catppuccin").setup() require("catppuccin").setup()
vim.cmd([[colorscheme catppuccin]]) vim.cmd([[colorscheme catppuccin]])
end end,
onedarkpro = function()
M.onedarkpro = function()
-- set colorscheme after options -- set colorscheme after options
vim.cmd('colorscheme onedark_vivid') vim.cmd('colorscheme onedark_vivid')
end end,
material = function()
M.monokai = function()
vim.cmd('colorscheme monokai_pro')
end
M.material = function ()
vim.g.material_style = "oceanic" vim.g.material_style = "oceanic"
vim.cmd('colorscheme material') vim.cmd('colorscheme material')
end 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.colorscheme_conf))
if not vim.tbl_contains(vim.tbl_keys(M), colorscheme) then if not vim.tbl_contains(vim.tbl_keys(M.colorscheme_conf), colorscheme) then
local msg = "Invalid colorscheme: " .. colorscheme local msg = "Invalid colorscheme: " .. colorscheme
vim.notify(msg, vim.log.levels.ERROR, { title = "nvim-config" }) vim.notify(msg, vim.log.levels.ERROR, { title = "nvim-config" })
@@ -119,7 +70,7 @@ M.rand_colorscheme = function()
end end
-- Load the colorscheme and its settings -- Load the colorscheme and its settings
M[colorscheme]() M.colorscheme_conf[colorscheme]()
if vim.g.logging_level == "debug" then if vim.g.logging_level == "debug" then
local msg = "Colorscheme: " .. colorscheme local msg = "Colorscheme: " .. colorscheme

View File

@@ -2,11 +2,11 @@ local gs = require("gitsigns")
gs.setup { gs.setup {
signs = { signs = {
add = { hl = "GitSignsAdd", text = "+", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, add = { text = "+" },
change = { hl = "GitSignsChange", text = "~", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, change = { text = "~" },
delete = { hl = "GitSignsDelete", text = "_", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, delete = { text = "_" },
topdelete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, topdelete = { text = "" },
changedelete = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, changedelete = { text = "" },
}, },
word_diff = true, word_diff = true,
on_attach = function(bufnr) on_attach = function(bufnr)

View File

@@ -234,7 +234,7 @@ if utils.executable("lua-language-server") then
-- see also https://github.com/LuaLS/lua-language-server/wiki/Libraries#link-to-workspace . -- see also https://github.com/LuaLS/lua-language-server/wiki/Libraries#link-to-workspace .
-- Lua-dev.nvim also has similar settings for lua ls, https://github.com/folke/neodev.nvim/blob/main/lua/neodev/luals.lua . -- Lua-dev.nvim also has similar settings for lua ls, https://github.com/folke/neodev.nvim/blob/main/lua/neodev/luals.lua .
library = { library = {
fn.stdpath("data") .. "/lazy/emmylua-nvim", vim.env.VIMRUNTIME,
fn.stdpath("config"), fn.stdpath("config"),
}, },
maxPreload = 2000, maxPreload = 2000,

View File

@@ -4,15 +4,14 @@ local nvim_tree = require("nvim-tree")
nvim_tree.setup { nvim_tree.setup {
auto_reload_on_write = true, auto_reload_on_write = true,
disable_netrw = false, disable_netrw = false,
hijack_cursor = false,
hijack_netrw = true, hijack_netrw = true,
hijack_cursor = false,
hijack_unnamed_buffer_when_opening = false, hijack_unnamed_buffer_when_opening = false,
open_on_tab = false, open_on_tab = false,
sort_by = "name", sort_by = "name",
update_cwd = false, update_cwd = false,
view = { view = {
width = 30, width = 30,
hide_root_folder = false,
side = "left", side = "left",
preserve_window_proportions = false, preserve_window_proportions = false,
number = false, number = false,

View File

@@ -4,6 +4,7 @@ hop.setup {
case_insensitive = true, case_insensitive = true,
char2_fallback_key = "<CR>", char2_fallback_key = "<CR>",
quit_key = "<Esc>", quit_key = "<Esc>",
match_mappings = { "zh_sc" }
} }
keymap.set({ "n", "v", "o" }, "f", "", { keymap.set({ "n", "v", "o" }, "f", "", {
@@ -17,7 +18,7 @@ keymap.set({ "n", "v", "o" }, "f", "", {
vim.api.nvim_create_autocmd("ColorScheme", { vim.api.nvim_create_autocmd("ColorScheme", {
pattern = "*", pattern = "*",
callback = function () callback = function()
vim.cmd([[ vim.cmd([[
hi HopNextKey cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff hi HopNextKey cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff
hi HopNextKey1 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff hi HopNextKey1 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff

View File

@@ -172,7 +172,6 @@ require("lualine").setup {
}, },
lualine_y = { lualine_y = {
"location", "location",
"progress",
}, },
lualine_z = { lualine_z = {
{ {

View File

@@ -1,60 +1,6 @@
require("which-key").setup { require("which-key").setup {
plugins = { preset = "modern",
marks = true, -- shows a list of your marks on ' and `
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
spelling = {
enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
suggestions = 9, -- how many suggestions should be shown in the list?
},
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
-- No actual key bindings are created
presets = {
operators = true, -- adds help for operators like d, y, ... and registers them for motion / text object completion
motions = true, -- adds help for motions
text_objects = true, -- help for text objects triggered after entering an operator
windows = true, -- default bindings on <c-w>
nav = true, -- misc bindings to work with windows
z = true, -- bindings for folds, spelling and others prefixed with z
g = true, -- bindings for prefixed with g
},
},
-- add operators that will trigger motion and text object completion
-- to enable all native operators, set the preset / operators plugin above
operators = { gc = "Comments" },
key_labels = {
-- override the label used to display some keys. It doesn't effect WK in any other way.
-- For example:
-- ["<space>"] = "SPC",
-- ["<cr>"] = "RET",
-- ["<tab>"] = "TAB",
},
icons = { icons = {
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo mappings = false
separator = "", -- symbol used between a key and it's label }
group = "+", -- symbol prepended to a group
},
window = {
border = "none", -- none, single, double, shadow
position = "bottom", -- bottom, top
margin = { 0, 0, 0, 0 }, -- extra window margin [top, right, bottom, left]
padding = { 1, 0, 1, 0 }, -- extra window padding [top, right, bottom, left]
},
layout = {
height = { min = 1, max = 25 }, -- min and max height of the columns
width = { min = 20, max = 50 }, -- min and max width of the columns
spacing = 1, -- spacing between columns
align = "center", -- align columns left, center or right
},
ignore_missing = false, -- enable this to hide mappings for which you didn't specify a label
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
show_help = true, -- show help message on the command line when the popup is visible
triggers = "auto", -- automatically setup triggers
-- triggers = {"<leader>"} -- or specify a list manually
triggers_blacklist = {
-- list of mode / prefixes that should never be hooked by WhichKey
-- this is mostly relevant for key maps that start with a native binding
-- most people should not need to change this
n = { "o", "O" },
},
} }

View File

@@ -83,3 +83,23 @@ api.nvim_create_autocmd("VimResized", {
desc = "autoresize windows on resizing operation", desc = "autoresize windows on resizing operation",
command = "wincmd =", command = "wincmd =",
}) })
local function open_nvim_tree(data)
-- check if buffer is a directory
local directory = vim.fn.isdirectory(data.file) == 1
if not directory then
return
end
-- create a new, empty buffer
vim.cmd.enew()
-- wipe the directory buffer
vim.cmd.bw(data.buf)
-- open the tree
require("nvim-tree.api").tree.open()
end
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })

View File

@@ -1,6 +1,6 @@
local keymap = vim.keymap local keymap = vim.keymap
local api = vim.api local api = vim.api
local uv = vim.loop local uv = vim.uv
-- Save key strokes (now we do not need to press shift to enter command mode). -- Save key strokes (now we do not need to press shift to enter command mode).
keymap.set({ "n", "x" }, ";", ":") keymap.set({ "n", "x" }, ";", ":")
@@ -170,7 +170,7 @@ keymap.set("n", "<Down>", "<C-W>j")
keymap.set({ "x", "o" }, "iu", "<cmd>call text_obj#URL()<cr>", { desc = "URL text object" }) keymap.set({ "x", "o" }, "iu", "<cmd>call text_obj#URL()<cr>", { desc = "URL text object" })
-- Text objects for entire buffer -- Text objects for entire buffer
keymap.set({ "x", "o" }, "iB", "<cmd>call text_obj#Buffer()<cr>", { desc = "buffer text object" }) keymap.set({ "x", "o" }, "iB", ":<C-U>call text_obj#Buffer()<cr>", { desc = "buffer text object" })
-- Do not move my cursor when joining lines. -- Do not move my cursor when joining lines.
keymap.set("n", "J", function() keymap.set("n", "J", function()
@@ -179,17 +179,17 @@ keymap.set("n", "J", function()
delmarks z delmarks z
]]) ]])
end, { end, {
desc = "join line", desc = "join lines without moving cursor",
}) })
keymap.set("n", "gJ", function() keymap.set("n", "gJ", function()
-- we must use `normal!`, otherwise it will trigger recursive mapping -- we must use `normal!`, otherwise it will trigger recursive mapping
vim.cmd([[ vim.cmd([[
normal! zmgJ`z normal! mzgJ`z
delmarks z delmarks z
]]) ]])
end, { end, {
desc = "join visual lines", desc = "join lines without moving cursor",
}) })
-- Break inserted text into smaller undo units when we insert some punctuation chars. -- Break inserted text into smaller undo units when we insert some punctuation chars.
@@ -217,7 +217,7 @@ keymap.set("n", "<leader>cb", function()
local timer = uv.new_timer() local timer = uv.new_timer()
timer:start(0, 100, vim.schedule_wrap(function() timer:start(0, 100, vim.schedule_wrap(function()
vim.cmd[[ vim.cmd [[
set cursorcolumn! set cursorcolumn!
set cursorline! set cursorline!
]] ]]
@@ -227,5 +227,7 @@ keymap.set("n", "<leader>cb", function()
end end
cnt = cnt + 1 cnt = cnt + 1
end)) end)
end) )
end,
{ desc = "show cursor" })

View File

@@ -2,7 +2,7 @@ local utils = require("utils")
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then if not vim.uv.fs_stat(lazypath) then
vim.fn.system { vim.fn.system {
"git", "git",
"clone", "clone",
@@ -91,9 +91,7 @@ local plugin_specs = {
"smoka7/hop.nvim", "smoka7/hop.nvim",
event = "VeryLazy", event = "VeryLazy",
config = function() config = function()
vim.defer_fn(function()
require("config.nvim_hop") require("config.nvim_hop")
end, 2000)
end, end,
}, },
@@ -123,19 +121,20 @@ local plugin_specs = {
"nvim-telescope/telescope-symbols.nvim", "nvim-telescope/telescope-symbols.nvim",
}, },
}, },
{
"lukas-reineke/headlines.nvim",
dependencies = "nvim-treesitter/nvim-treesitter",
config = true, -- or `opts = {}`
},
-- 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.
{ "navarasu/onedark.nvim", lazy = true }, { "navarasu/onedark.nvim", lazy = true },
{ "sainnhe/edge", lazy = true }, { "sainnhe/edge", lazy = true },
{ "sainnhe/sonokai", lazy = true }, { "sainnhe/sonokai", lazy = true },
{ "sainnhe/gruvbox-material", lazy = true }, { "sainnhe/gruvbox-material", lazy = true },
{ "shaunsingh/nord.nvim", lazy = true },
{ "sainnhe/everforest", lazy = true }, { "sainnhe/everforest", lazy = true },
{ "EdenEast/nightfox.nvim", lazy = true }, { "EdenEast/nightfox.nvim", lazy = true },
{ "rebelot/kanagawa.nvim", lazy = true },
{ "catppuccin/nvim", name = "catppuccin", lazy = true }, { "catppuccin/nvim", name = "catppuccin", lazy = true },
{ "olimorris/onedarkpro.nvim", lazy = true }, { "olimorris/onedarkpro.nvim", lazy = true },
{ "tanvirtin/monokai.nvim", lazy = true },
{ "marko-cerovac/material.nvim", lazy = true }, { "marko-cerovac/material.nvim", lazy = true },
{ "nvim-tree/nvim-web-devicons", event = "VeryLazy" }, { "nvim-tree/nvim-web-devicons", event = "VeryLazy" },
@@ -184,9 +183,7 @@ local plugin_specs = {
"rcarriga/nvim-notify", "rcarriga/nvim-notify",
event = "VeryLazy", event = "VeryLazy",
config = function() config = function()
vim.defer_fn(function()
require("config.nvim-notify") require("config.nvim-notify")
end, 2000)
end, end,
}, },
@@ -224,7 +221,11 @@ local plugin_specs = {
}, event = "InsertEnter" }, }, event = "InsertEnter" },
-- Automatic insertion and deletion of a pair of characters -- Automatic insertion and deletion of a pair of characters
{ "Raimondi/delimitMate", event = "InsertEnter" }, {
'windwp/nvim-autopairs',
event = "InsertEnter",
config = true
},
-- Comment plugin -- Comment plugin
{ "tpope/vim-commentary", event = "VeryLazy" }, { "tpope/vim-commentary", event = "VeryLazy" },
@@ -294,7 +295,7 @@ local plugin_specs = {
-- Better git log display -- Better git log display
{ "rbong/vim-flog", cmd = { "Flog" } }, { "rbong/vim-flog", cmd = { "Flog" } },
{ "christoomey/vim-conflicted", cmd = { "Conflicted" } }, { "akinsho/git-conflict.nvim", version = "*", config = true },
{ {
"ruifm/gitlinker.nvim", "ruifm/gitlinker.nvim",
event = "User InGitRepo", event = "User InGitRepo",
@@ -313,6 +314,11 @@ local plugin_specs = {
-- Better git commit experience -- Better git commit experience
{ "rhysd/committia.vim", lazy = true }, { "rhysd/committia.vim", lazy = true },
{
"sindrets/diffview.nvim"
},
{ {
"kevinhwang91/nvim-bqf", "kevinhwang91/nvim-bqf",
ft = "qf", ft = "qf",
@@ -461,9 +467,7 @@ local plugin_specs = {
"folke/which-key.nvim", "folke/which-key.nvim",
event = "VeryLazy", event = "VeryLazy",
config = function() config = function()
vim.defer_fn(function()
require("config.which-key") require("config.which-key")
end, 2000)
end, end,
}, },
@@ -480,7 +484,6 @@ local plugin_specs = {
end, end,
}, },
{ "ii14/emmylua-nvim", ft = "lua" },
{ {
"j-hui/fidget.nvim", "j-hui/fidget.nvim",
event = "VeryLazy", event = "VeryLazy",

View File

@@ -1,7 +1,7 @@
scriptencoding utf-8 scriptencoding utf-8
" change fillchars for folding, vertical split, end of buffer, and message separator " change fillchars for folding, vertical split, end of buffer, and message separator
set fillchars=fold:\ ,vert:\│,eob:\ ,msgsep:‾ set fillchars=fold:\ ,vert:\│,eob:\ ,msgsep:‾,diff:
" Split window below/right when creating horizontal/vertical windows " Split window below/right when creating horizontal/vertical windows
set splitbelow splitright set splitbelow splitright

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('plugin_specs')
" 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