(nvim) update in progress
This commit is contained in:
parent
9844c832ba
commit
3b376950c8
37 changed files with 1214 additions and 1261 deletions
2
nvim/after/ftplugin/go.lua
Normal file
2
nvim/after/ftplugin/go.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
-- quick way to handle errors in Go
|
||||
vim.keymap.set("n", "<leader>ee", "oif err != nil {<CR>}<ESC>Oreturn err<ESC>")
|
||||
|
|
@ -1,17 +1,18 @@
|
|||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
local Utils = require("juancwu.utils")
|
||||
require("juancwu.config").setup({
|
||||
colorscheme = Utils.colors.get_timebased_colorscheme(),
|
||||
})
|
||||
require("juancwu.config").setup({})
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||
"LuaSnip": { "branch": "master", "commit": "21f74f7ba8c49f95f9d7c8293b147c2901dd2d3a" },
|
||||
"blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" },
|
||||
"catppuccin": { "branch": "main", "commit": "30fa4d122d9b22ad8b2e0ab1b533c8c26c4dde86" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
|
||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"conform.nvim": { "branch": "master", "commit": "b4aab989db276993ea5dcb78872be494ce546521" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "4d5858bd4c471c895060e1b9f3575f1551184dc5" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" },
|
||||
"godoc.nvim": { "branch": "main", "commit": "356f79853dbb3b3e200064367603751895153c29" },
|
||||
"harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
|
||||
"kanagawa.nvim": { "branch": "master", "commit": "debe91547d7fb1eef34ce26a5106f277fbfdd109" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local M = {}
|
|||
---@class ConfigOptions
|
||||
local defaultOpts = {
|
||||
---@type string | fun()
|
||||
colorscheme = "rose-pine",
|
||||
colorscheme = "catppuccin",
|
||||
}
|
||||
|
||||
vim.g.disable_autoformat = false
|
||||
|
|
@ -58,13 +58,6 @@ function M.setup(opts)
|
|||
vim.api.nvim_create_user_command("FormatEnable", function(args)
|
||||
vim.g.disable_autoformat = false
|
||||
end, { desc = "Enable Autoformat" })
|
||||
|
||||
-- create command to toggle colorscheme
|
||||
vim.api.nvim_create_user_command(
|
||||
"ToggleColors",
|
||||
require("juancwu.utils.colors").toggle_colors,
|
||||
{ desc = "Toggle colorscheme" }
|
||||
)
|
||||
end
|
||||
|
||||
setmetatable(M, {
|
||||
|
|
|
|||
|
|
@ -21,19 +21,16 @@ vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
|||
vim.keymap.set("n", "n", "nzzzv")
|
||||
vim.keymap.set("n", "N", "Nzzzv")
|
||||
|
||||
-- keymap below needs a better combo, need this to enable macros
|
||||
-- vim.keymap.set("n", "<leader>q", "q", { noremap = true })
|
||||
|
||||
-- select and replace
|
||||
vim.keymap.set("n", "<leader>ss", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||
|
||||
-- do not copy with x, for god sake, WHY copy something that is being deleted??
|
||||
vim.keymap.set("n", "x", '"_x')
|
||||
vim.keymap.set("n", "x", '"xx')
|
||||
|
||||
-- no copy, delete line, for god sake...
|
||||
vim.keymap.set("n", "dd", '"_dd')
|
||||
vim.keymap.set("n", "dd", '"ddd')
|
||||
vim.keymap.set("n", "dx", "dd") -- cut line, under my control
|
||||
vim.keymap.set("v", "d", '"_d')
|
||||
vim.keymap.set("v", "d", '"dd')
|
||||
|
||||
-- copy/paste to/from system clipboard
|
||||
vim.keymap.set({ "n", "v" }, "<leader>y", '"+y')
|
||||
|
|
@ -48,6 +45,7 @@ vim.keymap.set("n", "dw", '"_dw')
|
|||
vim.keymap.set("n", "db", 'vb"_d') -- delete in backwards
|
||||
|
||||
vim.keymap.set("n", "<C-a>", "gg<S-v>G") -- select all
|
||||
|
||||
-- split pane
|
||||
vim.keymap.set("n", "ss", ":split<Return><C-w>w", { silent = true }) -- horizontal
|
||||
vim.keymap.set("n", "sv", ":vsplit<Return><C-w>w", { silent = true }) -- vertical
|
||||
|
|
@ -60,19 +58,10 @@ vim.keymap.set("n", "sl", "<C-w>l")
|
|||
vim.keymap.set("n", "sj", "<C-w>j")
|
||||
|
||||
-- resize pane
|
||||
vim.keymap.set("n", "<C-w><left>", "<C-w><")
|
||||
vim.keymap.set("n", "<C-w><right>", "<C-w>>")
|
||||
vim.keymap.set("n", "<C-w><up>", "<C-w>+")
|
||||
vim.keymap.set("n", "<C-w><down>", "<C-w>-")
|
||||
|
||||
-- my arrow keys babyyyy
|
||||
vim.keymap.set("i", "<C-h>", "<Left>", { noremap = true })
|
||||
vim.keymap.set("i", "<C-j>", "<Down>", { noremap = true })
|
||||
vim.keymap.set("i", "<C-k>", "<Up>", { noremap = true })
|
||||
vim.keymap.set("i", "<C-l>", "<Right>", { noremap = true })
|
||||
vim.keymap.set("n", "<C-w><left>", "<C-w>5>")
|
||||
vim.keymap.set("n", "<C-w><right>", "<C-w>5<")
|
||||
vim.keymap.set("n", "<C-w><up>", "<C-w>5+")
|
||||
vim.keymap.set("n", "<C-w><down>", "<C-w>5-")
|
||||
|
||||
-- lazygit on floaterm
|
||||
vim.keymap.set("n", "<leader>g", "<cmd>FloatermNew lazygit<CR>", { noremap = true })
|
||||
|
||||
-- quick way to handle errors in Go
|
||||
vim.keymap.set("n", "<leader>ee", "oif err != nil {<CR>}<ESC>Oreturn err<ESC>")
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ vim.opt.ignorecase = true -- case-insensitive search
|
|||
vim.opt.backspace = { "start", "eol", "indent" }
|
||||
|
||||
-- don't want to look into these...
|
||||
vim.opt.wildignore:append({ "*/node_modules/*", "*/__pycache__/*" })
|
||||
vim.opt.wildignore:append({ "*/node_modules/*", "*/__pycache__/*", "*/vendor/*" })
|
||||
|
||||
-- add '*' in block comments
|
||||
vim.opt.formatoptions:append({ "r" })
|
||||
|
|
|
|||
|
|
@ -1,93 +1,148 @@
|
|||
return { -- Autocompletion
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
-- Snippet Engine & its associated nvim-cmp source
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
build = (function()
|
||||
-- Build Step is needed for regex support in snippets.
|
||||
-- This step is not supported in many windows environments.
|
||||
-- Remove the below condition to re-enable on windows.
|
||||
if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then
|
||||
return
|
||||
end
|
||||
return "make install_jsregexp"
|
||||
end)(),
|
||||
dependencies = {
|
||||
{
|
||||
"rafamadriz/friendly-snippets",
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-path",
|
||||
},
|
||||
config = function()
|
||||
-- See `:help cmp`
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
luasnip.config.setup({})
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
completion = { completeopt = "menu,menuone,noinsert" },
|
||||
|
||||
-- For an understanding of why these mappings were
|
||||
-- chosen, you will need to read `:help ins-completion`
|
||||
-- return { -- Autocompletion
|
||||
-- "hrsh7th/nvim-cmp",
|
||||
-- event = "InsertEnter",
|
||||
-- dependencies = {
|
||||
-- -- Snippet Engine & its associated nvim-cmp source
|
||||
-- {
|
||||
-- "L3MON4D3/LuaSnip",
|
||||
-- build = (function()
|
||||
-- -- Build Step is needed for regex support in snippets.
|
||||
-- -- This step is not supported in many windows environments.
|
||||
-- -- Remove the below condition to re-enable on windows.
|
||||
-- if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then
|
||||
-- return
|
||||
-- end
|
||||
-- return "make install_jsregexp"
|
||||
-- end)(),
|
||||
-- dependencies = {
|
||||
-- {
|
||||
-- "rafamadriz/friendly-snippets",
|
||||
-- config = function()
|
||||
-- require("luasnip.loaders.from_vscode").lazy_load()
|
||||
-- end,
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- "saadparwaiz1/cmp_luasnip",
|
||||
-- "hrsh7th/cmp-nvim-lsp",
|
||||
-- "hrsh7th/cmp-path",
|
||||
-- },
|
||||
-- config = function()
|
||||
-- -- See `:help cmp`
|
||||
-- local cmp = require("cmp")
|
||||
-- local luasnip = require("luasnip")
|
||||
-- luasnip.config.setup({})
|
||||
--
|
||||
-- cmp.setup({
|
||||
-- snippet = {
|
||||
-- expand = function(args)
|
||||
-- luasnip.lsp_expand(args.body)
|
||||
-- end,
|
||||
-- },
|
||||
-- completion = { completeopt = "menu,menuone,noinsert" },
|
||||
--
|
||||
-- -- For an understanding of why these mappings were
|
||||
-- -- chosen, you will need to read `:help ins-completion`
|
||||
-- --
|
||||
-- -- No, but seriously. Please read `:help ins-completion`, it is really good!
|
||||
-- mapping = cmp.mapping.preset.insert({
|
||||
-- -- Select the [n]ext item
|
||||
-- ["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
-- -- Select the [p]revious item
|
||||
-- ["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
--
|
||||
-- -- Scroll the documentation window [b]ack / [f]orward
|
||||
-- ["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
-- ["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
--
|
||||
-- -- Accept ([y]es) the completion.
|
||||
-- -- This will auto-import if your LSP supports it.
|
||||
-- -- This will expand snippets if the LSP sent a snippet.
|
||||
-- ["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
--
|
||||
-- -- Manually trigger a completion from nvim-cmp.
|
||||
-- -- Generally you don't need this, because nvim-cmp will display
|
||||
-- -- completions whenever it has completion options available.
|
||||
-- ["<C-Space>"] = cmp.mapping.complete({}),
|
||||
--
|
||||
-- -- <c-l> will move you to the right of each of the expansion locations.
|
||||
-- -- <c-h> is similar, except moving you backwards.
|
||||
-- ["<C-l>"] = cmp.mapping(function()
|
||||
-- if luasnip.expand_or_locally_jumpable() then
|
||||
-- luasnip.expand_or_jump()
|
||||
-- end
|
||||
-- end, { "i", "s" }),
|
||||
-- ["<C-h>"] = cmp.mapping(function()
|
||||
-- if luasnip.locally_jumpable(-1) then
|
||||
-- luasnip.jump(-1)
|
||||
-- end
|
||||
-- end, { "i", "s" }),
|
||||
-- }),
|
||||
-- sources = {
|
||||
-- {
|
||||
-- name = "lazydev",
|
||||
-- -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
|
||||
-- group_index = 0,
|
||||
-- },
|
||||
-- { name = "nvim_lsp" },
|
||||
-- { name = "luasnip" },
|
||||
-- { name = "path" },
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
-- }
|
||||
--
|
||||
-- No, but seriously. Please read `:help ins-completion`, it is really good!
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
-- Select the [n]ext item
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
-- Select the [p]revious item
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
|
||||
-- Scroll the documentation window [b]ack / [f]orward
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
return {
|
||||
"saghen/blink.cmp",
|
||||
-- optional: provides snippets for the snippet source
|
||||
dependencies = { "rafamadriz/friendly-snippets" },
|
||||
|
||||
-- Accept ([y]es) the completion.
|
||||
-- This will auto-import if your LSP supports it.
|
||||
-- This will expand snippets if the LSP sent a snippet.
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
-- use a release tag to download pre-built binaries
|
||||
version = "1.*",
|
||||
-- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
|
||||
-- build = 'cargo build --release',
|
||||
-- If you use nix, you can build from source using latest nightly rust with:
|
||||
-- build = 'nix run .#build-plugin',
|
||||
|
||||
-- Manually trigger a completion from nvim-cmp.
|
||||
-- Generally you don't need this, because nvim-cmp will display
|
||||
-- completions whenever it has completion options available.
|
||||
["<C-Space>"] = cmp.mapping.complete({}),
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
opts = {
|
||||
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
|
||||
-- 'super-tab' for mappings similar to vscode (tab to accept)
|
||||
-- 'enter' for enter to accept
|
||||
-- 'none' for no mappings
|
||||
--
|
||||
-- All presets have the following mappings:
|
||||
-- C-space: Open menu or open docs if already open
|
||||
-- C-n/C-p or Up/Down: Select next/previous item
|
||||
-- C-e: Hide menu
|
||||
-- C-k: Toggle signature help (if signature.enabled = true)
|
||||
--
|
||||
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||
keymap = { preset = "default" },
|
||||
|
||||
-- <c-l> will move you to the right of each of the expansion locations.
|
||||
-- <c-h> is similar, except moving you backwards.
|
||||
["<C-l>"] = cmp.mapping(function()
|
||||
if luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<C-h>"] = cmp.mapping(function()
|
||||
if luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
appearance = {
|
||||
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||
-- Adjusts spacing to ensure icons are aligned
|
||||
nerd_font_variant = "mono",
|
||||
},
|
||||
|
||||
-- (Default) Only show the documentation popup when manually triggered
|
||||
completion = { documentation = { auto_show = false } },
|
||||
|
||||
-- Default list of enabled providers defined so that you can extend it
|
||||
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
||||
sources = {
|
||||
{
|
||||
name = "lazydev",
|
||||
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
|
||||
group_index = 0,
|
||||
default = { "lsp", "path", "snippets", "buffer" },
|
||||
},
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "path" },
|
||||
|
||||
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
|
||||
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
|
||||
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
|
||||
--
|
||||
-- See the fuzzy documentation for more information
|
||||
fuzzy = { implementation = "prefer_rust_with_warning" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
opts_extend = { "sources.default" },
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ return {
|
|||
priority = 1000,
|
||||
opts = {
|
||||
flavour = "mocha",
|
||||
integrations = { blink_cmp = true },
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
return {
|
||||
"fredrikaverpil/godoc.nvim",
|
||||
version = "*",
|
||||
dependencies = {
|
||||
{ "nvim-telescope/telescope.nvim" },
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = { "go" },
|
||||
},
|
||||
},
|
||||
},
|
||||
build = "go install github.com/lotusirous/gostdsym/stdsym@latest", -- optional
|
||||
cmd = { "GoDoc" }, -- optional
|
||||
opts = {
|
||||
picker = {
|
||||
type = "telescope",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
return {
|
||||
"ThePrimeagen/harpoon",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
local mark = require("harpoon.mark")
|
||||
local ui = require("harpoon.ui")
|
||||
|
||||
vim.keymap.set("n", "<leader>a", mark.add_file)
|
||||
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
|
||||
|
||||
vim.keymap.set("n", "<leader>q", function()
|
||||
ui.nav_file(1)
|
||||
end)
|
||||
vim.keymap.set("n", "<leader>w", function()
|
||||
ui.nav_file(2)
|
||||
end)
|
||||
vim.keymap.set("n", "<leader>e", function()
|
||||
ui.nav_file(3)
|
||||
end)
|
||||
vim.keymap.set("n", "<leader>r", function()
|
||||
ui.nav_file(4)
|
||||
end)
|
||||
vim.keymap.set("n", "<leader>,", ui.nav_prev)
|
||||
vim.keymap.set("n", "<leader>.", ui.nav_next)
|
||||
end,
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
---@class juancwu.utils.colors
|
||||
local M = {}
|
||||
local light = "catppuccin-latte"
|
||||
local dark = "catppuccin-mocha"
|
||||
|
||||
---@return boolean
|
||||
function M.is_daytime()
|
||||
return false
|
||||
end
|
||||
|
||||
---@return boolean
|
||||
function M.legacy_is_daytime()
|
||||
return false
|
||||
end
|
||||
|
||||
---@return string
|
||||
function M.get_timebased_colorscheme()
|
||||
if M.is_daytime() then
|
||||
vim.g.is_light_colors = true
|
||||
return light
|
||||
else
|
||||
vim.g.is_light_colors = false
|
||||
return dark
|
||||
end
|
||||
end
|
||||
|
||||
function M.toggle_colors()
|
||||
if vim.g.is_light_colors then
|
||||
vim.g.is_light_colors = false
|
||||
vim.cmd.colorscheme(dark)
|
||||
else
|
||||
vim.g.is_light_colors = true
|
||||
vim.cmd.colorscheme(light)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
---@class Utils
|
||||
---@field os juancwu.utils.os
|
||||
---@field colors juancwu.utils.colors
|
||||
local M = setmetatable({}, {
|
||||
__index = function(t, k)
|
||||
t[k] = require("juancwu.utils." .. k)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
indent_width = 4
|
||||
column_width = 120
|
||||
Loading…
Add table
Add a link
Reference in a new issue