Skip to content

Commit 6cbec4c

Browse files
committed
Merge 0.9 from ayamir-main
2 parents fbe7be4 + f3520c9 commit 6cbec4c

22 files changed

+117
-62
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ body:
6060
options:
6161
- main (Default/Latest)
6262
- 0.8 (Legacy)
63-
- 0.7 (Bug fixes only)
63+
- 0.7 (Deprecated)
6464
validations:
6565
required: true
6666
- type: dropdown

.github/ISSUE_TEMPLATE/config.yml

+7
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
11
blank_issues_enabled: true
2+
contact_links:
3+
- name: GitHub Discussions
4+
url: https://github.com/ayamir/nvimdots/discussions/new/choose
5+
about: Any issue that does not fall into the above categories shall go here
6+
- name: GitHub Wiki
7+
url: https://github.com/ayamir/nvimdots/wiki
8+
about: Make sure you have checked our documentation first. To be explicit, the "Issues" section

.github/ISSUE_TEMPLATE/lsp_issue_report.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ body:
6060
options:
6161
- main (Default/Latest)
6262
- 0.8 (Legacy)
63-
- 0.7 (Bug fixes only)
63+
- 0.7 (Deprecated)
6464
validations:
6565
required: true
6666
- type: dropdown

README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@
3838

