init: public
This commit is contained in:
16
modules/coding/editor/all.nix
Normal file
16
modules/coding/editor/all.nix
Normal file
@@ -0,0 +1,16 @@
|
||||
{ config, lib, ... }:
|
||||
lib.my.makeSwitch {
|
||||
inherit config;
|
||||
optionName = "all coding editors";
|
||||
optionPath = [
|
||||
"coding"
|
||||
"editor"
|
||||
"all"
|
||||
];
|
||||
config' = {
|
||||
my.coding.editor = {
|
||||
neovim.enable = true;
|
||||
vscode.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
8
modules/coding/editor/default.nix
Normal file
8
modules/coding/editor/default.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./all.nix
|
||||
./neovim
|
||||
./vscode
|
||||
];
|
||||
}
|
||||
61
modules/coding/editor/neovim/default.nix
Normal file
61
modules/coding/editor/neovim/default.nix
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
lib.my.makeHomeProgramConfig {
|
||||
inherit config;
|
||||
programName = "neovim";
|
||||
optionPath = [
|
||||
"coding"
|
||||
"editor"
|
||||
"neovim"
|
||||
];
|
||||
extraConfig = {
|
||||
my.home = {
|
||||
xdg.configFile."nvim/init.lua".source = ./nvim/init.lua;
|
||||
xdg.configFile."nvim/lua" = {
|
||||
source = ./nvim/lua;
|
||||
recursive = true;
|
||||
};
|
||||
programs.neovim = {
|
||||
package = pkgs.neovim-unwrapped.overrideAttrs {
|
||||
treesitter-parsers = { };
|
||||
};
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
vimdiffAlias = true;
|
||||
extraPackages = with pkgs; [
|
||||
gcc
|
||||
gnumake
|
||||
|
||||
pyright
|
||||
|
||||
clang-tools
|
||||
|
||||
rust-analyzer
|
||||
pest-ide-tools
|
||||
|
||||
nil
|
||||
|
||||
gotools
|
||||
gopls
|
||||
|
||||
stylua
|
||||
lua-language-server
|
||||
|
||||
nodePackages.vscode-langservers-extracted
|
||||
nodePackages.typescript-language-server
|
||||
vue-language-server
|
||||
typescript
|
||||
nodejs
|
||||
|
||||
ripgrep
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
9
modules/coding/editor/neovim/nvim/init.lua
Normal file
9
modules/coding/editor/neovim/nvim/init.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
require("core.options")
|
||||
require("core.keymaps")
|
||||
|
||||
require("langs.langs-setup")
|
||||
|
||||
require("plugins.plugins-setup")
|
||||
|
||||
require("core.autostart")
|
||||
|
||||
7
modules/coding/editor/neovim/nvim/lua/core/autostart.lua
Normal file
7
modules/coding/editor/neovim/nvim/lua/core/autostart.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
-- Open tree when in config dir
|
||||
local configdir = vim.fn.system("echo $HOME/.config")
|
||||
configdir = string.sub(configdir, 1, string.len(configdir) - 1)
|
||||
if string.find(vim.fn.system("pwd"), configdir) ~= nil then
|
||||
vim.cmd("NvimTreeOpen")
|
||||
vim.cmd("NvimTmuxNavigateRight")
|
||||
end
|
||||
113
modules/coding/editor/neovim/nvim/lua/core/globals.lua
Normal file
113
modules/coding/editor/neovim/nvim/lua/core/globals.lua
Normal file
@@ -0,0 +1,113 @@
|
||||
G = {}
|
||||
|
||||
G.keymap_opt = { noremap = true, silent = true }
|
||||
|
||||
function G.close_empty_buffer()
|
||||
local flag = false
|
||||
local cleaned = true
|
||||
local empties = {}
|
||||
for _, b in ipairs(vim.api.nvim_list_bufs()) do
|
||||
local info = vim.fn.getbufinfo(b)[1]
|
||||
if info.loaded == 1 and info.listed == 1 and info.name ~= "" then
|
||||
flag = true
|
||||
elseif info.loaded == 1 and info.name == "" and info.changed == 0 then
|
||||
if flag and not cleaned then
|
||||
for e in table do
|
||||
G.buf_kill("bd", e, false)
|
||||
end
|
||||
cleaned = true
|
||||
elseif cleaned then
|
||||
G.buf_kill("bd", b, false)
|
||||
else
|
||||
table.insert(empties, b)
|
||||
end
|
||||
end
|
||||
end
|
||||
if not flag and #empties == 0 then
|
||||
vim.cmd("enew")
|
||||
end
|
||||
end
|
||||
|
||||
function G.switch_input_method(req)
|
||||
local input_status = tonumber(vim.fn.system("fcitx5-remote"))
|
||||
if input_status ~= req then
|
||||
vim.fn.system("fcitx5-remote -t")
|
||||
end
|
||||
return input_status
|
||||
end
|
||||
|
||||
|
||||
function G.buf_kill(kill_command, bufnr, force)
|
||||
kill_command = kill_command or "bd"
|
||||
|
||||
local bo = vim.bo
|
||||
local api = vim.api
|
||||
local fmt = string.format
|
||||
local fn = vim.fn
|
||||
|
||||
if bufnr == 0 or bufnr == nil then
|
||||
bufnr = api.nvim_get_current_buf()
|
||||
end
|
||||
|
||||
local bufname = api.nvim_buf_get_name(bufnr)
|
||||
|
||||
if not force then
|
||||
local choice
|
||||
if bo[bufnr].modified then
|
||||
choice = fn.confirm(fmt([[Save changes to "%s"?]], bufname), "&Yes\n&No\n&Cancel")
|
||||
if choice == 1 then
|
||||
vim.api.nvim_buf_call(bufnr, function()
|
||||
vim.cmd("w")
|
||||
end)
|
||||
elseif choice == 2 then
|
||||
force = true
|
||||
else return
|
||||
end
|
||||
elseif api.nvim_buf_get_option(bufnr, "buftype") == "terminal" then
|
||||
choice = fn.confirm(fmt([[Close "%s"?]], bufname), "&Yes\n&No\n&Cancel")
|
||||
if choice == 1 then
|
||||
force = true
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Get list of windows IDs with the buffer to close
|
||||
local windows = vim.tbl_filter(function(win)
|
||||
return api.nvim_win_get_buf(win) == bufnr
|
||||
end, api.nvim_list_wins())
|
||||
|
||||
if force then
|
||||
kill_command = kill_command .. "!"
|
||||
end
|
||||
|
||||
-- Get list of active buffers
|
||||
local buffers = vim.tbl_filter(function(buf)
|
||||
return api.nvim_buf_is_valid(buf) and bo[buf].buflisted
|
||||
end, api.nvim_list_bufs())
|
||||
|
||||
-- If there is only one buffer (which has to be the current one), vim will
|
||||
-- create a new buffer on :bd.
|
||||
-- For more than one buffer, pick the previous buffer (wrapping around if necessary)
|
||||
if #buffers > 1 and #windows > 0 then
|
||||
for i, v in ipairs(buffers) do
|
||||
if v == bufnr then
|
||||
local prev_buf_idx = i == 1 and #buffers or (i - 1)
|
||||
local prev_buffer = buffers[prev_buf_idx]
|
||||
for _, win in ipairs(windows) do
|
||||
api.nvim_win_set_buf(win, prev_buffer)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Check if buffer still exists, to ensure the target buffer wasn't killed
|
||||
-- due to options like bufhidden=wipe.
|
||||
if api.nvim_buf_is_valid(bufnr) and bo[bufnr].buflisted then
|
||||
vim.cmd(string.format("%s %d", kill_command, bufnr))
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return G
|
||||
71
modules/coding/editor/neovim/nvim/lua/core/keymaps.lua
Normal file
71
modules/coding/editor/neovim/nvim/lua/core/keymaps.lua
Normal file
@@ -0,0 +1,71 @@
|
||||
vim.g.mapleader = " "
|
||||
|
||||
local keymap = vim.keymap
|
||||
local globals = require("core.globals")
|
||||
local opt = globals.keymap_opt
|
||||
local buf_kill = globals.buf_kill
|
||||
|
||||
keymap.set("v", "<S-pageup>", ":m '<-2<CR>gv=gv", opt)
|
||||
keymap.set("v", "<S-pagedown>", ":m '>+1<CR>gv=gv", opt)
|
||||
|
||||
keymap.set("n", "<leader>nh", ":nohl<CR>", opt)
|
||||
|
||||
keymap.set("n", "<leader>sv", "<C-w>v", opt)
|
||||
keymap.set("n", "<leader>sh", "<C-w>s", opt)
|
||||
|
||||
keymap.set("i", "<S-up>", "<ESC>v<up>", opt)
|
||||
keymap.set("i", "<S-down>", "<ESC>v<down>", opt)
|
||||
keymap.set("n", "<S-up>", "v<up>", opt)
|
||||
keymap.set("n", "<S-down>", "v<down>", opt)
|
||||
keymap.set("v", "<S-up>", "<up>", opt)
|
||||
keymap.set("v", "<S-down>", "<down>", opt)
|
||||
|
||||
keymap.set("i", "<S-left>", "<ESC>v<left>", opt)
|
||||
keymap.set("i", "<S-right>", "<ESC>v<right>", opt)
|
||||
keymap.set("n", "<S-left>", "v<left>", opt)
|
||||
keymap.set("n", "<S-right>", "v<right>", opt)
|
||||
keymap.set("v", "<S-left>", "<left>", opt)
|
||||
keymap.set("v", "<S-right>", "<right>", opt)
|
||||
|
||||
keymap.set("v", ".", ">gv", opt)
|
||||
keymap.set("v", ",", "<gv", opt)
|
||||
|
||||
keymap.set({ "n", "v" }, "<pageup>", "9k", opt)
|
||||
keymap.set({ "n", "v" }, "<pagedown>", "9j", opt)
|
||||
keymap.set("i", "<pageup>", "<up><up><up><up><up><up><up><up><up>", opt)
|
||||
keymap.set("i", "<pagedown>", "<down><down><down><down><down><down><down><down><down>", opt)
|
||||
|
||||
keymap.set("n", "<leader>ww", ":w<CR>", opt)
|
||||
keymap.set("n", "<leader>so", ":so<CR>", opt)
|
||||
keymap.set("n", "<leader>qq", ":q<CR>", opt)
|
||||
keymap.set("n", "<leader>qa", ":qa<CR>", opt)
|
||||
keymap.set("n", "<leader>c", function () buf_kill("bd", nil, false) end, opt)
|
||||
|
||||
keymap.set("n", "<C-up>", ":resize +5<CR>", opt)
|
||||
keymap.set("n", "<C-down>", ":resize -5<CR>", opt)
|
||||
keymap.set("n", "<C-right>", ":vert resize +5<CR>", opt)
|
||||
keymap.set("n", "<C-left>", ":vert resize -5<CR>", opt)
|
||||
|
||||
-- buffer
|
||||
keymap.set("n", "H", ":BufferLineCyclePrev<CR>", opt)
|
||||
keymap.set("n", "L", ":BufferLineCycleNext<CR>", opt)
|
||||
keymap.set("n", "<A-h>", ":BufferLineMovePrev<CR>", opt)
|
||||
keymap.set("n", "<A-l>", ":BufferLineMoveNext<CR>", opt)
|
||||
|
||||
-- reload config
|
||||
keymap.set("n", "<leader>rc", ":so ~/.config/nvim/init.lua<CR>", opt)
|
||||
keymap.set("n", "<leader>rp", ":so ~/.config/nvim/lua/plugins/plugins-setup.lua<CR>", opt)
|
||||
|
||||
-- Workspaces
|
||||
keymap.set("n", "<leader>wo", ":Telescope workspaces<CR>", opt)
|
||||
keymap.set("n", "<leader>wa", ":WorkspacesAdd<CR>", opt)
|
||||
keymap.set("n", "<leader>wr", ":WorkspacesRemove<CR>", opt)
|
||||
|
||||
-- Neovide config
|
||||
if vim.g.neovide then
|
||||
keymap.set("v", "<C-C>", "\"+y", opt)
|
||||
keymap.set("n", "<C-V>", "\"+P", opt)
|
||||
keymap.set("i", "<C-V>", "<ESC>l\"+Pli", opt)
|
||||
keymap.set("c", "<C-V>", "<C-R>+", opt)
|
||||
end
|
||||
|
||||
140
modules/coding/editor/neovim/nvim/lua/core/options.lua
Normal file
140
modules/coding/editor/neovim/nvim/lua/core/options.lua
Normal file
@@ -0,0 +1,140 @@
|
||||
local opt = vim.opt
|
||||
|
||||
-- Tab width setting
|
||||
opt.tabstop = 4
|
||||
opt.shiftwidth = 4
|
||||
opt.softtabstop = 4
|
||||
opt.expandtab = true
|
||||
opt.autoindent = true
|
||||
|
||||
-- Linenumber setting
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
opt.wrap = false
|
||||
opt.cursorline = true
|
||||
|
||||
opt.mouse:append("a")
|
||||
opt.clipboard:append("unnamedplus")
|
||||
opt.splitright = true
|
||||
opt.splitbelow = true
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
opt.termguicolors = true
|
||||
opt.signcolumn = "yes"
|
||||
opt.colorcolumn = "110"
|
||||
opt.scrolloff = 8
|
||||
opt.sidescrolloff = 8
|
||||
|
||||
opt.updatetime = 500
|
||||
opt.timeoutlen = 500
|
||||
|
||||
opt.completeopt = ""
|
||||
|
||||
opt.autoread = true
|
||||
vim.g.autoread = true
|
||||
|
||||
vim.g.loaded_ruby_provider = 0
|
||||
|
||||
-- Hightlight on yank
|
||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
group = highlight_group,
|
||||
pattern = "*",
|
||||
})
|
||||
|
||||
-- Remember last position
|
||||
vim.cmd([[
|
||||
autocmd BufReadPost *
|
||||
\ if line("'\"") > 0 && line("'\"") <= line("$") |
|
||||
\ exe "normal! g`\"" |
|
||||
\ endif
|
||||
]])
|
||||
|
||||
-- Automaticly switch input method
|
||||
Last_input_method = 1
|
||||
vim.api.nvim_create_augroup("AutoInputMethod", {})
|
||||
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||
pattern = "*",
|
||||
desc = "Automaticly switch input method",
|
||||
callback = function()
|
||||
Last_input_method = require("core.globals").switch_input_method(1)
|
||||
end,
|
||||
group = "AutoInputMethod"
|
||||
})
|
||||
vim.api.nvim_create_autocmd("CmdlineLeave", {
|
||||
pattern = "*",
|
||||
desc = "Automaticly switch input method",
|
||||
callback = function()
|
||||
require("core.globals").switch_input_method(1)
|
||||
end,
|
||||
group = "AutoInputMethod"
|
||||
})
|
||||
vim.api.nvim_create_autocmd("InsertEnter", {
|
||||
pattern = "*",
|
||||
desc = "Automaticly switch input method",
|
||||
callback = function()
|
||||
require("core.globals").switch_input_method(Last_input_method)
|
||||
end,
|
||||
group = "AutoInputMethod"
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "lua" },
|
||||
desc = "fix gf functionality inside .lua files",
|
||||
callback = function()
|
||||
---@diagnostic disable: assign-type-mismatch
|
||||
-- credit: https://github.com/sam4llis/nvim-lua-gf
|
||||
vim.opt_local.include = [[\v<((do|load)file|require|reload)[^''"]*[''"]\zs[^''"]+]]
|
||||
vim.opt_local.includeexpr = "substitute(v:fname,'\\.','/','g')"
|
||||
vim.opt_local.suffixesadd:prepend ".lua"
|
||||
vim.opt_local.suffixesadd:prepend "init.lua"
|
||||
|
||||
for _, path in pairs(vim.api.nvim_list_runtime_paths()) do
|
||||
vim.opt_local.path:append(path .. "/lua")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- fix https://github.com/neovim/neovim/issues/21856
|
||||
vim.api.nvim_create_autocmd({ "VimLeave" }, {
|
||||
callback = function()
|
||||
vim.fn.jobstart("", { detach = true })
|
||||
end,
|
||||
})
|
||||
|
||||
-- MkDir
|
||||
vim.api.nvim_create_user_command("MakeDirectory", function()
|
||||
---@diagnostic disable-next-line: missing-parameter
|
||||
local path = vim.fn.expand("%")
|
||||
local dir = vim.fn.fnamemodify(path, ":p:h")
|
||||
if vim.fn.isdirectory(dir) == 0 then
|
||||
vim.fn.mkdir(dir, "p")
|
||||
else
|
||||
vim.notify("Directory already exists", vim.log.levels.WARN, { title = "Nvim" })
|
||||
end
|
||||
end, { desc = "Create directory if it doesn't exist" })
|
||||
|
||||
-- Neovide config
|
||||
if vim.g.neovide then
|
||||
local global = vim.g
|
||||
vim.o.guifont = "monospace:h14"
|
||||
global.neovide_padding_top = 0
|
||||
global.neovide_padding_bottom = 0
|
||||
global.neovide_padding_right = 0
|
||||
global.neovide_padding_left = 0
|
||||
global.neovide_hide_mouse_when_typing = true
|
||||
global.neovide_cursor_animation_length = 0.05
|
||||
global.neovide_cursor_trail_size = 0.15
|
||||
global.neovide_confirm_quit = true
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "VimEnter" }, {
|
||||
callback = function()
|
||||
-- A dumb way to clear annoying NeoVim startup screen
|
||||
vim.cmd("normal ia")
|
||||
vim.cmd("normal u")
|
||||
end,
|
||||
})
|
||||
13
modules/coding/editor/neovim/nvim/lua/langs/go.lua
Normal file
13
modules/coding/editor/neovim/nvim/lua/langs/go.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
vim.api.nvim_create_augroup("Go", {})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = { "*.go" },
|
||||
desc = "auto format Go files",
|
||||
callback = function()
|
||||
vim.lsp.buf.format()
|
||||
-- vim.fn.system("go fmt " .. vim.fn.expand("%:p"))
|
||||
-- vim.fn.system("goimports -w " .. vim.fn.expand("%:p"))
|
||||
-- vim.cmd("edit")
|
||||
end,
|
||||
group = "Go",
|
||||
})
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
require("langs.go")
|
||||
-- require("langs.rust")
|
||||
require("langs.lualang")
|
||||
require("langs.nix")
|
||||
require("langs.markdown")
|
||||
35
modules/coding/editor/neovim/nvim/lua/langs/lualang.lua
Normal file
35
modules/coding/editor/neovim/nvim/lua/langs/lualang.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
vim.api.nvim_create_augroup("Lua", {})
|
||||
|
||||
local old = {}
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
pattern = { "*.lua" },
|
||||
desc = "auto lua file indent",
|
||||
callback = function()
|
||||
local opt = vim.opt
|
||||
-- Tab width setting
|
||||
old.tabstop = opt.tabstop
|
||||
old.shiftwidth = opt.shiftwidth
|
||||
old.softtabstop = opt.softtabstop
|
||||
old.expandtab = opt.expandtab
|
||||
opt.tabstop = 2
|
||||
opt.shiftwidth = 2
|
||||
opt.softtabstop = 2
|
||||
opt.expandtab = true
|
||||
opt.autoindent = true
|
||||
end,
|
||||
group = "Lua",
|
||||
})
|
||||
vim.api.nvim_create_autocmd("BufLeave", {
|
||||
pattern = { "*.lua" },
|
||||
desc = "auto lua file indent",
|
||||
callback = function()
|
||||
local opt = vim.opt
|
||||
-- Tab width setting
|
||||
opt.tabstop = old.tabstop
|
||||
opt.shiftwidth = old.shiftwidth
|
||||
opt.softtabstop = old.softtabstop
|
||||
opt.expandtab = old.expandtab
|
||||
end,
|
||||
group = "Lua",
|
||||
})
|
||||
|
||||
35
modules/coding/editor/neovim/nvim/lua/langs/markdown.lua
Normal file
35
modules/coding/editor/neovim/nvim/lua/langs/markdown.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
vim.api.nvim_create_augroup("Markdown", {})
|
||||
|
||||
local old = {}
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
pattern = { "*.md" },
|
||||
desc = "auto md file indent",
|
||||
callback = function()
|
||||
local opt = vim.opt
|
||||
-- Tab width setting
|
||||
old.tabstop = opt.tabstop
|
||||
old.shiftwidth = opt.shiftwidth
|
||||
old.softtabstop = opt.softtabstop
|
||||
old.expandtab = opt.expandtab
|
||||
opt.tabstop = 2
|
||||
opt.shiftwidth = 2
|
||||
opt.softtabstop = 2
|
||||
opt.expandtab = true
|
||||
opt.autoindent = true
|
||||
end,
|
||||
group = "Markdown",
|
||||
})
|
||||
vim.api.nvim_create_autocmd("BufLeave", {
|
||||
pattern = { "*.md" },
|
||||
desc = "auto markdown file indent",
|
||||
callback = function()
|
||||
local opt = vim.opt
|
||||
-- Tab width setting
|
||||
opt.tabstop = old.tabstop
|
||||
opt.shiftwidth = old.shiftwidth
|
||||
opt.softtabstop = old.softtabstop
|
||||
opt.expandtab = old.expandtab
|
||||
end,
|
||||
group = "Markdown",
|
||||
})
|
||||
|
||||
35
modules/coding/editor/neovim/nvim/lua/langs/nix.lua
Normal file
35
modules/coding/editor/neovim/nvim/lua/langs/nix.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
vim.api.nvim_create_augroup("Nix", {})
|
||||
|
||||
local old = {}
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
pattern = { "*.nix" },
|
||||
desc = "auto nix file indent",
|
||||
callback = function()
|
||||
local opt = vim.opt
|
||||
-- Tab width setting
|
||||
old.tabstop = opt.tabstop
|
||||
old.shiftwidth = opt.shiftwidth
|
||||
old.softtabstop = opt.softtabstop
|
||||
old.expandtab = opt.expandtab
|
||||
opt.tabstop = 2
|
||||
opt.shiftwidth = 2
|
||||
opt.softtabstop = 2
|
||||
opt.expandtab = true
|
||||
opt.autoindent = true
|
||||
end,
|
||||
group = "Nix",
|
||||
})
|
||||
vim.api.nvim_create_autocmd("BufLeave", {
|
||||
pattern = { "*.nix" },
|
||||
desc = "auto nix file indent",
|
||||
callback = function()
|
||||
local opt = vim.opt
|
||||
-- Tab width setting
|
||||
opt.tabstop = old.tabstop
|
||||
opt.shiftwidth = old.shiftwidth
|
||||
opt.softtabstop = old.softtabstop
|
||||
opt.expandtab = old.expandtab
|
||||
end,
|
||||
group = "Nix",
|
||||
})
|
||||
|
||||
11
modules/coding/editor/neovim/nvim/lua/langs/rust.lua
Normal file
11
modules/coding/editor/neovim/nvim/lua/langs/rust.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
vim.api.nvim_create_augroup("Rust", {})
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
pattern = { "*.rs" },
|
||||
desc = "auto format Rust files",
|
||||
callback = function()
|
||||
vim.fn.system("rustfmt " .. vim.fn.expand("%:p"))
|
||||
vim.cmd("edit")
|
||||
end,
|
||||
group = "Rust",
|
||||
})
|
||||
|
||||
26
modules/coding/editor/neovim/nvim/lua/plugins/autopairs.lua
Normal file
26
modules/coding/editor/neovim/nvim/lua/plugins/autopairs.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
M = {
|
||||
check_ts = true,
|
||||
ts_config = {
|
||||
lua = { "string", "source" },
|
||||
javascript = { "string", "template_string" },
|
||||
},
|
||||
fast_wrap = {
|
||||
map = '<M-e>',
|
||||
chars = { '{', '[', '(', '"', "'" },
|
||||
pattern = [=[[%'%"%)%>%]%)%}%,]]=],
|
||||
end_key = '$',
|
||||
keys = 'qwertyuiopzxcvbnmasdfghjkl',
|
||||
check_comma = true,
|
||||
highlight = 'Search',
|
||||
highlight_grey='Comment'
|
||||
},
|
||||
}
|
||||
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
local ok, cmp = pcall(require, "cmp")
|
||||
if ok then
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
31
modules/coding/editor/neovim/nvim/lua/plugins/bufferline.lua
Normal file
31
modules/coding/editor/neovim/nvim/lua/plugins/bufferline.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
local buf_kill = require("core.globals").buf_kill
|
||||
|
||||
M = {
|
||||
highlights = {
|
||||
buffer_selected = {
|
||||
bold = true
|
||||
}
|
||||
},
|
||||
options = {
|
||||
diagnostics = "nvim_lsp",
|
||||
offsets = {
|
||||
{
|
||||
filetype = "NvimTree",
|
||||
text = "File Explorer",
|
||||
highlight = "Directory",
|
||||
text_align = "center"
|
||||
},
|
||||
},
|
||||
close_command = function (bufnr)
|
||||
buf_kill("bd", bufnr, false)
|
||||
end,
|
||||
right_mouse_command = function (bufnr)
|
||||
buf_kill("bd", bufnr, true)
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
return M
|
||||
|
||||
68
modules/coding/editor/neovim/nvim/lua/plugins/cmp/cmp.lua
Normal file
68
modules/coding/editor/neovim/nvim/lua/plugins/cmp/cmp.lua
Normal file
@@ -0,0 +1,68 @@
|
||||
local cmp = require("cmp")
|
||||
|
||||
M = {
|
||||
window = {
|
||||
completion = {
|
||||
border = 'rounded',
|
||||
scrollbar = '║',
|
||||
},
|
||||
documentation = {
|
||||
border = 'rounded',
|
||||
scrollbar = '║',
|
||||
},
|
||||
},
|
||||
formatting = {
|
||||
format = require('lspkind').cmp_format({
|
||||
mode = "symbol",
|
||||
maxwidth = 50,
|
||||
ellipsis_char = '...',
|
||||
symbol_map = { Codeium = "", }
|
||||
})
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<Escape>"] = cmp.mapping.abort(),
|
||||
["<Tab>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<Up>"] = cmp.mapping(function (fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s"
|
||||
}),
|
||||
["<Down>"] = cmp.mapping(function (fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s"
|
||||
}),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
-- { name = "codeium" },
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
vim.o.wildmenu = true
|
||||
vim.o.pumheight = 10
|
||||
|
||||
return M
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
M = {
|
||||
sources = {
|
||||
friendly_snippets = true
|
||||
},
|
||||
history = true,
|
||||
updateevents = { "TextChanged", "TextChangedI" }
|
||||
}
|
||||
|
||||
-- vscode format
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.vscode_snippets_path or "" }
|
||||
|
||||
-- snipmate format
|
||||
require("luasnip.loaders.from_snipmate").load()
|
||||
require("luasnip.loaders.from_snipmate").lazy_load { paths = vim.g.snipmate_snippets_path or "" }
|
||||
|
||||
-- lua format
|
||||
require("luasnip.loaders.from_lua").load()
|
||||
require("luasnip.loaders.from_lua").lazy_load { paths = vim.g.lua_snippets_path or "" }
|
||||
|
||||
local luasnip = require("luasnip")
|
||||
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||
callback = function()
|
||||
if
|
||||
luasnip.session.current_nodes[vim.api.nvim_get_current_buf()]
|
||||
and not luasnip.session.jump_active
|
||||
then
|
||||
luasnip.unlink_current()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
return M
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
M = {}
|
||||
|
||||
return M
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
local keymap = vim.keymap
|
||||
local opt = require("core.globals").keymap_opt
|
||||
|
||||
keymap.set("n", "<leader>tt", ":FloatermNew<CR>", opt)
|
||||
19
modules/coding/editor/neovim/nvim/lua/plugins/gitsigns.lua
Normal file
19
modules/coding/editor/neovim/nvim/lua/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
M = {
|
||||
signs = {
|
||||
add = { text = '▎', color = "green" },
|
||||
change = { text = '▎', color = "blue" },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
current_line_blame = true,
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = 'eol',
|
||||
delay = 0,
|
||||
ignore_whitespace = false,
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
M = {
|
||||
enabled = true,
|
||||
indent = {
|
||||
tab_char = "▎"
|
||||
},
|
||||
scope = {
|
||||
enabled = true,
|
||||
show_start = false,
|
||||
}
|
||||
}
|
||||
|
||||
vim.opt.list = true
|
||||
|
||||
return M
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
M = {}
|
||||
|
||||
return M
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
local servers = {
|
||||
"lua_ls",
|
||||
"pyright",
|
||||
"gopls",
|
||||
"clangd",
|
||||
"rust_analyzer",
|
||||
"ts_ls",
|
||||
"jsonls",
|
||||
"cssls",
|
||||
"nil_ls",
|
||||
"html",
|
||||
}
|
||||
|
||||
local extra_config = {
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = {
|
||||
library = {
|
||||
vim.api.nvim_get_runtime_file("", true),
|
||||
"${3rd}/luv/library",
|
||||
"${3rd}/luassert/library",
|
||||
}
|
||||
},
|
||||
diagnostics = {
|
||||
globals = {
|
||||
"vim"
|
||||
}
|
||||
},
|
||||
completion = {
|
||||
callSnippet = "Replace"
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
rust_analyzer = {
|
||||
settings = {
|
||||
rust_analyzer = {
|
||||
check = {
|
||||
command = "clippy"
|
||||
},
|
||||
formatting = {
|
||||
command = { "rustfmt" },
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
vim.api.nvim_create_autocmd("CursorHold", {
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
local opts = {
|
||||
focusable = false,
|
||||
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
prefix = " ",
|
||||
scope = "line",
|
||||
}
|
||||
vim.diagnostic.open_float(nil, opts)
|
||||
end,
|
||||
})
|
||||
end
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.foldingRange = {
|
||||
dynamicRegistration = false,
|
||||
lineFoldingOnly = true,
|
||||
}
|
||||
local lspconfig = require("lspconfig")
|
||||
for _, server in ipairs(servers) do
|
||||
local extra = extra_config[server] or {}
|
||||
local config = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
for k, v in pairs(extra) do
|
||||
config[k] = v
|
||||
end
|
||||
lspconfig[server].setup(config)
|
||||
end
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_lines = true
|
||||
})
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
M = {
|
||||
-- ensure_installed = require("plugins.lsp.servers")
|
||||
ensure_installed = {}
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
12
modules/coding/editor/neovim/nvim/lua/plugins/lsp/mason.lua
Normal file
12
modules/coding/editor/neovim/nvim/lua/plugins/lsp/mason.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
M = {
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
29
modules/coding/editor/neovim/nvim/lua/plugins/lsp/others.lua
Normal file
29
modules/coding/editor/neovim/nvim/lua/plugins/lsp/others.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
-- Keymaps
|
||||
local opt = require("core.globals").keymap_opt
|
||||
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opt)
|
||||
vim.keymap.set("n", "<leader>lR", vim.lsp.buf.rename, opt)
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = { spacing = 4, prefix = "●" },
|
||||
signs = true,
|
||||
underline = true,
|
||||
update_in_insert = true,
|
||||
severity_sort = true,
|
||||
})
|
||||
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||
end
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = "single",
|
||||
})
|
||||
--[[ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = "single",
|
||||
focusable = false,
|
||||
relative = "cursor",
|
||||
}) ]]
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
M = {}
|
||||
|
||||
vim.keymap.set("n", "<leader>o", "<cmd>Outline<CR>",
|
||||
{ desc = "Toggle Outline" })
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,15 @@
|
||||
M = {
|
||||
"lua_ls",
|
||||
"pyright",
|
||||
"gopls",
|
||||
"clangd",
|
||||
"rust_analyzer",
|
||||
"ts_ls",
|
||||
"jsonls",
|
||||
"cssls",
|
||||
"nil_ls",
|
||||
"html",
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
M = {
|
||||
bind = true, -- This is mandatory, otherwise border config won't get registered.
|
||||
handler_opts = {
|
||||
border = "rounded"
|
||||
},
|
||||
hint_prefix = "^ ",
|
||||
toggle_key = "<C-k>",
|
||||
}
|
||||
|
||||
vim.keymap.set({ 'n' }, '<leader>k', require('lsp_signature').toggle_float_win,
|
||||
{ silent = true, noremap = true, desc = 'toggle signature' })
|
||||
|
||||
vim.keymap.set({ 'n' }, 'K', vim.lsp.buf.signature_help,
|
||||
{ silent = true, noremap = true, desc = 'toggle signature' })
|
||||
|
||||
return M
|
||||
28
modules/coding/editor/neovim/nvim/lua/plugins/lualine.lua
Normal file
28
modules/coding/editor/neovim/nvim/lua/plugins/lualine.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
M = {
|
||||
options = {
|
||||
theme = "tokyonight"
|
||||
},
|
||||
sections = {
|
||||
lualine_y = {
|
||||
'encoding', 'fileformat', 'filetype',
|
||||
},
|
||||
lualine_x = {
|
||||
{
|
||||
require("noice").api.status.message.get_hl,
|
||||
cond = require("noice").api.status.message.has,
|
||||
},
|
||||
{
|
||||
require("noice").api.status.command.get,
|
||||
cond = require("noice").api.status.command.has,
|
||||
color = { fg = "#ff9e64" },
|
||||
},
|
||||
{
|
||||
require("noice").api.status.search.get,
|
||||
cond = require("noice").api.status.search.has,
|
||||
color = { fg = "#ff9e64" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,31 @@
|
||||
M = {}
|
||||
|
||||
vim.api.nvim_create_augroup("MarkdownPreviewAuto", {})
|
||||
|
||||
vim.api.nvim_create_user_command("MarkdownPreviewAutoEnable", function()
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
group = "MarkdownPreviewAuto",
|
||||
pattern = { "*.md" },
|
||||
desc = "Auto enable MarkdownPreview",
|
||||
callback = function()
|
||||
vim.cmd("MarkdownPreview")
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_create_autocmd("BufLeave", {
|
||||
group = "MarkdownPreviewAuto",
|
||||
pattern = { "*.md" },
|
||||
desc = "Auto disable MarkdownPreview",
|
||||
callback = function()
|
||||
vim.cmd("MarkdownPreviewStop")
|
||||
end,
|
||||
})
|
||||
end, { desc = "Auto enable MarkdownPreview" })
|
||||
|
||||
vim.api.nvim_create_user_command("MarkdownPreviewAutoDisable",
|
||||
function()
|
||||
vim.api.nvim_clear_autocmds({ group = "MarkdownPreviewAuto" })
|
||||
end, {}
|
||||
)
|
||||
|
||||
return M
|
||||
|
||||
4
modules/coding/editor/neovim/nvim/lua/plugins/neodev.lua
Normal file
4
modules/coding/editor/neovim/nvim/lua/plugins/neodev.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
M = {}
|
||||
|
||||
return M
|
||||
|
||||
21
modules/coding/editor/neovim/nvim/lua/plugins/nvim-tree.lua
Normal file
21
modules/coding/editor/neovim/nvim/lua/plugins/nvim-tree.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
M = {
|
||||
sync_root_with_cwd = true,
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
debounce_delay = 50,
|
||||
show_on_dirs = true
|
||||
},
|
||||
filters = {
|
||||
git_ignored = false
|
||||
}
|
||||
}
|
||||
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
local opt = require("core.globals").keymap_opt
|
||||
vim.keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>", opt)
|
||||
vim.keymap.set("n", "<leader>te", ":NvimTreeFocus<CR>", opt)
|
||||
|
||||
return M
|
||||
|
||||
302
modules/coding/editor/neovim/nvim/lua/plugins/plugins-setup.lua
Normal file
302
modules/coding/editor/neovim/nvim/lua/plugins/plugins-setup.lua
Normal file
@@ -0,0 +1,302 @@
|
||||
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",
|
||||
lazypath
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
package.path = package.path .. ";" .. vim.fn.stdpath("config") .. "/lua/"
|
||||
|
||||
local plugins = {
|
||||
{
|
||||
"folke/tokyonight.nvim",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.cmd.colorscheme("tokyonight-storm")
|
||||
end
|
||||
},
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
lazy = false,
|
||||
dependencies = { { "nvim-tree/nvim-web-devicons", lazy = true } },
|
||||
config = function()
|
||||
require("lualine").setup(require("plugins.lualine"))
|
||||
end
|
||||
},
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
lazy = false,
|
||||
dependencies = { { "nvim-tree/nvim-web-devicons", lazy = true } },
|
||||
config = function()
|
||||
require("nvim-tree").setup(require("plugins.nvim-tree"))
|
||||
end
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
lazy = false,
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
"nushell/tree-sitter-nu"
|
||||
},
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup(require("plugins.treesitter"))
|
||||
end,
|
||||
build = ":TSUpdate"
|
||||
},
|
||||
{
|
||||
url = "https://gitlab.com/HiPhish/rainbow-delimiters.nvim",
|
||||
lazy = false,
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("plugins.rainbow-delimiters")
|
||||
end
|
||||
},
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
lazy = false,
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("ibl").setup(require("plugins.indent-blankline"))
|
||||
end
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = { "hrsh7th/cmp-nvim-lsp" },
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("plugins.lsp.lspconfig")
|
||||
require("plugins.lsp.others")
|
||||
end
|
||||
},
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
cmd = "Trouble",
|
||||
keys = {
|
||||
{
|
||||
"<leader>xx",
|
||||
"<cmd>Trouble diagnostics toggle<cr>",
|
||||
desc = "Diagnostics (Trouble)",
|
||||
},
|
||||
{
|
||||
"<leader>xX",
|
||||
"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
|
||||
desc = "Buffer Diagnostics (Trouble)",
|
||||
},
|
||||
{
|
||||
"<leader>cs",
|
||||
"<cmd>Trouble symbols toggle focus=false<cr>",
|
||||
desc = "Symbols (Trouble)",
|
||||
},
|
||||
{
|
||||
"<leader>cl",
|
||||
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
|
||||
desc = "LSP Definitions / references / ... (Trouble)",
|
||||
},
|
||||
{
|
||||
"<leader>xL",
|
||||
"<cmd>Trouble loclist toggle<cr>",
|
||||
desc = "Location List (Trouble)",
|
||||
},
|
||||
{
|
||||
"<leader>xQ",
|
||||
"<cmd>Trouble qflist toggle<cr>",
|
||||
desc = "Quickfix List (Trouble)",
|
||||
},
|
||||
},
|
||||
opts = {}
|
||||
},
|
||||
{
|
||||
"MysticalDevil/inlay-hints.nvim",
|
||||
event = "LspAttach",
|
||||
dependencies = { "neovim/nvim-lspconfig" },
|
||||
config = function()
|
||||
require("inlay-hints").setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
"hedyhli/outline.nvim",
|
||||
event = "LspAttach",
|
||||
config = function()
|
||||
require("outline").setup(require("plugins.lsp.outline"))
|
||||
end,
|
||||
},
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
lazy = false,
|
||||
dependencies = { { "rafamadriz/friendly-snippets", lazy = true } },
|
||||
build = "make install_jsregexp",
|
||||
config = function()
|
||||
require("luasnip").setup(require("plugins.cmp.luasnip"))
|
||||
end
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"rafamadriz/friendly-snippets",
|
||||
"hrsh7th/cmp-path",
|
||||
"onsails/lspkind.nvim"
|
||||
},
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("cmp").setup(require("plugins.cmp.cmp"))
|
||||
end
|
||||
},
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
lazy = false,
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("Comment").setup(require("plugins.comment"))
|
||||
end
|
||||
},
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
lazy = false,
|
||||
event = "VeryLazy",
|
||||
dependencies = { "hrsh7th/nvim-cmp" },
|
||||
config = function()
|
||||
require("nvim-autopairs").setup(require("plugins.autopairs"))
|
||||
end
|
||||
},
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("bufferline").setup(require("plugins.bufferline"))
|
||||
end
|
||||
},
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
lazy = false,
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("gitsigns").setup(require("plugins.gitsigns"))
|
||||
end
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.2",
|
||||
dependencies = { "nvim-lua/plenary.nvim", "BurntSushi/ripgrep" },
|
||||
config = function()
|
||||
require("telescope").setup(require("plugins.telescope"))
|
||||
end
|
||||
},
|
||||
{
|
||||
"alexghergh/nvim-tmux-navigation",
|
||||
lazy = false,
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("nvim-tmux-navigation").setup(require("plugins.tmuxnav"))
|
||||
end
|
||||
},
|
||||
{
|
||||
"natecraddock/sessions.nvim",
|
||||
lazy = false,
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("sessions").setup(require("plugins.sessions"))
|
||||
end
|
||||
},
|
||||
{
|
||||
"natecraddock/workspaces.nvim",
|
||||
lazy = false,
|
||||
event = "VeryLazy",
|
||||
dependencies = { "nvim-telescope/telescope.nvim", "natecraddock/sessions.nvim" },
|
||||
config = function()
|
||||
require("workspaces").setup(require("plugins.workspaces"))
|
||||
require("telescope").load_extension("workspaces")
|
||||
end
|
||||
},
|
||||
--[[ {
|
||||
"iamcco/markdown-preview.nvim",
|
||||
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop", "MarkdownPreviewAutoEnable", "MarkdownPreviewAutoDisable" },
|
||||
ft = { "markdown" },
|
||||
build = function()
|
||||
vim.fn["mkdp#util#install"]()
|
||||
end,
|
||||
config = function()
|
||||
require("plugins.markdown-preview")
|
||||
end
|
||||
}, ]]
|
||||
--[[ {
|
||||
"dhruvasagar/vim-table-mode",
|
||||
lazy = true,
|
||||
event = "BufEnter *.md",
|
||||
config = function()
|
||||
require("plugins.table-mode")
|
||||
end
|
||||
}, ]]
|
||||
{
|
||||
"lukas-reineke/headlines.nvim",
|
||||
dependencies = "nvim-treesitter/nvim-treesitter",
|
||||
config = true, -- or `opts = {}`
|
||||
},
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
lazy = false,
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
"rcarriga/nvim-notify",
|
||||
},
|
||||
opts = {
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"voldikss/vim-floaterm",
|
||||
lazy = false,
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("plugins.floaterm")
|
||||
end
|
||||
},
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
lazy = false,
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"ojroques/nvim-osc52",
|
||||
event = "BufEnter",
|
||||
config = function()
|
||||
require("osc52").setup({
|
||||
tmux_passthrough = true
|
||||
})
|
||||
local function copy()
|
||||
if vim.v.event.operator == "y" and vim.v.event.regname == "+" then
|
||||
require("osc52").copy_register("+")
|
||||
end
|
||||
end
|
||||
vim.api.nvim_create_autocmd("TextYankPost", {callback = copy})
|
||||
end
|
||||
},
|
||||
{
|
||||
"pest-parser/pest.vim",
|
||||
event = "VeryLazy",
|
||||
opts = {}
|
||||
}
|
||||
}
|
||||
|
||||
local opts = {
|
||||
rocks = {
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
require("lazy").setup(plugins, opts)
|
||||
@@ -0,0 +1,21 @@
|
||||
local rainbow_delimiters = require("rainbow-delimiters")
|
||||
vim.g.rainbow_delimiters = {
|
||||
strategy = {
|
||||
[''] = rainbow_delimiters.strategy['global'],
|
||||
vim = rainbow_delimiters.strategy['local'],
|
||||
},
|
||||
query = {
|
||||
[''] = 'rainbow-delimiters',
|
||||
lua = 'rainbow-blocks',
|
||||
},
|
||||
highlight = {
|
||||
'RainbowDelimiterRed',
|
||||
'RainbowDelimiterYellow',
|
||||
'RainbowDelimiterBlue',
|
||||
'RainbowDelimiterOrange',
|
||||
'RainbowDelimiterGreen',
|
||||
'RainbowDelimiterViolet',
|
||||
'RainbowDelimiterCyan',
|
||||
},
|
||||
}
|
||||
|
||||
10
modules/coding/editor/neovim/nvim/lua/plugins/sessions.lua
Normal file
10
modules/coding/editor/neovim/nvim/lua/plugins/sessions.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
M = {
|
||||
events = { "VimLeavePre" },
|
||||
indent = {
|
||||
tab_char = "▏"
|
||||
},
|
||||
session_filepath = vim.fn.stdpath("data") .. "/session",
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
34
modules/coding/editor/neovim/nvim/lua/plugins/table-mode.lua
Normal file
34
modules/coding/editor/neovim/nvim/lua/plugins/table-mode.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
M = {}
|
||||
|
||||
vim.g.table_mode_corner = "|"
|
||||
|
||||
vim.api.nvim_create_augroup("TableModeAuto", {})
|
||||
|
||||
vim.api.nvim_create_user_command("TableModeAutoEnable", function()
|
||||
vim.api.nvim_clear_autocmds({ group = "TableModeAuto" })
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
group = "TableModeAuto",
|
||||
pattern = { "*.md" },
|
||||
desc = "Auto enable TableMode",
|
||||
callback = function()
|
||||
vim.cmd("TableModeEnable")
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_create_autocmd("BufWrite", {
|
||||
group = "TableModeAuto",
|
||||
pattern = { "*.md" },
|
||||
desc = "Auto enable TableMode",
|
||||
callback = function()
|
||||
vim.cmd("TableModeRealign")
|
||||
end,
|
||||
})
|
||||
end, { desc = "Auto enable TableMode" })
|
||||
|
||||
vim.api.nvim_create_user_command("TableModeAutoDisable",
|
||||
function()
|
||||
vim.api.nvim_clear_autocmds({ group = "TableModeAuto" })
|
||||
end, {}
|
||||
)
|
||||
|
||||
return M
|
||||
|
||||
45
modules/coding/editor/neovim/nvim/lua/plugins/telescope.lua
Normal file
45
modules/coding/editor/neovim/nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,45 @@
|
||||
M = {
|
||||
defaults = {
|
||||
winblend = 50,
|
||||
path_display = {
|
||||
"smart",
|
||||
shorten = 3
|
||||
}
|
||||
},
|
||||
pickers = {
|
||||
lsp_definitions = {
|
||||
theme = "cursor",
|
||||
layout_config = { width = 0.6, height = 0.3},
|
||||
},
|
||||
lsp_references = {
|
||||
theme = "cursor",
|
||||
layout_config = { width = 0.6, height = 0.3 },
|
||||
},
|
||||
current_buffer_fuzzy_find = {
|
||||
theme = "dropdown",
|
||||
layout_config = { height = 0.7, width = 0.55, preview_cutoff = 0 ,prompt_position = "top" }
|
||||
},
|
||||
lsp_document_symbols = {
|
||||
theme = "ivy",
|
||||
layout_config = { height = 0.25 }
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
local opt = require("core.globals").keymap_opt
|
||||
local keymap = vim.keymap
|
||||
local builtin = require('telescope.builtin')
|
||||
|
||||
keymap.set('n', '<leader>ff', builtin.find_files, opt)
|
||||
keymap.set('n', '<leader>gf', builtin.git_files, opt)
|
||||
keymap.set('n', '<leader>fg', builtin.live_grep, opt)
|
||||
keymap.set('n', '<leader>fb', builtin.buffers, opt)
|
||||
keymap.set('n', '<leader>fh', builtin.help_tags, opt)
|
||||
-- keymap.set('n', '<leader>lD', builtin.diagnostics, opt)
|
||||
keymap.set('n', '<leader>ld', builtin.lsp_definitions, opt)
|
||||
keymap.set('n', '<leader>lr', builtin.lsp_references, opt)
|
||||
keymap.set('n', '<leader>ls', builtin.lsp_document_symbols, opt)
|
||||
keymap.set('n', '<leader>/', builtin.current_buffer_fuzzy_find, opt)
|
||||
|
||||
return M
|
||||
|
||||
14
modules/coding/editor/neovim/nvim/lua/plugins/tmuxnav.lua
Normal file
14
modules/coding/editor/neovim/nvim/lua/plugins/tmuxnav.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
M = {}
|
||||
|
||||
local tmuxnav = require("nvim-tmux-navigation")
|
||||
local keymap = vim.keymap
|
||||
|
||||
keymap.set("n", "<C-H>", tmuxnav.NvimTmuxNavigateLeft)
|
||||
keymap.set("n", "<C-J>", tmuxnav.NvimTmuxNavigateDown)
|
||||
keymap.set("n", "<C-K>", tmuxnav.NvimTmuxNavigateUp)
|
||||
keymap.set("n", "<C-L>", tmuxnav.NvimTmuxNavigateRight)
|
||||
keymap.set("n", "<C-\\>", tmuxnav.NvimTmuxNavigateLastActive)
|
||||
keymap.set("n", "<C-Space>", tmuxnav.NvimTmuxNavigateNext)
|
||||
|
||||
return M
|
||||
|
||||
20
modules/coding/editor/neovim/nvim/lua/plugins/treesitter.lua
Normal file
20
modules/coding/editor/neovim/nvim/lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
M = {
|
||||
auto_install = true,
|
||||
parser_install_dir = "$HOME/.local/share/nvim/lazy/nvim-treesitter",
|
||||
sync_install = true,
|
||||
modules = {},
|
||||
ignore_install = {},
|
||||
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true }
|
||||
}
|
||||
|
||||
vim.filetype.add({
|
||||
pattern = {
|
||||
[".*/hypr/.*%.conf"] = "hyprlang",
|
||||
[".*%.hl"] = "hyprlang"
|
||||
},
|
||||
})
|
||||
|
||||
return M
|
||||
|
||||
14
modules/coding/editor/neovim/nvim/lua/plugins/workspaces.lua
Normal file
14
modules/coding/editor/neovim/nvim/lua/plugins/workspaces.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
M = {
|
||||
hooks = {
|
||||
open = function ()
|
||||
require("core.globals").close_empty_buffer()
|
||||
vim.cmd("enew")
|
||||
vim.cmd("bufdo bd")
|
||||
require("sessions").load(nil, { silent = true })
|
||||
vim.cmd("NvimTreeFocus")
|
||||
end
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
30
modules/coding/editor/vscode/default.nix
Normal file
30
modules/coding/editor/vscode/default.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
lib.my.makeHomeProgramConfig {
|
||||
inherit config;
|
||||
programName = "neovim";
|
||||
optionPath = [
|
||||
"coding"
|
||||
"editor"
|
||||
"vscode"
|
||||
];
|
||||
extraConfig = {
|
||||
my.home = {
|
||||
programs.vscode = {
|
||||
enable = true;
|
||||
package = pkgs.vscodium;
|
||||
profiles.default = {
|
||||
extensions = with pkgs.open-vsx; [
|
||||
eamodio.gitlens
|
||||
rust-lang.rust-analyzer
|
||||
dbaeumer.vscode-eslint
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user