mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Compare commits
6 Commits
d941be482b
...
7e706515a8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e706515a8 | ||
|
|
1d66475cae | ||
|
|
5328c477a8 | ||
|
|
917ab82ffb | ||
|
|
54eb3ca811 | ||
|
|
64b41fbd58 |
@ -4,4 +4,4 @@ set formatoptions-=r
|
|||||||
|
|
||||||
nnoremap <buffer><silent> <F9> :luafile %<CR>
|
nnoremap <buffer><silent> <F9> :luafile %<CR>
|
||||||
|
|
||||||
nnoremap <buffer><silent> <space>f <cmd>!stylua %<CR>
|
nnoremap <buffer><silent> <space>f <cmd>silent !stylua %<CR>
|
||||||
|
|||||||
@ -50,18 +50,18 @@ M.colorscheme_conf = {
|
|||||||
end,
|
end,
|
||||||
onedarkpro = function()
|
onedarkpro = function()
|
||||||
-- set colorscheme after options
|
-- set colorscheme after options
|
||||||
vim.cmd('colorscheme onedark_vivid')
|
vim.cmd("colorscheme onedark_vivid")
|
||||||
end,
|
end,
|
||||||
material = function()
|
material = function()
|
||||||
vim.g.material_style = "oceanic"
|
vim.g.material_style = "oceanic"
|
||||||
vim.cmd('colorscheme material')
|
vim.cmd("colorscheme material")
|
||||||
end,
|
end,
|
||||||
arctic = function()
|
arctic = function()
|
||||||
vim.cmd("colorscheme arctic")
|
vim.cmd("colorscheme arctic")
|
||||||
end,
|
end,
|
||||||
kanagawa = function()
|
kanagawa = function()
|
||||||
vim.cmd("colorscheme kanagawa-wave")
|
vim.cmd("colorscheme kanagawa-wave")
|
||||||
end
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Use a random colorscheme from the pre-defined list of colorschemes.
|
--- Use a random colorscheme from the pre-defined list of colorschemes.
|
||||||
|
|||||||
@ -59,11 +59,11 @@ conf.center = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
dashboard.setup({
|
dashboard.setup {
|
||||||
theme = 'doom',
|
theme = "doom",
|
||||||
shortcut_type = 'number',
|
shortcut_type = "number",
|
||||||
config = conf
|
config = conf,
|
||||||
})
|
}
|
||||||
|
|
||||||
api.nvim_create_autocmd("FileType", {
|
api.nvim_create_autocmd("FileType", {
|
||||||
pattern = "dashboard",
|
pattern = "dashboard",
|
||||||
@ -71,5 +71,5 @@ api.nvim_create_autocmd("FileType", {
|
|||||||
callback = function()
|
callback = function()
|
||||||
keymap.set("n", "q", ":qa<CR>", { buffer = true, silent = true })
|
keymap.set("n", "q", ":qa<CR>", { buffer = true, silent = true })
|
||||||
keymap.set("n", "e", ":enew<CR>", { buffer = true, silent = true })
|
keymap.set("n", "e", ":enew<CR>", { buffer = true, silent = true })
|
||||||
end
|
end,
|
||||||
})
|
})
|
||||||
|
|||||||
@ -5,16 +5,26 @@ gitlinker.setup {
|
|||||||
callbacks = {
|
callbacks = {
|
||||||
["dev.azure.com"] = function(url_data)
|
["dev.azure.com"] = function(url_data)
|
||||||
vim.print(url_data)
|
vim.print(url_data)
|
||||||
local url = require"gitlinker.hosts".get_base_https_url(url_data)
|
local url = require("gitlinker.hosts").get_base_https_url(url_data)
|
||||||
|
|
||||||
if url_data.lstart then
|
if url_data.lstart then
|
||||||
if url_data.lend == nil then
|
if url_data.lend == nil then
|
||||||
url_data.lend = url_data.lstart
|
url_data.lend = url_data.lstart
|
||||||
end
|
end
|
||||||
url = url .. "?path=/" .. url_data.file .. "&version=GC" .. url_data.rev .. "&line=" .. url_data.lstart .. "&lineEnd=" .. url_data.lend .. "&lineStartColumn=1" .. "&lineEndColumn=120"
|
url = url
|
||||||
|
.. "?path=/"
|
||||||
|
.. url_data.file
|
||||||
|
.. "&version=GC"
|
||||||
|
.. url_data.rev
|
||||||
|
.. "&line="
|
||||||
|
.. url_data.lstart
|
||||||
|
.. "&lineEnd="
|
||||||
|
.. url_data.lend
|
||||||
|
.. "&lineStartColumn=1"
|
||||||
|
.. "&lineEndColumn=120"
|
||||||
end
|
end
|
||||||
return url
|
return url
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
mappings = nil,
|
mappings = nil,
|
||||||
}
|
}
|
||||||
@ -28,9 +38,9 @@ end, {
|
|||||||
})
|
})
|
||||||
|
|
||||||
keymap.set("n", "<leader>gbr", function()
|
keymap.set("n", "<leader>gbr", function()
|
||||||
gitlinker.get_repo_url({
|
gitlinker.get_repo_url {
|
||||||
action_callback = gitlinker.actions.open_in_browser
|
action_callback = gitlinker.actions.open_in_browser,
|
||||||
})
|
}
|
||||||
end, {
|
end, {
|
||||||
silent = true,
|
silent = true,
|
||||||
desc = "Git: browse repo in browser",
|
desc = "Git: browse repo in browser",
|
||||||
|
|||||||
@ -45,13 +45,13 @@ gs.setup {
|
|||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('ColorScheme', {
|
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.cmd [[
|
vim.cmd([[
|
||||||
hi GitSignsChangeInline gui=reverse
|
hi GitSignsChangeInline gui=reverse
|
||||||
hi GitSignsAddInline gui=reverse
|
hi GitSignsAddInline gui=reverse
|
||||||
hi GitSignsDeleteInline gui=reverse
|
hi GitSignsDeleteInline gui=reverse
|
||||||
]]
|
]])
|
||||||
end
|
end,
|
||||||
})
|
})
|
||||||
|
|||||||
@ -14,7 +14,7 @@ local activate_hlslens = function(direction)
|
|||||||
|
|
||||||
-- Deal with the case that there is no such pattern in current buffer.
|
-- Deal with the case that there is no such pattern in current buffer.
|
||||||
if not status then
|
if not status then
|
||||||
local start_idx, _ = string.find(msg, 'E486', 1, true)
|
local start_idx, _ = string.find(msg, "E486", 1, true)
|
||||||
local msg_part = string.sub(msg, start_idx)
|
local msg_part = string.sub(msg, start_idx)
|
||||||
api.nvim_err_writeln(msg_part)
|
api.nvim_err_writeln(msg_part)
|
||||||
return
|
return
|
||||||
|
|||||||
@ -13,10 +13,10 @@ local set_qflist = function(buf_num, severity)
|
|||||||
diagnostics = diagnostic.get(buf_num, { severity = severity })
|
diagnostics = diagnostic.get(buf_num, { severity = severity })
|
||||||
|
|
||||||
local qf_items = diagnostic.toqflist(diagnostics)
|
local qf_items = diagnostic.toqflist(diagnostics)
|
||||||
vim.fn.setqflist({}, ' ', { title = 'Diagnostics', items = qf_items })
|
vim.fn.setqflist({}, " ", { title = "Diagnostics", items = qf_items })
|
||||||
|
|
||||||
-- open quickfix by default
|
-- open quickfix by default
|
||||||
vim.cmd[[copen]]
|
vim.cmd([[copen]])
|
||||||
end
|
end
|
||||||
|
|
||||||
local custom_attach = function(client, bufnr)
|
local custom_attach = function(client, bufnr)
|
||||||
@ -39,7 +39,9 @@ local custom_attach = function(client, bufnr)
|
|||||||
-- this puts diagnostics from opened files to quickfix
|
-- this puts diagnostics from opened files to quickfix
|
||||||
map("n", "<space>qw", diagnostic.setqflist, { desc = "put window diagnostics to qf" })
|
map("n", "<space>qw", diagnostic.setqflist, { desc = "put window diagnostics to qf" })
|
||||||
-- this puts diagnostics from current buffer to quickfix
|
-- this puts diagnostics from current buffer to quickfix
|
||||||
map("n", "<space>qb", function() set_qflist(bufnr) end, { desc = "put buffer diagnostics to qf" })
|
map("n", "<space>qb", function()
|
||||||
|
set_qflist(bufnr)
|
||||||
|
end, { desc = "put buffer diagnostics to qf" })
|
||||||
map("n", "<space>ca", vim.lsp.buf.code_action, { desc = "LSP code action" })
|
map("n", "<space>ca", vim.lsp.buf.code_action, { desc = "LSP code action" })
|
||||||
map("n", "<space>wa", vim.lsp.buf.add_workspace_folder, { desc = "add workspace folder" })
|
map("n", "<space>wa", vim.lsp.buf.add_workspace_folder, { desc = "add workspace folder" })
|
||||||
map("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, { desc = "remove workspace folder" })
|
map("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, { desc = "remove workspace folder" })
|
||||||
@ -48,7 +50,7 @@ local custom_attach = function(client, bufnr)
|
|||||||
end, { desc = "list workspace folder" })
|
end, { desc = "list workspace folder" })
|
||||||
|
|
||||||
-- Set some key bindings conditional on server capabilities
|
-- Set some key bindings conditional on server capabilities
|
||||||
if client.server_capabilities.documentFormattingProvider then
|
if client.server_capabilities.documentFormattingProvider and client.name ~= "lua_ls" then
|
||||||
map({ "n", "x" }, "<space>f", vim.lsp.buf.format, { desc = "format code" })
|
map({ "n", "x" }, "<space>f", vim.lsp.buf.format, { desc = "format code" })
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -72,7 +74,8 @@ local custom_attach = function(client, bufnr)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local cursor_pos = api.nvim_win_get_cursor(0)
|
local cursor_pos = api.nvim_win_get_cursor(0)
|
||||||
if (cursor_pos[1] ~= vim.b.diagnostics_pos[1] or cursor_pos[2] ~= vim.b.diagnostics_pos[2])
|
if
|
||||||
|
(cursor_pos[1] ~= vim.b.diagnostics_pos[1] or cursor_pos[2] ~= vim.b.diagnostics_pos[2])
|
||||||
and #diagnostic.get() > 0
|
and #diagnostic.get() > 0
|
||||||
then
|
then
|
||||||
diagnostic.open_float(nil, float_opts)
|
diagnostic.open_float(nil, float_opts)
|
||||||
@ -96,7 +99,7 @@ local custom_attach = function(client, bufnr)
|
|||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = function()
|
callback = function()
|
||||||
lsp.buf.document_highlight()
|
lsp.buf.document_highlight()
|
||||||
end
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
api.nvim_create_autocmd("CursorMoved", {
|
api.nvim_create_autocmd("CursorMoved", {
|
||||||
@ -104,7 +107,7 @@ local custom_attach = function(client, bufnr)
|
|||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = function()
|
callback = function()
|
||||||
lsp.buf.clear_references()
|
lsp.buf.clear_references()
|
||||||
end
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -114,12 +117,12 @@ local custom_attach = function(client, bufnr)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
|
|
||||||
-- required by nvim-ufo
|
-- required by nvim-ufo
|
||||||
capabilities.textDocument.foldingRange = {
|
capabilities.textDocument.foldingRange = {
|
||||||
dynamicRegistration = false,
|
dynamicRegistration = false,
|
||||||
lineFoldingOnly = true
|
lineFoldingOnly = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- For what diagnostic is enabled in which type checking mode, check doc:
|
-- For what diagnostic is enabled in which type checking mode, check doc:
|
||||||
@ -127,21 +130,21 @@ capabilities.textDocument.foldingRange = {
|
|||||||
-- Currently, the pyright also has some issues displaying hover documentation:
|
-- Currently, the pyright also has some issues displaying hover documentation:
|
||||||
-- https://www.reddit.com/r/neovim/comments/1gdv1rc/what_is_causeing_the_lsp_hover_docs_to_looks_like/
|
-- https://www.reddit.com/r/neovim/comments/1gdv1rc/what_is_causeing_the_lsp_hover_docs_to_looks_like/
|
||||||
|
|
||||||
if utils.executable('pyright') then
|
if utils.executable("pyright") then
|
||||||
local new_capability = {
|
local new_capability = {
|
||||||
-- this will remove some of the diagnostics that duplicates those from ruff, idea taken and adapted from
|
-- this will remove some of the diagnostics that duplicates those from ruff, idea taken and adapted from
|
||||||
-- here: https://github.com/astral-sh/ruff-lsp/issues/384#issuecomment-1989619482
|
-- here: https://github.com/astral-sh/ruff-lsp/issues/384#issuecomment-1989619482
|
||||||
textDocument = {
|
textDocument = {
|
||||||
publishDiagnostics = {
|
publishDiagnostics = {
|
||||||
tagSupport = {
|
tagSupport = {
|
||||||
valueSet = { 2 }
|
valueSet = { 2 },
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
hover = {
|
hover = {
|
||||||
contentFormat = { "plaintext" },
|
contentFormat = { "plaintext" },
|
||||||
dynamicRegistration = true,
|
dynamicRegistration = true,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
local merged_capability = vim.tbl_deep_extend("force", capabilities, new_capability)
|
local merged_capability = vim.tbl_deep_extend("force", capabilities, new_capability)
|
||||||
|
|
||||||
@ -177,25 +180,25 @@ if utils.executable('pyright') then
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
vim.notify("pyright not found!", vim.log.levels.WARN, { title = 'Nvim-config' })
|
vim.notify("pyright not found!", vim.log.levels.WARN, { title = "Nvim-config" })
|
||||||
end
|
end
|
||||||
|
|
||||||
if utils.executable("ruff") then
|
if utils.executable("ruff") then
|
||||||
require('lspconfig').ruff.setup({
|
require("lspconfig").ruff.setup {
|
||||||
on_attach = custom_attach,
|
on_attach = custom_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
init_options = {
|
init_options = {
|
||||||
-- the settings can be found here: https://docs.astral.sh/ruff/editors/settings/
|
-- the settings can be found here: https://docs.astral.sh/ruff/editors/settings/
|
||||||
settings = {
|
settings = {
|
||||||
organizeImports = true,
|
organizeImports = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Disable ruff hover feature in favor of Pyright
|
-- Disable ruff hover feature in favor of Pyright
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
group = vim.api.nvim_create_augroup('lsp_attach_disable_ruff_hover', { clear = true }),
|
group = vim.api.nvim_create_augroup("lsp_attach_disable_ruff_hover", { clear = true }),
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
-- vim.print(client.name, client.server_capabilities)
|
-- vim.print(client.name, client.server_capabilities)
|
||||||
@ -203,11 +206,11 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
|||||||
if client == nil then
|
if client == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if client.name == 'ruff' then
|
if client.name == "ruff" then
|
||||||
client.server_capabilities.hoverProvider = false
|
client.server_capabilities.hoverProvider = false
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
desc = 'LSP: Disable hover capability from Ruff',
|
desc = "LSP: Disable hover capability from Ruff",
|
||||||
})
|
})
|
||||||
|
|
||||||
if utils.executable("ltex-ls") then
|
if utils.executable("ltex-ls") then
|
||||||
@ -217,7 +220,7 @@ if utils.executable("ltex-ls") then
|
|||||||
filetypes = { "text", "plaintex", "tex", "markdown" },
|
filetypes = { "text", "plaintex", "tex", "markdown" },
|
||||||
settings = {
|
settings = {
|
||||||
ltex = {
|
ltex = {
|
||||||
language = "en"
|
language = "en",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
flags = { debounce_text_changes = 300 },
|
flags = { debounce_text_changes = 300 },
|
||||||
@ -267,8 +270,8 @@ if utils.executable("lua-language-server") then
|
|||||||
version = "LuaJIT",
|
version = "LuaJIT",
|
||||||
},
|
},
|
||||||
hint = {
|
hint = {
|
||||||
enable = true
|
enable = true,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
@ -276,10 +279,10 @@ if utils.executable("lua-language-server") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Change diagnostic signs.
|
-- Change diagnostic signs.
|
||||||
fn.sign_define("DiagnosticSignError", { text = '🆇', texthl = "DiagnosticSignError" })
|
fn.sign_define("DiagnosticSignError", { text = "🆇", texthl = "DiagnosticSignError" })
|
||||||
fn.sign_define("DiagnosticSignWarn", { text = '⚠️', texthl = "DiagnosticSignWarn" })
|
fn.sign_define("DiagnosticSignWarn", { text = "⚠️", texthl = "DiagnosticSignWarn" })
|
||||||
fn.sign_define("DiagnosticSignInfo", { text = 'ℹ️', texthl = "DiagnosticSignInfo" })
|
fn.sign_define("DiagnosticSignInfo", { text = "ℹ️", texthl = "DiagnosticSignInfo" })
|
||||||
fn.sign_define("DiagnosticSignHint", { text = '', texthl = "DiagnosticSignHint" })
|
fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
|
||||||
|
|
||||||
-- global config for diagnostic
|
-- global config for diagnostic
|
||||||
diagnostic.config {
|
diagnostic.config {
|
||||||
|
|||||||
@ -140,7 +140,7 @@ require("lualine").setup {
|
|||||||
options = {
|
options = {
|
||||||
icons_enabled = true,
|
icons_enabled = true,
|
||||||
theme = "auto",
|
theme = "auto",
|
||||||
component_separators = { left = '⏐', right = '⏐' },
|
component_separators = { left = "⏐", right = "⏐" },
|
||||||
section_separators = "",
|
section_separators = "",
|
||||||
disabled_filetypes = {},
|
disabled_filetypes = {},
|
||||||
always_divide_middle = true,
|
always_divide_middle = true,
|
||||||
@ -175,8 +175,8 @@ require("lualine").setup {
|
|||||||
source = diff,
|
source = diff,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ime_state,
|
"%S",
|
||||||
color = { fg = "black", bg = "#f46868" },
|
color = { gui = "bold", fg = "cyan" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
spell,
|
spell,
|
||||||
@ -184,6 +184,10 @@ require("lualine").setup {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
lualine_x = {
|
lualine_x = {
|
||||||
|
{
|
||||||
|
ime_state,
|
||||||
|
color = { fg = "black", bg = "#f46868" },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
get_active_lsp,
|
get_active_lsp,
|
||||||
icon = " LSP:",
|
icon = " LSP:",
|
||||||
|
|||||||
@ -4,7 +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" }
|
match_mappings = { "zh_sc" },
|
||||||
}
|
}
|
||||||
|
|
||||||
keymap.set({ "n", "v", "o" }, "f", "", {
|
keymap.set({ "n", "v", "o" }, "f", "", {
|
||||||
@ -24,5 +24,5 @@ vim.api.nvim_create_autocmd("ColorScheme", {
|
|||||||
hi HopNextKey1 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff
|
hi HopNextKey1 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff
|
||||||
hi HopNextKey2 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff
|
hi HopNextKey2 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff
|
||||||
]])
|
]])
|
||||||
end
|
end,
|
||||||
})
|
})
|
||||||
|
|||||||
@ -3,6 +3,6 @@ require("nvim-treesitter.configs").setup {
|
|||||||
ignore_install = {}, -- List of parsers to ignore installing
|
ignore_install = {}, -- List of parsers to ignore installing
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true, -- false will disable the whole extension
|
enable = true, -- false will disable the whole extension
|
||||||
disable = { 'help' }, -- list of language that will be disabled
|
disable = { "help" }, -- list of language that will be disabled
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
require("which-key").setup {
|
require("which-key").setup {
|
||||||
preset = "modern",
|
preset = "modern",
|
||||||
icons = {
|
icons = {
|
||||||
mappings = false
|
mappings = false,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -165,8 +165,9 @@ api.nvim_create_autocmd("FileType", {
|
|||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
local status, result = pcall(api.nvim_win_set_cursor, 0, mark_pos)
|
local status, result = pcall(api.nvim_win_set_cursor, 0, mark_pos)
|
||||||
if not status then
|
if not status then
|
||||||
api.nvim_err_writeln(string.format("Failed to resume cursor position. Context %s, error: %s",
|
api.nvim_err_writeln(
|
||||||
vim.inspect(ev), result))
|
string.format("Failed to resume cursor position. Context %s, error: %s", vim.inspect(ev), result)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
-- the following two ways also seem to work,
|
-- the following two ways also seem to work,
|
||||||
@ -204,20 +205,18 @@ api.nvim_create_autocmd("ColorScheme", {
|
|||||||
pattern = "*",
|
pattern = "*",
|
||||||
desc = "Define or overrride some highlight groups",
|
desc = "Define or overrride some highlight groups",
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.cmd([[
|
-- For yank highlight
|
||||||
" For yank highlight
|
vim.api.nvim_set_hl(0, "YankColor", { fg = "#34495E", bg = "#2ECC71", ctermfg = 59, ctermbg = 41 })
|
||||||
highlight YankColor ctermfg=59 ctermbg=41 guifg=#34495E guibg=#2ECC71
|
|
||||||
|
|
||||||
" For cursor colors
|
-- For cursor colors
|
||||||
highlight Cursor cterm=bold gui=bold guibg=#00c918 guifg=black
|
vim.api.nvim_set_hl(0, "Cursor", { fg = "black", bg = "#00c918", bold = true })
|
||||||
highlight Cursor2 guifg=red guibg=red
|
vim.api.nvim_set_hl(0, "Cursor2", { fg = "red", bg = "red" })
|
||||||
|
|
||||||
" For floating windows border highlight
|
-- For floating windows border highlight
|
||||||
highlight FloatBorder guifg=LightGreen guibg=NONE
|
vim.api.nvim_set_hl(0, "FloatBorder", { fg = "LightGreen" })
|
||||||
|
|
||||||
" highlight for matching parentheses
|
-- highlight for matching parentheses
|
||||||
highlight MatchParen cterm=bold,underline gui=bold,underline
|
vim.api.nvim_set_hl(0, "MatchParen", { bold = true, underline = true })
|
||||||
]])
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -226,14 +225,14 @@ api.nvim_create_autocmd("BufEnter", {
|
|||||||
group = api.nvim_create_augroup("auto_close_win", { clear = true }),
|
group = api.nvim_create_augroup("auto_close_win", { clear = true }),
|
||||||
desc = "Quit Nvim if we have only one window, and its filetype match our pattern",
|
desc = "Quit Nvim if we have only one window, and its filetype match our pattern",
|
||||||
callback = function(ev)
|
callback = function(ev)
|
||||||
local quit_filetypes = {'qf', 'vista', 'NvimTree'}
|
local quit_filetypes = { "qf", "vista", "NvimTree" }
|
||||||
|
|
||||||
local should_quit = true
|
local should_quit = true
|
||||||
local tabwins = api.nvim_tabpage_list_wins(0)
|
local tabwins = api.nvim_tabpage_list_wins(0)
|
||||||
|
|
||||||
for _, win in pairs(tabwins) do
|
for _, win in pairs(tabwins) do
|
||||||
local buf = api.nvim_win_get_buf(win)
|
local buf = api.nvim_win_get_buf(win)
|
||||||
local bf = fn.getbufvar(buf, '&filetype')
|
local bf = fn.getbufvar(buf, "&filetype")
|
||||||
|
|
||||||
if fn.index(quit_filetypes, bf) == -1 then
|
if fn.index(quit_filetypes, bf) == -1 then
|
||||||
should_quit = false
|
should_quit = false
|
||||||
@ -243,14 +242,14 @@ api.nvim_create_autocmd("BufEnter", {
|
|||||||
if should_quit then
|
if should_quit then
|
||||||
vim.cmd("qall")
|
vim.cmd("qall")
|
||||||
end
|
end
|
||||||
end
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
api.nvim_create_autocmd({ "VimEnter", "DirChanged" }, {
|
api.nvim_create_autocmd({ "VimEnter", "DirChanged" }, {
|
||||||
group = api.nvim_create_augroup("git_repo_check", { clear = true }),
|
group = api.nvim_create_augroup("git_repo_check", { clear = true }),
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
desc = "check if we are inside Git repo",
|
desc = "check if we are inside Git repo",
|
||||||
command = "call utils#Inside_git_repo()"
|
command = "call utils#Inside_git_repo()",
|
||||||
})
|
})
|
||||||
|
|
||||||
-- ref: https://vi.stackexchange.com/a/169/15292
|
-- ref: https://vi.stackexchange.com/a/169/15292
|
||||||
@ -271,5 +270,5 @@ api.nvim_create_autocmd("BufReadPre", {
|
|||||||
vim.bo.bufhidden = "unload"
|
vim.bo.bufhidden = "unload"
|
||||||
vim.bo.undolevels = -1
|
vim.bo.undolevels = -1
|
||||||
end
|
end
|
||||||
end
|
end,
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
local fn = vim.fn
|
local fn = vim.fn
|
||||||
local api = vim.api
|
local api = vim.api
|
||||||
|
|
||||||
local utils = require('utils')
|
local utils = require("utils")
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
-- custom variables --
|
-- custom variables --
|
||||||
@ -20,9 +20,9 @@ vim.g.loaded_ruby_provider = 0 -- Disable ruby provider
|
|||||||
vim.g.loaded_node_provider = 0 -- Disable node provider
|
vim.g.loaded_node_provider = 0 -- Disable node provider
|
||||||
vim.g.did_install_default_menus = 1 -- do not load menu
|
vim.g.did_install_default_menus = 1 -- do not load menu
|
||||||
|
|
||||||
if utils.executable('python3') then
|
if utils.executable("python3") then
|
||||||
if vim.g.is_win then
|
if vim.g.is_win then
|
||||||
vim.g.python3_host_prog = fn.substitute(fn.exepath("python3"), ".exe$", '', 'g')
|
vim.g.python3_host_prog = fn.substitute(fn.exepath("python3"), ".exe$", "", "g")
|
||||||
else
|
else
|
||||||
vim.g.python3_host_prog = fn.exepath("python3")
|
vim.g.python3_host_prog = fn.exepath("python3")
|
||||||
end
|
end
|
||||||
@ -32,13 +32,13 @@ else
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Custom mapping <leader> (see `:h mapleader` for more info)
|
-- Custom mapping <leader> (see `:h mapleader` for more info)
|
||||||
vim.g.mapleader = ','
|
vim.g.mapleader = ","
|
||||||
|
|
||||||
-- Enable highlighting for lua HERE doc inside vim script
|
-- Enable highlighting for lua HERE doc inside vim script
|
||||||
vim.g.vimsyn_embed = 'l'
|
vim.g.vimsyn_embed = "l"
|
||||||
|
|
||||||
-- Use English as main language
|
-- Use English as main language
|
||||||
vim.cmd [[language en_US.UTF-8]]
|
vim.cmd([[language en_US.UTF-8]])
|
||||||
|
|
||||||
-- Disable loading certain plugins
|
-- Disable loading certain plugins
|
||||||
|
|
||||||
|
|||||||
@ -542,7 +542,6 @@ local plugin_specs = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"CopilotC-Nvim/CopilotChat.nvim",
|
"CopilotC-Nvim/CopilotChat.nvim",
|
||||||
branch = "canary",
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{ "zbirenbaum/copilot.lua" }, -- or github/copilot.vim
|
{ "zbirenbaum/copilot.lua" }, -- or github/copilot.vim
|
||||||
{ "nvim-lua/plenary.nvim" }, -- for curl, log wrapper
|
{ "nvim-lua/plenary.nvim" }, -- for curl, log wrapper
|
||||||
@ -578,6 +577,17 @@ local plugin_specs = {
|
|||||||
require("nvim-lightbulb").setup { autocmd = { enabled = true } }
|
require("nvim-lightbulb").setup { autocmd = { enabled = true } }
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Bekaboo/dropbar.nvim",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"vhyrro/luarocks.nvim",
|
||||||
|
priority = 1000, -- Very high priority is required, luarocks.nvim should run as the first plugin in your config.
|
||||||
|
opts = {
|
||||||
|
rocks = { "lua-toml" }, -- specifies a list of rocks to install
|
||||||
|
-- luarocks_build_args = { "--with-lua=/my/path" }, -- extra options to pass to luarocks's configuration script
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
require("lazy").setup {
|
require("lazy").setup {
|
||||||
@ -589,5 +599,6 @@ require("lazy").setup {
|
|||||||
},
|
},
|
||||||
rocks = {
|
rocks = {
|
||||||
enabled = false,
|
enabled = false,
|
||||||
|
hererocks = false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -470,3 +470,9 @@ qpdf
|
|||||||
Elasticsearch
|
Elasticsearch
|
||||||
kibana
|
kibana
|
||||||
submodule
|
submodule
|
||||||
|
unix
|
||||||
|
GCP
|
||||||
|
Kubernetes
|
||||||
|
pubsub
|
||||||
|
Luarocks
|
||||||
|
luarocks
|
||||||
|
|||||||
@ -179,3 +179,5 @@ set diffopt+=linematch:60
|
|||||||
|
|
||||||
set nowrap " do no wrap
|
set nowrap " do no wrap
|
||||||
set noruler
|
set noruler
|
||||||
|
|
||||||
|
set showcmdloc=statusline
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user