3939
This repo hosts my [NeoVim](https://neovim.io/) configuration for Linux, macOS, and Windows. `init.lua` is the config entry point.
4040

41-
It contains two branches:
41+
Branch info:
4242

4343
<div align="center">
4444

45-
| Branch | Completion Solution |
46-
| :----: | :------------------------: |
47-
| main | config for nvim 0.8 stable |
48-
| 0.7 | config for nvim 0.7 stable |
45+
| Branch | Supported neovim version |
46+
| :----: | :----------------------: |
47+
| main | nvim 0.9 stable |
48+
| 0.8 | nvim 0.8 |
49+
| 0.7 | nvim 0.7 |
4950

5051
</div>
5152

lua/core/init.lua

+29
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,42 @@ local clipboard_config = function()
180180
end
181181
end
182182

183+
local shell_config = function()
184+
if global.is_windows then
185+
if not (vim.fn.executable("pwsh") or vim.fn.executable("powershell")) then
186+
vim.notify(
187+
[[
188+
Failed to setup terminal config
189+
190+
PowerShell is either not installed, missing from PATH, or not executable;
191+
cmd.exe will be used instead for `:!` (shell bang) and toggleterm.nvim.
192+
193+
You're recommended to install PowerShell for better experience.]],
194+
vim.log.levels.WARN,
195+
{ title = "[core] Runtime error" }
196+
)
197+
return
198+
end
199+
200+
local basecmd = "-NoLogo -MTA -ExecutionPolicy RemoteSigned"
201+
local ctrlcmd = "-Command [console]::InputEncoding = [console]::OutputEncoding = [System.Text.Encoding]::UTF8"
202+
vim.api.nvim_set_option_value("shell", vim.fn.executable("pwsh") and "pwsh" or "powershell", {})
203+
vim.api.nvim_set_option_value("shellcmdflag", string.format("%s %s;", basecmd, ctrlcmd), {})
204+
vim.api.nvim_set_option_value("shellredir", "-RedirectStandardOutput %s -NoNewWindow -Wait", {})
205+
vim.api.nvim_set_option_value("shellpipe", "2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode", {})
206+
vim.api.nvim_set_option_value("shellquote", nil, {})
207+
vim.api.nvim_set_option_value("shellxquote", nil, {})
208+
end
209+
end
210+
183211
local load_core = function()
184212
createdir()
185213
disable_distribution_plugins()
186214
leader_map()
187215

188216
neovide_config()
189217
clipboard_config()
218+
shell_config()
190219

191220
require("core.options")
192221
require("core.mapping")

lua/core/mapping.lua

+8-15
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ local core_map = {
1212
["n|n"] = map_cmd("nzzzv"):with_noremap():with_desc("edit: Next search result"),
1313
["n|N"] = map_cmd("Nzzzv"):with_noremap():with_desc("edit: Prev search result"),
1414
["n|J"] = map_cmd("mzJ`z"):with_noremap():with_desc("edit: Join next line"),
15-
["n|<Esc>"] = map_cmd("<Cmd>noh<CR>"):with_noremap():with_silent():with_desc("edit: Clear search highlight"),
15+
["n|<Esc>"] = map_cr("noh"):with_noremap():with_silent():with_desc("edit: Clear search highlight"),
1616
["n|<C-h>"] = map_cmd("<C-w>h"):with_noremap():with_desc("window: Focus left"),
1717
["n|<C-l>"] = map_cmd("<C-w>l"):with_noremap():with_desc("window: Focus right"),
1818
["n|<C-j>"] = map_cmd("<C-w>j"):with_noremap():with_desc("window: Focus down"),
@@ -25,17 +25,17 @@ local core_map = {
2525
["n|<A-]>"] = map_cr("vertical resize +5"):with_silent():with_desc("window: Resize +5 vertically"),
2626
["n|<A-;>"] = map_cr("resize -2"):with_silent():with_desc("window: Resize -2 horizontally"),
2727
["n|<A-'>"] = map_cr("resize +2"):with_silent():with_desc("window: Resize +2 horizontally"),
28-
["n|<C-q>"] = map_cmd(":wq<CR>"):with_desc("edit: Save file and quit"),
29-
["n|<A-S-q>"] = map_cmd(":q!<CR>"):with_desc("edit: Force quit"),
28+
["n|<C-q>"] = map_cr("wq"):with_desc("edit: Save file and quit"),
29+
["n|<A-S-q>"] = map_cr("q!"):with_desc("edit: Force quit"),
3030
["n|<leader>o"] = map_cr("setlocal spell! spelllang=en_us"):with_desc("edit: Toggle spell check"),
3131
["n|+"] = map_cmd("<C-a>"):with_noremap():with_silent():with_desc("edit: Increment"),
3232
["n|-"] = map_cmd("<C-x>"):with_noremap():with_silent():with_desc("edit: Decrement"),
3333
["n|<C-a>"] = map_cmd("gg0vG$"):with_noremap():with_silent():with_desc("edit: Select all"),
34-
["n|tn"] = map_cmd("<Cmd>tabnew<CR>"):with_noremap():with_silent():with_desc("tab: Create a new tab"),
35-
["n|tk"] = map_cmd("<Cmd>tabnext<CR>"):with_noremap():with_silent():with_desc("tab: Move to next tab"),
36-
["n|tj"] = map_cmd("<Cmd>tabprevious<CR>"):with_noremap():with_silent():with_desc("tab: Move to previous tab"),
37-
["n|to"] = map_cmd("<Cmd>tabonly<CR>"):with_noremap():with_silent():with_desc("tab: Only keep current tab"),
38-
["n|<leader><leader>x"] = map_cmd("<Cmd>!chmod +x %<CR>"):with_silent():with_desc("file: chmod +x current file"),
34+
["x|<C-a>"] = map_cmd("<Esc>gg0vG$"):with_noremap():with_silent():with_desc("edit: Select all"),
35+
["n|tn"] = map_cr("tabnew"):with_noremap():with_silent():with_desc("tab: Create a new tab"),
36+
["n|tk"] = map_cr("tabnext"):with_noremap():with_silent():with_desc("tab: Move to next tab"),
37+
["n|tj"] = map_cr("tabprevious"):with_noremap():with_silent():with_desc("tab: Move to previous tab"),
38+
["n|to"] = map_cr("tabonly"):with_noremap():with_silent():with_desc("tab: Only keep current tab"),
3939
-- Insert mode
4040
["i|<C-u>"] = map_cmd("<C-G>u<C-U>"):with_noremap():with_desc("edit: Delete previous block"),
4141
["i|<C-b>"] = map_cmd("<Left>"):with_noremap():with_desc("edit: Move cursor to left"),
@@ -60,10 +60,3 @@ local core_map = {
6060
}
6161

6262
bind.nvim_load_mapping(core_map)
63-
64-
vim.api.nvim_set_keymap(
65-
"n",
66-
"<leader><leader>s",
67-
"<Cmd>%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>",
68-
{ noremap = true, silent = true, nowait = true, desc = "edit: Start replacment mode of current word" }
69-
)

lua/core/options.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ local function load_options()
125125
-- Fix sqlite3 missing-lib issue on Windows
126126
if global.is_windows then
127127
-- Download the DLLs form https://www.sqlite.org/download.html
128-
vim.g.sqlite_clib_path = global.home .. "/Documents/sqlite-dll-win64-x64-3400100/sqlite3.dll"
128+
vim.g.sqlite_clib_path = global.home .. "/Documents/sqlite-dll-win64-x64-3400200/sqlite3.dll"
129129
end
130130
end
131131

lua/core/settings.lua

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ settings["palette_overwrite"] = {}
3232
---@type string
3333
settings["colorscheme"] = "catppuccin"
3434

35+
-- Set it to true if your terminal has transparent background.
36+
---@type boolean
37+
settings["transparent_background"] = false
38+
3539
-- Set background color to use here.
3640
-- Useful if you would like to use a colorscheme that has a light and dark variant like `edge`.
3741
-- Valid values are: `dark`, `light`.

lua/modules/configs/completion/cmp.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ return function()
5353
local source_symbol = opts.symbol_map[entry.source.name] or icons.cmp.undefined
5454

5555
vim_item.menu = " " .. source_symbol .. " |"
56-
vim_item.kind = string.format(" %s %s ", kind_symbol, vim_item.kind)
56+
vim_item.kind = string.format(" %s %s ", kind_symbol, vim_item.kind)
5757

5858
if opts.maxwidth ~= nil then
5959
if opts.ellipsis_char == nil then

lua/modules/configs/completion/formatting.lua

+21-9
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ vim.api.nvim_create_user_command("FormatterToggleFt", function(opts)
1515
vim.notify(
1616
string.format("[LSP] Formatter for [%s] has been recorded in list and disabled.", opts.args),
1717
vim.log.levels.WARN,
18-
{ title = "LSP Formatter Warning!" }
18+
{ title = "LSP Formatter Warning" }
1919
)
2020
block_list[opts.args] = true
2121
else
@@ -39,22 +39,29 @@ function M.enable_format_on_save(is_configured)
3939
group = "format_on_save",
4040
pattern = opts.pattern,
4141
callback = function()
42-
require("completion.formatting").format({ timeout_ms = opts.timeout, filter = M.format_filter })
42+
require("completion.formatting").format({
43+
timeout_ms = opts.timeout,
44+
filter = M.format_filter,
45+
})
4346
end,
4447
})
4548
if not is_configured then
4649
vim.notify(
4750
"Successfully enabled format-on-save",
4851
vim.log.levels.INFO,
49-
{ title = "Settings modification success!" }
52+
{ title = "Settings modification success" }
5053
)
5154
end
5255
end
5356

5457
function M.disable_format_on_save()
5558
pcall(vim.api.nvim_del_augroup_by_name, "format_on_save")
5659
if format_on_save then
57-
vim.notify("Disabled format-on-save", vim.log.levels.INFO, { title = "Settings modification success!" })
60+
vim.notify(
61+
"Successfully disabled format-on-save",
62+
vim.log.levels.INFO,
63+
{ title = "Settings modification success" }
64+
)
5865
end
5966
end
6067

@@ -95,6 +102,11 @@ function M.format(opts)
95102
local cwd = vim.fn.getcwd()
96103
for i = 1, #disabled_workspaces do
97104
if cwd.find(cwd, disabled_workspaces[i]) ~= nil then
105+
vim.notify(
106+
string.format("[LSP] Formatting support for all files under [%s] is disabled.", disabled_workspaces[i]),
107+
vim.log.levels.WARN,
108+
{ title = "LSP Formatter Warning" }
109+
)
98110
return
99111
end
100112
end
@@ -122,7 +134,7 @@ function M.format(opts)
122134
vim.notify(
123135
"[LSP] Format request failed, no matching language servers.",
124136
vim.log.levels.WARN,
125-
{ title = "Formatting Failed!" }
137+
{ title = "Formatting Failed" }
126138
)
127139
end
128140

@@ -136,7 +148,7 @@ function M.format(opts)
136148
vim.bo.filetype
137149
),
138150
vim.log.levels.WARN,
139-
{ title = "LSP Formatter Warning!" }
151+
{ title = "LSP Formatter Warning" }
140152
)
141153
return
142154
end
@@ -145,15 +157,15 @@ function M.format(opts)
145157
if result and result.result then
146158
vim.lsp.util.apply_text_edits(result.result, bufnr, client.offset_encoding)
147159
vim.notify(
148-
string.format("[LSP] Format successfully with [%s]!", client.name),
160+
string.format("[LSP] Format successfully with %s!", client.name),
149161
vim.log.levels.INFO,
150-
{ title = "LSP Format Success!", timeout = 2000 }
162+
{ title = "LSP Format Success" }
151163
)
152164
elseif err then
153165
vim.notify(
154166
string.format("[LSP][%s] %s", client.name, err),
155167
vim.log.levels.ERROR,
156-
{ title = "LSP Format Error!" }
168+
{ title = "LSP Format Error" }
157169
)
158170
end
159171
end
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
return function() end

lua/modules/configs/tool/project.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ return function()
33
manual_mode = false,
44
detection_methods = { "lsp", "pattern" },
55
patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" },
6-
ignore_lsp = { "efm", "copilot" },
6+
ignore_lsp = { "null-ls", "copilot" },
77
exclude_dirs = {},
88
show_hidden = false,
99
silent_chdir = true,

lua/modules/configs/ui/bufferline.lua

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ return function()
1414
color_icons = true,
1515
show_buffer_icons = true,
1616
show_buffer_close_icons = true,
17-
show_buffer_default_icon = true,
1817
show_close_icon = true,
1918
show_tab_indicators = true,
2019
enforce_regular_tabs = true,

lua/modules/configs/ui/catppuccin.lua

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
return function()
2-
local transparent_background = false -- Set background transparency here!
3-
42
require("catppuccin").setup({
53
flavour = "mocha", -- Can be one of: latte, frappe, macchiato, mocha
64
background = { light = "latte", dark = "mocha" },
@@ -11,7 +9,7 @@ return function()
119
shade = "dark",
1210
percentage = 0.15,
1311
},
14-
transparent_background = transparent_background,
12+
transparent_background = require("core.settings").transparent_background,
1513
show_end_of_buffer = false, -- show the '~' characters after the end of buffers
1614
term_colors = true,
1715
compile_path = vim.fn.stdpath("cache") .. "/catppuccin",

lua/modules/configs/ui/edge.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ return function()
44
vim.g.edge_disable_italic_comment = 1
55
vim.g.edge_show_eob = 1
66
vim.g.edge_better_performance = 1
7-
vim.g.edge_transparent_background = 1
7+
vim.g.edge_transparent_background = require("core.settings").transparent_background and 2 or 0
88
end

lua/modules/configs/ui/nord.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ return function()
22
vim.g.nord_contrast = true
33
vim.g.nord_borders = false
44
vim.g.nord_cursorline_transparent = true
5-
vim.g.nord_disable_background = false
5+
vim.g.nord_disable_background = require("core.settings").transparent_background
66
vim.g.nord_enable_sidebar_background = true
77
vim.g.nord_italic = true
88
end

lua/modules/configs/ui/paint.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ return function()
1212
},
1313
{
1414
filter = { filetype = "python" },
15-
pattern = "%s*(%w+:)",
15+
pattern = "%s*([_%w]+:)",
1616
hl = "Constant",
1717
},
1818
},

lua/modules/plugins/completion.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ completion["neovim/nvim-lspconfig"] = {
99
{ "williamboman/mason.nvim" },
1010
{ "williamboman/mason-lspconfig.nvim" },
1111
{
12-
"glepnir/lspsaga.nvim",
12+
"nvimdev/lspsaga.nvim",
1313
config = require("completion.lspsaga"),
1414
},
1515
},

lua/modules/plugins/editor.lua

-4
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ editor["RRethy/vim-illuminate"] = {
5858
event = { "CursorHold", "CursorHoldI" },
5959
config = require("editor.vim-illuminate"),
6060
}
61-
editor["luukvbaal/stabilize.nvim"] = {
62-
lazy = true,
63-
event = "BufReadPost",
64-
}
6561
editor["romainl/vim-cool"] = {
6662
lazy = true,
6763
event = { "CursorMoved", "InsertEnter" },

lua/modules/utils/icons.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,13 @@ local data = {
163163
cmp = {
164164
Codeium = "",
165165
TabNine = "",
166-
Copilot = "",
167-
Copilot_alt = "",
166+
Copilot = "",
168167
-- Add source-specific icons here
169168
buffer = "",
170-
cmp_tabnine = "",
171-
codeium = "",
169+
cmp_tabnine = "",
170+
codeium = "",
172171
copilot = "",
172+
copilot_alt = "",
173173
latex_symbols = "",
174174
luasnip = "",
175175
nvim_lsp = "",

0 commit comments

Comments
 (0)