commit
fbff47ef67
44 changed files with 503 additions and 264 deletions
|
|
@ -11,25 +11,8 @@ if not vim.loop.fs_stat(lazypath) then
|
|||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
local has = vim.fn.has
|
||||
local is_mac = has "macunix"
|
||||
local is_wsl = has "wsl"
|
||||
local is_unix = has "unix"
|
||||
|
||||
-- custom modules:
|
||||
require("keymaps")
|
||||
require("options")
|
||||
|
||||
if is_wsl == 1 then
|
||||
require("clipboard-wsl")
|
||||
end
|
||||
|
||||
if is_mac == 1 then
|
||||
require("clipboard-macos")
|
||||
end
|
||||
|
||||
if is_unix == 1 and is_mac ~= 1 then
|
||||
require("clipboard-unix")
|
||||
end
|
||||
|
||||
require("lazy").setup("plugins")
|
||||
require("juancwu.config").setup({
|
||||
colorscheme = function()
|
||||
require("tokyonight").load()
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
||||
"LuaSnip": { "branch": "master", "commit": "57c9f5c31b3d712376c704673eac8e948c82e9c1" },
|
||||
"catppuccin": { "branch": "main", "commit": "079500a625f3ae5aa6efb758f1a17fe4c7a57e52" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
||||
"fzf": { "branch": "master", "commit": "d21d5c9510170d74a7f959309da720b6df72ca01" },
|
||||
"fzf-lua": { "branch": "main", "commit": "a1a2d0f42eaec400cc6918a8e898fc1f9c4dbc5f" },
|
||||
|
|
@ -14,6 +15,7 @@
|
|||
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "9453e3d6cd2ca45d96e20f343e8f1b927364b630" },
|
||||
"mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "be6bf4f5d2d3b173c9291f074130a3d29e1af78a" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
|
||||
|
|
@ -25,13 +27,16 @@
|
|||
"nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1277b4a1f451b0f18c0790e1a7f12e1e5fdebfee" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "a1425903ab52a0a0460622519e827f224e5b4fee" },
|
||||
"onedark.nvim": { "branch": "master", "commit": "c5476a091b0f1b4e853db91c91ff941f848a1cdd" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
|
||||
"rose-pine": { "branch": "main", "commit": "92762f4fa2144c05db760ea254f4c399a56a7ef5" },
|
||||
"solarized-osaka.nvim": { "branch": "main", "commit": "83b7026ac7a4e185d4ecbe99926fd94b5735e2ea" },
|
||||
"telescope-dap.nvim": { "branch": "master", "commit": "4e2d5efb92062f0b865fe59b200b5ed7793833bf" },
|
||||
"telescope-file-browser.nvim": { "branch": "master", "commit": "98101b22402cd6d1c7e9a7e0c4718bfc98cb1625" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "6213322ab56eb27356fdc09a5078e41e3ea7f3bc" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "f247ee700b569ed43f39320413a13ba9b0aef0db" },
|
||||
"undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" },
|
||||
"vim-closetag": { "branch": "master", "commit": "d0a562f8bdb107a50595aefe53b1a690460c3822" },
|
||||
"vim-floaterm": { "branch": "master", "commit": "3f01a623376957437f9376327637491b74719e38" },
|
||||
|
|
|
|||
77
nvim/lua/.luarc.json
Normal file
77
nvim/lua/.luarc.json
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
{
|
||||
"workspace.library": [
|
||||
"/home/jc/.local/share/nvim/lazy/neodev.nvim/types/stable",
|
||||
"/home/jc/Applications/nvim-linux64/share/nvim/runtime/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/neodev.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/telescope.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/telescope-fzf-native.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/which-key.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/gitsigns.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/lsp-zero.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-dap-ui/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/todo-comments.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-lspconfig/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/lazy.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/mason.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/fzf-lua/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-treesitter-textobjects/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/mason-lspconfig.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/telescope-dap.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-web-devicons/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/telescope-file-browser.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-cmp/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/lualine.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-treesitter/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-ts-autotag/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-ts-context-commentstring/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/git.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-autopairs/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/Comment.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/rose-pine/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/indent-blankline.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/harpoon/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/LuaSnip/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-dap/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/cmp-nvim-lsp/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/plenary.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/null-ls.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/neodev.nvim/types/stable",
|
||||
"/home/jc/Applications/nvim-linux64/share/nvim/runtime/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/neodev.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/telescope.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/telescope-fzf-native.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/which-key.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/gitsigns.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/lsp-zero.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-dap-ui/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/todo-comments.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-lspconfig/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/lazy.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/mason.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/fzf-lua/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-treesitter-textobjects/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/mason-lspconfig.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/telescope-dap.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-web-devicons/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/telescope-file-browser.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-cmp/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/lualine.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-treesitter/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-ts-autotag/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-ts-context-commentstring/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/git.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-autopairs/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/Comment.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/rose-pine/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/indent-blankline.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/harpoon/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/LuaSnip/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/nvim-dap/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/cmp-nvim-lsp/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/plenary.nvim/lua",
|
||||
"/home/jc/.local/share/nvim/lazy/null-ls.nvim/lua",
|
||||
"/home/jc/ghq/juancwu/dotfiles/nvim/lua",
|
||||
"/home/jc/ghq/juancwu/dotfiles/nvim/lua",
|
||||
"${3rd}/luv/library"
|
||||
]
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
vim.opt.clipboard:append { "unnamedplus" }
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
-- vim.opt.clipboard:append { "unnamedplus" }
|
||||
|
||||
vim.g.clipboard = {
|
||||
name = "xclip",
|
||||
copy = {
|
||||
['+'] = "xclip -sel clip -i -quiet",
|
||||
['*'] = "xclip -sel primary -i -quiet",
|
||||
},
|
||||
paste = {
|
||||
['+'] = "xclip -sel clip -o -quiet",
|
||||
['*'] = "xclip -sel primary -o -quiet",
|
||||
},
|
||||
cache_enabled = 1,
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
vim.g.clipboard = {
|
||||
name = "win32yank",
|
||||
copy = {
|
||||
['+'] = "win32yank.exe -i --crlf",
|
||||
['*'] = "win32yank.exe -i --crlf",
|
||||
},
|
||||
paste = {
|
||||
['+'] = "win32yank.exe -o --lf",
|
||||
['*'] = "win32yank.exe -o --lf",
|
||||
},
|
||||
cache_enabled = 0,
|
||||
}
|
||||
31
nvim/lua/juancwu/config/clipboard.lua
Normal file
31
nvim/lua/juancwu/config/clipboard.lua
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
local Utils = require("juancwu.utils")
|
||||
|
||||
if Utils.os.is_linux() then
|
||||
vim.g.clipboard = {
|
||||
name = "xclip",
|
||||
copy = {
|
||||
['+'] = "xclip -sel clip -i -quiet",
|
||||
['*'] = "xclip -sel primary -i -quiet",
|
||||
},
|
||||
paste = {
|
||||
['+'] = "xclip -sel clip -o -quiet",
|
||||
['*'] = "xclip -sel primary -o -quiet",
|
||||
},
|
||||
cache_enabled = 1,
|
||||
}
|
||||
elseif Utils.os.is_mac() then
|
||||
vim.opt.clipboard:append { "unnamedplus" }
|
||||
elseif Utils.os.is_wsl() then
|
||||
vim.g.clipboard = {
|
||||
name = "win32yank",
|
||||
copy = {
|
||||
['+'] = "win32yank.exe -i --crlf",
|
||||
['*'] = "win32yank.exe -i --crlf",
|
||||
},
|
||||
paste = {
|
||||
['+'] = "win32yank.exe -o --lf",
|
||||
['*'] = "win32yank.exe -o --lf",
|
||||
},
|
||||
cache_enabled = 0,
|
||||
}
|
||||
end
|
||||
73
nvim/lua/juancwu/config/init.lua
Normal file
73
nvim/lua/juancwu/config/init.lua
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
---@class Config: ConfigOptions
|
||||
local M = {}
|
||||
|
||||
---@class ConfigOptions
|
||||
local defaultOpts = {
|
||||
---@type string | fun()
|
||||
colorscheme = "rose-pine",
|
||||
}
|
||||
|
||||
vim.g.disable_autoformat = false
|
||||
|
||||
---@param name "options" | "keymaps" | "clipboard"
|
||||
function M.load(name)
|
||||
local mod = "juancwu.config." .. name
|
||||
local error_handler = function(err)
|
||||
local msg = "Failed loading " .. mod .. "\n\n" .. err
|
||||
print(msg)
|
||||
end
|
||||
xpcall(function()
|
||||
require(mod)
|
||||
end, error_handler)
|
||||
end
|
||||
|
||||
---@type ConfigOptions
|
||||
local options
|
||||
|
||||
---@param opts? ConfigOptions
|
||||
function M.setup(opts)
|
||||
options = vim.tbl_deep_extend("force", defaultOpts, opts or {}) or {}
|
||||
|
||||
M.load("options")
|
||||
M.load("keymaps")
|
||||
M.load("clipboard")
|
||||
|
||||
require("lazy").setup("juancwu.plugins")
|
||||
|
||||
-- try to load colorscheme
|
||||
xpcall(function()
|
||||
if type(M.colorscheme) == "function" then
|
||||
M.colorscheme()
|
||||
else
|
||||
vim.cmd.colorscheme(M.colorscheme)
|
||||
end
|
||||
end, function(err)
|
||||
if type(M.colorscheme) == "string" then
|
||||
local msg = "Failed to load colorscheme " .. M.colorscheme .. "\n\n" .. err
|
||||
print(msg)
|
||||
else
|
||||
print("Failed to load colorscheme\n\n" .. err)
|
||||
end
|
||||
vim.cmd.colorscheme("rose-pine")
|
||||
end)
|
||||
|
||||
-- create command to disable autoformat
|
||||
vim.api.nvim_create_user_command("FormatDisable", function(args)
|
||||
vim.g.disable_autoformat = true
|
||||
end, { desc = "Disable Autoformat" })
|
||||
vim.api.nvim_create_user_command("FormatEnable", function(args)
|
||||
vim.g.disable_autoformat = false
|
||||
end, { desc = "Enable Autoformat" })
|
||||
end
|
||||
|
||||
setmetatable(M, {
|
||||
__index = function(_, k)
|
||||
if options == nil then
|
||||
return vim.deepcopy(defaultOpts)[k]
|
||||
end
|
||||
|
||||
return options[k]
|
||||
end,
|
||||
})
|
||||
|
||||
return M
|
||||
|
|
@ -1,18 +1,10 @@
|
|||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
-- easy escape
|
||||
vim.keymap.set("i", "<C-[>", "<Esc>", { noremap = true, silent = true })
|
||||
vim.keymap.set("v", "<C-[>", "<Esc>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<C-[>", "<Esc>", { noremap = true, silent = true })
|
||||
|
||||
-- easy escape
|
||||
vim.keymap.set("i", "<C-[>", "<Esc>", { noremap = true, silent = true })
|
||||
vim.keymap.set("v", "<C-[>", "<Esc>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<C-[>", "<Esc>", { noremap = true, silent = true })
|
||||
|
||||
-- open the explorer
|
||||
vim.keymap.set("n", "<leader>x", "<cmd>Ex<CR>")
|
||||
vim.keymap.set("n", "<leader>ex", "<cmd>Ex<CR>")
|
||||
|
||||
-- move highlighted lines
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
|
|
@ -29,10 +21,7 @@ vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
|||
vim.keymap.set("n", "n", "nzzzv")
|
||||
vim.keymap.set("n", "N", "Nzzzv")
|
||||
|
||||
-- do not copy with x, for god sake, WHY copy something that is being deleted??
|
||||
vim.keymap.set("n", "x", "\"_x")
|
||||
|
||||
-- smile :)
|
||||
-- gotta learn how to use macros...
|
||||
vim.keymap.set("n", "Q", "<nop>")
|
||||
vim.keymap.set("n", "q", "<nop>", { noremap = true })
|
||||
-- keymap below needs a better combo, need this to enable macros
|
||||
|
|
@ -41,17 +30,17 @@ vim.keymap.set("n", "q", "<nop>", { 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")
|
||||
|
||||
-- no copy, delete line, for god sake...
|
||||
vim.keymap.set("n", "dd", "\"_dd")
|
||||
vim.keymap.set("n", "<leader>dd", "dd") -- cut line, under my control
|
||||
vim.keymap.set("x", "d", "\"_d")
|
||||
vim.keymap.set("n", "dx", "dd") -- cut line, under my control
|
||||
vim.keymap.set("v", "d", "\"_d")
|
||||
|
||||
-- copy/paste to/from system clipboard
|
||||
vim.keymap.set({ "n", "v" }, "<leader>y", "\"+y")
|
||||
vim.keymap.set({ "n", "v" }, "<leader>p", "\"+p")
|
||||
-- yank/put to/from register 'a'
|
||||
vim.keymap.set("x", "ay", '"ay', { noremap = true })
|
||||
vim.keymap.set("x", "ap", '"ap', { noremap = true })
|
||||
|
||||
-- increment/decrement a count, helpful for changing indeces
|
||||
vim.keymap.set("n", "+", "<C-a>")
|
||||
|
|
@ -59,14 +48,9 @@ vim.keymap.set("n", "-", "<C-x>")
|
|||
|
||||
-- do not copy when deleting word
|
||||
vim.keymap.set("n", "dw", "\"_dw")
|
||||
vim.keymap.set("n", "de", "\"_de")
|
||||
vim.keymap.set("n", "<leader>dw", "dw")
|
||||
vim.keymap.set("n", "<leader>de", "de")
|
||||
vim.keymap.set("n", "db", "vb\"_d") -- delete in backwards
|
||||
vim.keymap.set("n", "<leader>db", "vbd")
|
||||
|
||||
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
|
||||
|
|
@ -95,7 +79,5 @@ vim.keymap.set("t", "<C-t>", "<C-\\><C-n>", { noremap = true }) -- exit inser
|
|||
vim.keymap.set("t", "<C-x>", "<cmd>bd!<CR>", { noremap = true }) -- terminate terminal session
|
||||
vim.keymap.set("n", "<C-t>", "<cmd>term<CR>i", { noremap = true }) -- create new terminal session
|
||||
|
||||
vim.keymap.set({ 'n', 'v' }, "<Space>", "<Nop>", { silent = true })
|
||||
|
||||
-- lazygit on floaterm
|
||||
vim.keymap.set("n", "<leader>g", "<cmd>FloatermNew lazygit<CR>", { noremap = true })
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
vim.scriptencoding = "utf-8"
|
||||
vim.opt.encoding = "utf-8"
|
||||
vim.opt.fileencoding = "utf-8"
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
vim.wo.number = true -- show line number
|
||||
vim.opt.number = true -- show line number
|
||||
vim.opt.relativenumber = true -- juicy relativity
|
||||
|
||||
vim.opt.autoindent = true
|
||||
|
|
@ -44,7 +43,7 @@ vim.opt.termguicolors = true -- good shit, just take it
|
|||
vim.opt.undofile = true
|
||||
|
||||
|
||||
-- [[ highlight on yank ]]
|
||||
-- highlight on yank
|
||||
local highligh_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
callback = function()
|
||||
|
|
@ -55,7 +54,7 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
|||
})
|
||||
|
||||
|
||||
vim.opt.completeopt = 'menuone,noselect'
|
||||
vim.opt.completeopt = 'menu,menuone,noselect'
|
||||
|
||||
vim.opt.breakindent = true
|
||||
|
||||
8
nvim/lua/juancwu/init.lua
Normal file
8
nvim/lua/juancwu/init.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
local M = {}
|
||||
|
||||
---@param opts? ConfigOptions
|
||||
function M.setup(opts)
|
||||
require("juancwu.config").setup(opts)
|
||||
end
|
||||
|
||||
return M
|
||||
74
nvim/lua/juancwu/plugins/colorscheme.lua
Normal file
74
nvim/lua/juancwu/plugins/colorscheme.lua
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
return {
|
||||
-- rose-pine
|
||||
{
|
||||
"rose-pine/nvim",
|
||||
name = "rose-pine",
|
||||
priority = 1000,
|
||||
},
|
||||
|
||||
-- onedark
|
||||
{
|
||||
'navarasu/onedark.nvim',
|
||||
priority = 1000,
|
||||
},
|
||||
|
||||
-- solarized-osaka
|
||||
{
|
||||
"craftzdog/solarized-osaka.nvim",
|
||||
priority = 1000,
|
||||
opts = {
|
||||
transparent = false,
|
||||
}
|
||||
},
|
||||
|
||||
-- tokyonight
|
||||
{
|
||||
"folke/tokyonight.nvim",
|
||||
lazy = true,
|
||||
opts = { style = "moon" },
|
||||
},
|
||||
|
||||
-- catppuccin
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
lazy = true,
|
||||
name = "catppuccin",
|
||||
opts = {
|
||||
integrations = {
|
||||
aerial = true,
|
||||
alpha = true,
|
||||
cmp = true,
|
||||
dashboard = true,
|
||||
flash = true,
|
||||
gitsigns = true,
|
||||
headlines = true,
|
||||
illuminate = true,
|
||||
indent_blankline = { enabled = true },
|
||||
leap = true,
|
||||
lsp_trouble = true,
|
||||
mason = true,
|
||||
markdown = true,
|
||||
mini = true,
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
underlines = {
|
||||
errors = { "undercurl" },
|
||||
hints = { "undercurl" },
|
||||
warnings = { "undercurl" },
|
||||
information = { "undercurl" },
|
||||
},
|
||||
},
|
||||
navic = { enabled = true, custom_bg = "lualine" },
|
||||
neotest = true,
|
||||
neotree = true,
|
||||
noice = true,
|
||||
notify = true,
|
||||
semantic_tokens = true,
|
||||
telescope = true,
|
||||
treesitter = true,
|
||||
treesitter_context = true,
|
||||
which_key = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
169
nvim/lua/juancwu/plugins/lsp/init.lua
Normal file
169
nvim/lua/juancwu/plugins/lsp/init.lua
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
return {
|
||||
-- lspconfig
|
||||
{
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
branch = "v2.x",
|
||||
dependencies = {
|
||||
-- LSP Support
|
||||
{ "neovim/nvim-lspconfig" }, -- Required
|
||||
{
|
||||
-- Optional
|
||||
"williamboman/mason.nvim",
|
||||
build = function()
|
||||
pcall(vim.cmd, "MasonUpdate")
|
||||
end,
|
||||
},
|
||||
{ "williamboman/mason-lspconfig.nvim" }, -- Optional
|
||||
|
||||
-- Autocompletion
|
||||
{ "hrsh7th/nvim-cmp" }, -- Required
|
||||
{ "hrsh7th/cmp-nvim-lsp" }, -- Required
|
||||
{ "L3MON4D3/LuaSnip" }, -- Required
|
||||
|
||||
-- Neovim Plugin Development Completions
|
||||
{
|
||||
"folke/neodev.nvim",
|
||||
opts = {},
|
||||
},
|
||||
|
||||
-- formatting
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
javascript = { "prettierd" },
|
||||
typescript = { "prettierd" },
|
||||
javascriptreact = { "prettierd" },
|
||||
typescriptreact = { "prettierd" },
|
||||
},
|
||||
format_on_save = function(bufnr)
|
||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||
return
|
||||
end
|
||||
return { timeout_ms = 500, lsp_fallback = true }
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
-- required to setup neodev before lspconfig
|
||||
require("neodev").setup({})
|
||||
|
||||
local lspzero = require("lsp-zero")
|
||||
|
||||
lspzero.preset({})
|
||||
|
||||
lspzero.on_attach(function(_, bufnr)
|
||||
lspzero.default_keymaps({
|
||||
buffer = bufnr,
|
||||
omit = {
|
||||
"gr",
|
||||
},
|
||||
})
|
||||
|
||||
local function nmap(key, action, desc)
|
||||
vim.keymap.set("n", key, action, {
|
||||
desc = "LSP: " .. desc,
|
||||
})
|
||||
end
|
||||
|
||||
local function format()
|
||||
require("conform").format({ bufnr = bufnr })
|
||||
end
|
||||
|
||||
nmap("[d", "<cmd>lua vim.diagnostic.goto_prev()<CR>", "Goto Prev Diagnostic")
|
||||
nmap("]d", "<cmd>lua vim.diagnostic.goto_next()<CR>", "Goto Next Diagnostic")
|
||||
|
||||
-- local current_dir = vim.fn.expand("%:p:h")
|
||||
|
||||
-- vim.keymap.set('n', 'gr', '<cmd>Telescope lsp_references<cr>', { buffer = true })
|
||||
|
||||
-- format with space + f
|
||||
-- vim.keymap.set("n", "<leader>fb", "<cmd>lua vim.lsp.buf.format()<CR>",
|
||||
-- { desc = "[F]ormat [B]uffer" })
|
||||
nmap("<leader>fb", format, "[F]ormat [B]uffer")
|
||||
|
||||
vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
|
||||
format()
|
||||
end, { desc = "Format current buffer with LSP" })
|
||||
end)
|
||||
|
||||
lspzero.ensure_installed({
|
||||
"tsserver",
|
||||
"eslint",
|
||||
"tailwindcss",
|
||||
})
|
||||
|
||||
-- lspzero.format_on_save({
|
||||
-- format_ops = {
|
||||
-- async = true,
|
||||
-- timeout_ms = 10000,
|
||||
-- },
|
||||
-- servers = {
|
||||
-- ["lua_ls"] = { "lua" },
|
||||
-- ["null-ls"] = {
|
||||
-- "javascript",
|
||||
-- "typescript",
|
||||
-- "javascriptreact",
|
||||
-- "typescriptreact",
|
||||
-- "html",
|
||||
-- "css",
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
|
||||
local status, lspconfig = pcall(require, "lspconfig")
|
||||
|
||||
if status then
|
||||
lspconfig.tsserver.setup({})
|
||||
lspconfig.tailwindcss.setup({
|
||||
filetypes = {
|
||||
"templ",
|
||||
"html",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"javascriptreact",
|
||||
"typescriptreact",
|
||||
},
|
||||
init_options = {
|
||||
userLanguages = {
|
||||
templ = "html",
|
||||
},
|
||||
},
|
||||
})
|
||||
lspconfig.zls.setup({})
|
||||
lspconfig.rust_analyzer.setup({})
|
||||
lspconfig.gopls.setup({})
|
||||
lspconfig.html.setup({})
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
templ = "templ",
|
||||
},
|
||||
})
|
||||
lspconfig.templ.setup({
|
||||
filetypes = {
|
||||
"templ",
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
lspzero.setup()
|
||||
|
||||
local cmp
|
||||
status, cmp = pcall(require, "cmp")
|
||||
|
||||
if not status then
|
||||
return
|
||||
end
|
||||
|
||||
cmp.setup({
|
||||
mapping = {
|
||||
-- press 'enter' to confirm completion/suggestion
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
10
nvim/lua/juancwu/utils/init.lua
Normal file
10
nvim/lua/juancwu/utils/init.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
---@class Utils
|
||||
---@field os juancwu.utils.os
|
||||
local M = setmetatable({}, {
|
||||
__index = function(t, k)
|
||||
t[k] = require("juancwu.utils." .. k)
|
||||
return t[k]
|
||||
end
|
||||
})
|
||||
|
||||
return M
|
||||
24
nvim/lua/juancwu/utils/os.lua
Normal file
24
nvim/lua/juancwu/utils/os.lua
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
---@class juancwu.utils.os
|
||||
local M = {}
|
||||
|
||||
---@return boolean
|
||||
function M.is_linux()
|
||||
return vim.loop.os_uname().sysname:find("Linux") ~= nil
|
||||
end
|
||||
|
||||
---@return boolean
|
||||
function M.is_mac()
|
||||
return vim.loop.os_uname().sysname:find("Darwin") ~= nil
|
||||
end
|
||||
|
||||
---@return boolean
|
||||
function M.is_win()
|
||||
return vim.loop.os_uname().sysname:find("Windows") ~= nil
|
||||
end
|
||||
|
||||
---@return boolean
|
||||
function M.is_wsl()
|
||||
return vim.fn.has("wsl") == 1
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"rose-pine/nvim",
|
||||
name = "rose-pine",
|
||||
priority = 1000,
|
||||
enabled = true,
|
||||
config = function()
|
||||
vim.cmd.colorscheme("rose-pine")
|
||||
end
|
||||
},
|
||||
{
|
||||
-- Theme inspired by Atom
|
||||
'navarasu/onedark.nvim',
|
||||
priority = 1000,
|
||||
enabled = false,
|
||||
config = function()
|
||||
vim.cmd.colorscheme 'onedark'
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
return {
|
||||
'VonHeikemen/lsp-zero.nvim',
|
||||
branch = 'v2.x',
|
||||
dependencies = {
|
||||
-- LSP Support
|
||||
{ 'neovim/nvim-lspconfig' }, -- Required
|
||||
{
|
||||
-- Optional
|
||||
'williamboman/mason.nvim',
|
||||
build = function()
|
||||
pcall(vim.cmd, 'MasonUpdate')
|
||||
end,
|
||||
},
|
||||
{ 'williamboman/mason-lspconfig.nvim' }, -- Optional
|
||||
|
||||
-- Autocompletion
|
||||
{ 'hrsh7th/nvim-cmp' }, -- Required
|
||||
{ 'hrsh7th/cmp-nvim-lsp' }, -- Required
|
||||
{ 'L3MON4D3/LuaSnip' }, -- Required
|
||||
},
|
||||
config = function()
|
||||
local lspzero = require("lsp-zero")
|
||||
|
||||
lspzero.preset({})
|
||||
|
||||
lspzero.on_attach(function(client, bufnr)
|
||||
lspzero.default_keymaps({
|
||||
buffer = bufnr,
|
||||
omit = {
|
||||
'gr'
|
||||
},
|
||||
})
|
||||
|
||||
function nmap(key, action, desc)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
key,
|
||||
action,
|
||||
{
|
||||
desc = "LSP: " .. desc,
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
nmap("[d", "<cmd>lua vim.diagnostic.goto_prev()<CR>", "Goto Prev Diagnostic");
|
||||
nmap("]d", "<cmd>lua vim.diagnostic.goto_next()<CR>", "Goto Next Diagnostic")
|
||||
|
||||
local current_dir = vim.fn.expand("%:p:h")
|
||||
|
||||
-- vim.keymap.set('n', 'gr', '<cmd>Telescope lsp_references<cr>', { buffer = true })
|
||||
|
||||
-- format with space + f
|
||||
-- vim.keymap.set("n", "<leader>fb", "<cmd>lua vim.lsp.buf.format()<CR>",
|
||||
-- { desc = "[F]ormat [B]uffer" })
|
||||
nmap("<leader>fb", "<cmd>lua vim.lsp.buf.format()<CR>", "[F]ormat [B]uffer")
|
||||
end)
|
||||
|
||||
lspzero.ensure_installed({
|
||||
"tsserver",
|
||||
"eslint",
|
||||
"tailwindcss",
|
||||
})
|
||||
|
||||
lspzero.format_on_save({
|
||||
format_ops = {
|
||||
async = true,
|
||||
timeout_ms = 10000,
|
||||
},
|
||||
servers = {
|
||||
["lua_ls"] = { "lua" },
|
||||
["null-ls"] = {
|
||||
"javascript",
|
||||
"typescript",
|
||||
"javascriptreact",
|
||||
"typescriptreact",
|
||||
"html",
|
||||
"css",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
local status, lspconfig = pcall(require, "lspconfig")
|
||||
|
||||
if status then
|
||||
lspconfig.tsserver.setup({})
|
||||
lspconfig.tailwindcss.setup({
|
||||
filetypes = {
|
||||
'templ',
|
||||
'html',
|
||||
'javascript',
|
||||
'typescript',
|
||||
'javascriptreact',
|
||||
'typescriptreact',
|
||||
},
|
||||
init_options = {
|
||||
userLanguages = {
|
||||
templ = "html"
|
||||
}
|
||||
}
|
||||
})
|
||||
lspconfig.zls.setup({})
|
||||
lspconfig.rust_analyzer.setup({})
|
||||
lspconfig.gopls.setup({})
|
||||
lspconfig.html.setup({})
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
templ = "templ"
|
||||
},
|
||||
})
|
||||
lspconfig.templ.setup({
|
||||
filetypes = {
|
||||
"templ",
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
lspzero.setup()
|
||||
|
||||
local cmp
|
||||
status, cmp = pcall(require, "cmp")
|
||||
|
||||
if not status then return end
|
||||
|
||||
cmp.setup({
|
||||
mapping = {
|
||||
-- press 'enter' to confirm completion/suggestion
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
},
|
||||
})
|
||||
end
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
return {
|
||||
"folke/neodev.nvim",
|
||||
enabled = false,
|
||||
opts = {
|
||||
library = {
|
||||
plugins = true,
|
||||
types = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
return {
|
||||
"rose-pine/nvim",
|
||||
name = "rose-pine",
|
||||
opts = function()
|
||||
vim.cmd.colorscheme("rose-pine")
|
||||
end
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue