initial commit
This commit is contained in:
commit
24d5bcc047
38
init.lua
Normal file
38
init.lua
Normal file
@ -0,0 +1,38 @@
|
||||
local config_path = vim.fn.stdpath("config")
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
local plugins = {}
|
||||
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
|
||||
map = vim.keymap.set
|
||||
function plugin(spec)
|
||||
table.insert(plugins, spec)
|
||||
end
|
||||
|
||||
for _, file in ipairs(vim.fn.readdir(config_path .. "/lua", [[v:val =~ '\.lua$']])) do
|
||||
require(file:gsub("%.lua$", ""))
|
||||
end
|
||||
|
||||
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)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
plugins,
|
||||
},
|
||||
install = { colorscheme = { "habamax" } },
|
||||
checker = { enabled = true },
|
||||
})
|
||||
30
lazy-lock.json
Normal file
30
lazy-lock.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"CopilotChat.nvim": { "branch": "main", "commit": "df5376c132382dd47e3e552612940cbf25b3580c" },
|
||||
"LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" },
|
||||
"blink-cmp-copilot": { "branch": "main", "commit": "439cff78780c033aa23cf061d7315314b347e3c1" },
|
||||
"blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" },
|
||||
"conform.nvim": { "branch": "master", "commit": "ffe26e8df8115c9665d24231f8a49fadb2d611ce" },
|
||||
"copilot.lua": { "branch": "master", "commit": "881f99b827d65b41f522eecc21b112cf518028ac" },
|
||||
"elixir-tools.nvim": { "branch": "main", "commit": "b51b48edc668924a6b2f6610f9a0aff34741d20e" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "5813e4878748805f1518cee7abb50fd7205a3a48" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "f7c6e585fd80d5a2c075ab27ac312ac55bcf1550" },
|
||||
"nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "72d54c31079d38d8dfc5456131b1d0fb5c0264b0" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
|
||||
"obsidian.nvim": { "branch": "main", "commit": "4065c233f618cdbfbf084d87e97317f8d019ef59" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
|
||||
"ranger.nvim": { "branch": "main", "commit": "fd2cc999f3ef88f7cdcbcad5f26000c52b16c489" },
|
||||
"rustaceanvim": { "branch": "master", "commit": "6c3785d6a230bec63f70c98bf8e2842bed924245" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" },
|
||||
"tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "38b06435305c30966b7ceb0a43e460dc43acaada" },
|
||||
"tmux-status.nvim": { "branch": "main", "commit": "d985ba67132269dedc9a5f6479f2d40f10e06315" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" },
|
||||
"vim-abolish": { "branch": "master", "commit": "dcbfe065297d31823561ba787f51056c147aa682" },
|
||||
"vim-test": { "branch": "master", "commit": "1eeb12774a0f251571700ccf68da27789b2f0852" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
|
||||
}
|
||||
45
lua/_blink.lua
Normal file
45
lua/_blink.lua
Normal file
@ -0,0 +1,45 @@
|
||||
plugin({
|
||||
"saghen/blink.cmp",
|
||||
dependencies = { "rafamadriz/friendly-snippets" },
|
||||
version = "1.*",
|
||||
opts = {
|
||||
-- keymap = { preset = "super-tab" },
|
||||
keymap = { preset = "enter" },
|
||||
signature = { enabled = true },
|
||||
|
||||
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 = true } },
|
||||
|
||||
-- Default list of enabled providers defined so that you can extend it
|
||||
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
||||
sources = {
|
||||
default = { "obsidian", "obsidian_new", "obsidian_tags", "lsp", "path", "snippets", "buffer", "copilot" },
|
||||
-- default = { "obsidian", "obsidian_new", "obsidian_tags", "lsp", "path", "snippets", "buffer" },
|
||||
providers = {
|
||||
snippets = {
|
||||
score_offset = 100,
|
||||
},
|
||||
copilot = {
|
||||
name = "copilot",
|
||||
module = "blink-cmp-copilot",
|
||||
score_offset = 50,
|
||||
async = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- (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" },
|
||||
},
|
||||
opts_extend = { "sources.default" },
|
||||
})
|
||||
46
lua/_copilot.lua
Normal file
46
lua/_copilot.lua
Normal file
@ -0,0 +1,46 @@
|
||||
plugin({
|
||||
lazy = false,
|
||||
"CopilotC-Nvim/CopilotChat.nvim",
|
||||
dependencies = {
|
||||
{ "zbirenbaum/copilot.lua" }, -- or zbirenbaum/copilot.lua
|
||||
{ "nvim-lua/plenary.nvim", branch = "master" }, -- for curl, log and async functions
|
||||
},
|
||||
build = "make tiktoken", -- Only on MacOS or Linux
|
||||
opts = {
|
||||
-- See Configuration section for options
|
||||
},
|
||||
-- See Commands section for default commands if you want to lazy load on them
|
||||
})
|
||||
plugin({
|
||||
"zbirenbaum/copilot.lua",
|
||||
cmd = "Copilot",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("copilot").setup({
|
||||
suggestion = { enabled = true },
|
||||
panel = { enabled = false },
|
||||
})
|
||||
end,
|
||||
})
|
||||
plugin({
|
||||
"giuxtaposition/blink-cmp-copilot",
|
||||
dependencies = {
|
||||
{ "zbirenbaum/copilot.lua" },
|
||||
},
|
||||
})
|
||||
|
||||
map("n", "<leader>ac", function()
|
||||
require("CopilotChat").open()
|
||||
end, { desc = "Copilot chat" })
|
||||
|
||||
map("n", "<leader>ap", function()
|
||||
require("copilot.panel").open()
|
||||
end, { desc = "Copilot chat" })
|
||||
|
||||
map("v", "<leader>ad", function()
|
||||
require("CopilotChat").ask("Create documentation for this code")
|
||||
end, { desc = "Copilot chat" })
|
||||
|
||||
map("v", "<leader>at", function()
|
||||
require("CopilotChat").ask("#buffer:active Write tests for this code")
|
||||
end, { desc = "Copilot chat" })
|
||||
36
lua/_elixir.lua
Normal file
36
lua/_elixir.lua
Normal file
@ -0,0 +1,36 @@
|
||||
plugin({
|
||||
"elixir-tools/elixir-tools.nvim",
|
||||
version = "*",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
local elixir = require("elixir")
|
||||
local elixirls = require("elixir.elixirls")
|
||||
|
||||
elixir.setup({
|
||||
-- nextls = { enable = true },
|
||||
elixirls = {
|
||||
enable = true,
|
||||
cmd = "elixir-ls",
|
||||
settings = elixirls.settings({
|
||||
dialyzerEnabled = true,
|
||||
enableTestLenses = true,
|
||||
}),
|
||||
on_attach = function(client, bufnr)
|
||||
vim.keymap.set("n", "<space>fp", ":ElixirFromPipe<cr>", { buffer = true, noremap = true })
|
||||
vim.keymap.set("n", "<space>tp", ":ElixirToPipe<cr>", { buffer = true, noremap = true })
|
||||
vim.keymap.set("v", "<space>em", ":ElixirExpandMacro<cr>", { buffer = true, noremap = true })
|
||||
end,
|
||||
},
|
||||
projectionist = {
|
||||
enable = true,
|
||||
},
|
||||
})
|
||||
end,
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
})
|
||||
|
||||
map("n", "<leader>cr", function()
|
||||
vim.lsp.codelens.run()
|
||||
end)
|
||||
17
lua/_lsp.lua
Normal file
17
lua/_lsp.lua
Normal file
@ -0,0 +1,17 @@
|
||||
plugin({
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
-- lspconfig.nextls.setup({
|
||||
-- cmd = { "nextls" },
|
||||
-- })
|
||||
-- lspconfig.elixirls.setup({
|
||||
-- cmd = { "elixir-ls" },
|
||||
-- })
|
||||
-- lspconfig.lexical.setup({
|
||||
-- cmd = { "lexical" },
|
||||
-- })
|
||||
end,
|
||||
})
|
||||
|
||||
-- vim.lsp.enable("lexical")
|
||||
vim.lsp.enable("pyright")
|
||||
157
lua/_lualine.lua
Normal file
157
lua/_lualine.lua
Normal file
@ -0,0 +1,157 @@
|
||||
plugin({
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"christopher-francisco/tmux-status.nvim",
|
||||
},
|
||||
config = function()
|
||||
-- Eviline config for lualine
|
||||
-- Author: shadmansaleh
|
||||
-- Credit: glepnir
|
||||
local lualine = require("lualine")
|
||||
|
||||
local colors = {
|
||||
bg = "none",
|
||||
fg = "#bbc2cf",
|
||||
yellow = "#ECBE7B",
|
||||
cyan = "#008080",
|
||||
darkblue = "#081633",
|
||||
green = "#98be65",
|
||||
orange = "#FF8800",
|
||||
violet = "#a9a1e1",
|
||||
magenta = "#c678dd",
|
||||
blue = "#51afef",
|
||||
red = "#ec5f67",
|
||||
}
|
||||
|
||||
local conditions = {
|
||||
buffer_not_empty = function()
|
||||
return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
|
||||
end,
|
||||
hide_in_width = function()
|
||||
return vim.fn.winwidth(0) > 80
|
||||
end,
|
||||
check_git_workspace = function()
|
||||
local filepath = vim.fn.expand("%:p:h")
|
||||
local gitdir = vim.fn.finddir(".git", filepath .. ";")
|
||||
return gitdir and #gitdir > 0 and #gitdir < #filepath
|
||||
end,
|
||||
}
|
||||
|
||||
local theme = require("lualine.themes.tokyonight")
|
||||
theme.normal.c.bg = "None"
|
||||
theme.inactive.c.bg = "None"
|
||||
vim.cmd("hi StatusLine guibg=NONE ctermbg=NONE")
|
||||
vim.cmd("hi StatusLineNC guibg=NONE ctermbg=NONE")
|
||||
|
||||
-- Config
|
||||
local config = {
|
||||
options = {
|
||||
-- Disable sections and component separators
|
||||
component_separators = "",
|
||||
section_separators = "",
|
||||
theme = theme,
|
||||
},
|
||||
sections = {
|
||||
-- these are to remove the defaults
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
-- These will be filled later
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
},
|
||||
inactive_sections = {
|
||||
-- these are to remove the defaults
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
},
|
||||
}
|
||||
|
||||
-- Inserts a component in lualine_c at left section
|
||||
local function ins_left(component)
|
||||
table.insert(config.sections.lualine_c, component)
|
||||
end
|
||||
|
||||
-- Inserts a component in lualine_x at right section
|
||||
local function ins_right(component)
|
||||
table.insert(config.sections.lualine_x, component)
|
||||
end
|
||||
|
||||
ins_left({
|
||||
"filetype",
|
||||
})
|
||||
|
||||
ins_left({
|
||||
-- filesize component
|
||||
"filesize",
|
||||
cond = conditions.buffer_not_empty,
|
||||
})
|
||||
|
||||
ins_left({ "location" })
|
||||
|
||||
ins_left({ "progress", color = { fg = colors.fg, gui = "bold" } })
|
||||
|
||||
ins_left({
|
||||
"diagnostics",
|
||||
sources = { "nvim_diagnostic" },
|
||||
symbols = { error = " ", warn = " ", info = " " },
|
||||
diagnostics_color = {
|
||||
error = { fg = colors.red },
|
||||
warn = { fg = colors.yellow },
|
||||
info = { fg = colors.cyan },
|
||||
},
|
||||
})
|
||||
|
||||
ins_left({
|
||||
function()
|
||||
return "%="
|
||||
end,
|
||||
})
|
||||
|
||||
ins_left({
|
||||
"filename",
|
||||
cond = conditions.buffer_not_empty,
|
||||
path = 1,
|
||||
color = { fg = colors.magenta, gui = "bold" },
|
||||
})
|
||||
|
||||
ins_right({
|
||||
"lsp_status",
|
||||
})
|
||||
|
||||
ins_right({
|
||||
"branch",
|
||||
icon = "",
|
||||
color = { fg = colors.violet, gui = "bold" },
|
||||
})
|
||||
|
||||
ins_right({
|
||||
"diff",
|
||||
-- Is it me or the symbol for modified us really weird
|
||||
symbols = { added = " ", modified = " ", removed = " " },
|
||||
diff_color = {
|
||||
added = { fg = colors.green },
|
||||
modified = { fg = colors.orange },
|
||||
removed = { fg = colors.red },
|
||||
},
|
||||
cond = conditions.hide_in_width,
|
||||
})
|
||||
|
||||
ins_right({
|
||||
function()
|
||||
return "▊"
|
||||
end,
|
||||
color = { fg = colors.blue },
|
||||
padding = { left = 1 },
|
||||
})
|
||||
|
||||
-- Now don't forget to initialize lualine
|
||||
lualine.setup(config)
|
||||
end,
|
||||
})
|
||||
104
lua/_obsidian.lua
Normal file
104
lua/_obsidian.lua
Normal file
@ -0,0 +1,104 @@
|
||||
vim.opt.conceallevel = 1
|
||||
|
||||
plugin({
|
||||
"obsidian-nvim/obsidian.nvim",
|
||||
version = "*", -- recommended, use latest release instead of latest commit
|
||||
lazy = false,
|
||||
ft = "markdown",
|
||||
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
|
||||
-- event = {
|
||||
-- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
|
||||
-- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md"
|
||||
-- -- refer to `:h file-pattern` for more examples
|
||||
-- "BufReadPre path/to/my-vault/*.md",
|
||||
-- "BufNewFile path/to/my-vault/*.md",
|
||||
-- },
|
||||
dependencies = {
|
||||
-- Required.
|
||||
"nvim-lua/plenary.nvim",
|
||||
|
||||
-- see below for full list of optional dependencies 👇
|
||||
},
|
||||
opts = {
|
||||
legacy_commands = false,
|
||||
workspaces = {
|
||||
{
|
||||
name = "personal",
|
||||
path = "~/Documents/obsidian/Personal",
|
||||
},
|
||||
{
|
||||
name = "Quikserve",
|
||||
path = "~/Documents/obsidian/Quikserve",
|
||||
},
|
||||
{
|
||||
name = "Visage",
|
||||
path = "~/Documents/obsidian/Visage",
|
||||
},
|
||||
},
|
||||
notes_subdir = "notes",
|
||||
new_notes_location = "notes_subdir",
|
||||
note_id_func = function(title)
|
||||
-- Create note IDs in a Zettelkasten format with a timestamp and a suffix.
|
||||
-- In this case a note with the title 'My new note' will be given an ID that looks
|
||||
-- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md'.
|
||||
-- You may have as many periods in the note ID as you'd like—the ".md" will be added automatically
|
||||
local suffix = ""
|
||||
if title ~= nil then
|
||||
-- If title is given, transform it into valid file name.
|
||||
suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower()
|
||||
else
|
||||
-- If title is nil, just add 4 random uppercase letters to the suffix
|
||||
for _ = 1, 4 do
|
||||
suffix = suffix .. string.char(math.random(65, 90))
|
||||
end
|
||||
end
|
||||
prefix = os.date("%Y%m%d%H%M")
|
||||
return tostring(prefix .. "-" .. suffix)
|
||||
end,
|
||||
daily_notes = {
|
||||
-- Optional, if you keep daily notes in a separate directory.
|
||||
folder = "dailies",
|
||||
-- Optional, if you want to change the date format for the ID of daily notes.
|
||||
date_format = "%Y-%m-%d",
|
||||
-- Optional, if you want to change the date format of the default alias of daily notes.
|
||||
alias_format = "%B %-d, %Y",
|
||||
-- Optional, default tags to add to each new daily note created.
|
||||
default_tags = { "daily-notes" },
|
||||
-- Optional, if you want to automatically insert a template from your template directory like 'daily.md'
|
||||
template = "daily",
|
||||
},
|
||||
templates = {
|
||||
folder = "templates",
|
||||
date_format = "%Y-%m-%d-%a",
|
||||
time_format = "%H:%M",
|
||||
},
|
||||
completion = {
|
||||
blink = true,
|
||||
},
|
||||
picker = {
|
||||
-- Set your preferred picker. Can be one of 'telescope.nvim', 'fzf-lua', or 'mini.pick'.
|
||||
name = "snacks.pick",
|
||||
-- Optional, configure key mappings for the picker. These are the defaults.
|
||||
-- Not all pickers support all mappings.
|
||||
note_mappings = {
|
||||
-- Create a new note from your query.
|
||||
new = "<C-x>",
|
||||
-- Insert a link to the selected note.
|
||||
insert_link = "<C-l>",
|
||||
},
|
||||
tag_mappings = {
|
||||
-- Add tag(s) to current note.
|
||||
tag_note = "<C-x>",
|
||||
-- Insert a tag at the current location.
|
||||
insert_tag = "<C-l>",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
map("n", "<leader>ot", "<cmd>:Obsidian today<cr>", { desc = "Today Note" })
|
||||
map("n", "<leader>on", "<cmd>:Obsidian new<cr>", { desc = "New Note" })
|
||||
map("n", "<leader>oN", "<cmd>:Obsidian new_from_template<cr>", { desc = "New From Template" })
|
||||
map("n", "<leader>ow", "<cmd>:Obsidian workspace<cr>", { desc = "Change Workspace" })
|
||||
map("n", "<leader>oo", "<cmd>::Obsidian quick_switch<cr>", { desc = "Find Note" })
|
||||
map("n", "<leader>os", "<cmd>!./sync.sh<cr>", { desc = "Sync" })
|
||||
4
lua/_rust.lua
Normal file
4
lua/_rust.lua
Normal file
@ -0,0 +1,4 @@
|
||||
plugin({
|
||||
"mrcjkb/rustaceanvim",
|
||||
lazy = false, -- This plugin is already lazy
|
||||
})
|
||||
323
lua/_snacks.lua
Normal file
323
lua/_snacks.lua
Normal file
@ -0,0 +1,323 @@
|
||||
plugin({
|
||||
"folke/snacks.nvim",
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
---@type snacks.Config
|
||||
opts = {
|
||||
bigfile = { enabled = true },
|
||||
dashboard = { enabled = true },
|
||||
explorer = { enabled = true },
|
||||
indent = { enabled = true },
|
||||
input = { enabled = true },
|
||||
notifier = {
|
||||
enabled = true,
|
||||
timeout = 3000,
|
||||
},
|
||||
picker = { enabled = true, ui_select = true },
|
||||
quickfile = { enabled = true },
|
||||
scope = { enabled = true },
|
||||
scroll = { enabled = true },
|
||||
statuscolumn = {
|
||||
enabled = true,
|
||||
left = { "mark", "sign" }, -- priority of signs on the left (high to low)
|
||||
right = { "fold", "git" }, -- priority of signs on the right (high to low)
|
||||
folds = {
|
||||
open = true, -- show open fold icons
|
||||
git_hl = true, -- use Git Signs hl for fold icons
|
||||
},
|
||||
git = {
|
||||
-- patterns to match Git signs
|
||||
patterns = { "GitSign", "MiniDiffSign" },
|
||||
},
|
||||
refresh = 50, -- refresh at most every 50ms
|
||||
},
|
||||
words = { enabled = true },
|
||||
styles = {
|
||||
notification = {
|
||||
-- wo = { wrap = true } -- Wrap notifications
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
-- Top Pickers & Explorer
|
||||
{
|
||||
"<leader><space>",
|
||||
function()
|
||||
Snacks.picker.smart({
|
||||
multi = { "buffers", "recent", "files" },
|
||||
format = "file", -- use `file` format for all sources
|
||||
matcher = {
|
||||
cwd_bonus = true, -- boost cwd matches
|
||||
frecency = true, -- use frecency boosting
|
||||
sort_empty = true, -- sort even when the filter is empty
|
||||
},
|
||||
transform = "unique_file",
|
||||
})
|
||||
end,
|
||||
desc = "Smart Find Files",
|
||||
},
|
||||
{
|
||||
"<leader>,",
|
||||
function()
|
||||
Snacks.picker.buffers()
|
||||
end,
|
||||
desc = "Buffers",
|
||||
},
|
||||
{
|
||||
"<leader>/",
|
||||
function()
|
||||
Snacks.picker.grep()
|
||||
end,
|
||||
desc = "Grep",
|
||||
},
|
||||
{
|
||||
"<leader>n",
|
||||
function()
|
||||
Snacks.picker.notifications()
|
||||
end,
|
||||
desc = "Notification History",
|
||||
},
|
||||
{
|
||||
"<leader>e",
|
||||
function()
|
||||
Snacks.picker.explorer({
|
||||
auto_close = true,
|
||||
})
|
||||
end,
|
||||
desc = "File Explorer",
|
||||
},
|
||||
{
|
||||
"<leader>ff",
|
||||
function()
|
||||
Snacks.picker.files()
|
||||
end,
|
||||
desc = "Find Files",
|
||||
},
|
||||
{
|
||||
"<leader>fp",
|
||||
function()
|
||||
Snacks.picker.projects()
|
||||
end,
|
||||
desc = "Projects",
|
||||
},
|
||||
{
|
||||
"<leader>fr",
|
||||
function()
|
||||
Snacks.picker.recent()
|
||||
end,
|
||||
desc = "Recent",
|
||||
},
|
||||
-- Grep
|
||||
{
|
||||
"<leader>sb",
|
||||
function()
|
||||
Snacks.picker.lines()
|
||||
end,
|
||||
desc = "Buffer Lines",
|
||||
},
|
||||
{
|
||||
"<leader>bB",
|
||||
function()
|
||||
Snacks.picker.grep_buffers()
|
||||
end,
|
||||
desc = "Grep Open Buffers",
|
||||
},
|
||||
{
|
||||
"<leader>sg",
|
||||
function()
|
||||
Snacks.picker.grep()
|
||||
end,
|
||||
desc = "Grep",
|
||||
},
|
||||
{
|
||||
"<leader>sw",
|
||||
function()
|
||||
Snacks.picker.grep_word()
|
||||
end,
|
||||
desc = "Visual selection or word",
|
||||
mode = { "n", "x" },
|
||||
},
|
||||
-- search
|
||||
{
|
||||
"<leader>s/",
|
||||
function()
|
||||
Snacks.picker.search_history()
|
||||
end,
|
||||
desc = "Search History",
|
||||
},
|
||||
{
|
||||
"<leader>sb",
|
||||
function()
|
||||
Snacks.picker.lines()
|
||||
end,
|
||||
desc = "Buffer Lines",
|
||||
},
|
||||
{
|
||||
"<leader>sc",
|
||||
function()
|
||||
Snacks.picker.commands()
|
||||
end,
|
||||
desc = "Commands",
|
||||
},
|
||||
{
|
||||
"<leader>sd",
|
||||
function()
|
||||
Snacks.picker.diagnostics()
|
||||
end,
|
||||
desc = "Diagnostics",
|
||||
},
|
||||
{
|
||||
"<leader>sD",
|
||||
function()
|
||||
Snacks.picker.diagnostics_buffer()
|
||||
end,
|
||||
desc = "Buffer Diagnostics",
|
||||
},
|
||||
{
|
||||
"<leader>si",
|
||||
function()
|
||||
Snacks.picker.icons()
|
||||
end,
|
||||
desc = "Icons",
|
||||
},
|
||||
{
|
||||
"<leader>uC",
|
||||
function()
|
||||
Snacks.picker.colorschemes()
|
||||
end,
|
||||
desc = "Colorschemes",
|
||||
},
|
||||
-- LSP
|
||||
{
|
||||
"gd",
|
||||
function()
|
||||
Snacks.picker.lsp_definitions()
|
||||
end,
|
||||
desc = "Goto Definition",
|
||||
},
|
||||
{
|
||||
"gD",
|
||||
function()
|
||||
Snacks.picker.lsp_declarations()
|
||||
end,
|
||||
desc = "Goto Declaration",
|
||||
},
|
||||
{
|
||||
"gr",
|
||||
function()
|
||||
Snacks.picker.lsp_references()
|
||||
end,
|
||||
nowait = true,
|
||||
desc = "References",
|
||||
},
|
||||
{
|
||||
"gI",
|
||||
function()
|
||||
Snacks.picker.lsp_implementations()
|
||||
end,
|
||||
desc = "Goto Implementation",
|
||||
},
|
||||
{
|
||||
"gy",
|
||||
function()
|
||||
Snacks.picker.lsp_type_definitions()
|
||||
end,
|
||||
desc = "Goto T[y]pe Definition",
|
||||
},
|
||||
{
|
||||
"<leader>ss",
|
||||
function()
|
||||
Snacks.picker.lsp_symbols()
|
||||
end,
|
||||
desc = "LSP Symbols",
|
||||
},
|
||||
{
|
||||
"<leader>sS",
|
||||
function()
|
||||
Snacks.picker.lsp_workspace_symbols()
|
||||
end,
|
||||
desc = "LSP Workspace Symbols",
|
||||
},
|
||||
-- Other
|
||||
{
|
||||
"<leader>z",
|
||||
function()
|
||||
Snacks.zen()
|
||||
end,
|
||||
desc = "Toggle Zen Mode",
|
||||
},
|
||||
{
|
||||
"<leader>.",
|
||||
function()
|
||||
Snacks.scratch()
|
||||
end,
|
||||
desc = "Toggle Scratch Buffer",
|
||||
},
|
||||
{
|
||||
"<leader>S",
|
||||
function()
|
||||
Snacks.scratch.select()
|
||||
end,
|
||||
desc = "Select Scratch Buffer",
|
||||
},
|
||||
{
|
||||
"<leader>n",
|
||||
function()
|
||||
Snacks.notifier.show_history()
|
||||
end,
|
||||
desc = "Notification History",
|
||||
},
|
||||
{
|
||||
"<leader>cR",
|
||||
function()
|
||||
Snacks.rename.rename_file()
|
||||
end,
|
||||
desc = "Rename File",
|
||||
},
|
||||
{
|
||||
"<leader>gg",
|
||||
function()
|
||||
Snacks.lazygit()
|
||||
end,
|
||||
desc = "Lazygit",
|
||||
},
|
||||
{
|
||||
"<leader>un",
|
||||
function()
|
||||
Snacks.notifier.hide()
|
||||
end,
|
||||
desc = "Dismiss All Notifications",
|
||||
},
|
||||
{
|
||||
"<c-/>",
|
||||
function()
|
||||
Snacks.terminal()
|
||||
end,
|
||||
desc = "Toggle Terminal",
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "VeryLazy",
|
||||
callback = function()
|
||||
-- Setup some globals for debugging (lazy-loaded)
|
||||
_G.dd = function(...)
|
||||
Snacks.debug.inspect(...)
|
||||
end
|
||||
_G.bt = function()
|
||||
Snacks.debug.backtrace()
|
||||
end
|
||||
vim.print = _G.dd -- Override print to use snacks for `:=` command
|
||||
|
||||
-- Create some toggle mappings
|
||||
Snacks.toggle.option("spell", { name = "Spelling" }):map("<leader>ts")
|
||||
Snacks.toggle.option("wrap", { name = "Wrap" }):map("<leader>uw")
|
||||
Snacks.toggle.diagnostics():map("<leader>ud")
|
||||
Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("<leader>uL")
|
||||
Snacks.toggle.line_number():map("<leader>ul")
|
||||
Snacks.toggle.inlay_hints():map("<leader>uh")
|
||||
Snacks.toggle.dim():map("<leader>uD")
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
26
lua/_treesitter.lua
Normal file
26
lua/_treesitter.lua
Normal file
@ -0,0 +1,26 @@
|
||||
plugin({
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
branch = "master",
|
||||
lazy = false,
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
"elixir",
|
||||
"eex",
|
||||
"heex",
|
||||
"json",
|
||||
"javascript",
|
||||
"css",
|
||||
"scss",
|
||||
"lua",
|
||||
"rust",
|
||||
"python",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
},
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
})
|
||||
end,
|
||||
})
|
||||
11
lua/aichat.lua
Normal file
11
lua/aichat.lua
Normal file
@ -0,0 +1,11 @@
|
||||
map("n", "<leader>aa", function()
|
||||
Snacks.input.input({ prompt = "Enter prompt" }, function(value)
|
||||
if value ~= nil then
|
||||
vim.cmd(":read !aichat -c " .. value .. " /nothink")
|
||||
-- local output = vim.fn.system("!aichat -c " .. value .. " /nothink")
|
||||
-- local lines = vim.split(output, "\n", { plain = true })
|
||||
-- local bufnr = target_bufnr or vim.api.nvim_get_current_buf()
|
||||
-- vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
2
lua/clipboard.lua
Normal file
2
lua/clipboard.lua
Normal file
@ -0,0 +1,2 @@
|
||||
vim.api.nvim_set_option("clipboard", "unnamed")
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
128
lua/editor.lua
Normal file
128
lua/editor.lua
Normal file
@ -0,0 +1,128 @@
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
|
||||
vim.opt.number = true
|
||||
vim.o.relativenumber = true
|
||||
vim.o.numberwidth = 2
|
||||
vim.o.ruler = false
|
||||
|
||||
vim.opt.autoindent = smartindent
|
||||
vim.opt.syntax = enable
|
||||
|
||||
vim.o.cursorline = true
|
||||
vim.o.cursorlineopt = "number"
|
||||
vim.o.ignorecase = true
|
||||
vim.o.smartcase = true
|
||||
vim.o.mouse = "a"
|
||||
|
||||
vim.o.cmdheight = 0
|
||||
vim.opt.laststatus = 0
|
||||
|
||||
-- vim.opt.foldmethod = "expr"
|
||||
-- vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
vim.o.foldcolumn = "1" -- '0' is not bad
|
||||
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
|
||||
vim.o.foldlevelstart = 99
|
||||
vim.o.foldenable = true
|
||||
|
||||
vim.opt.fillchars = { eob = " " }
|
||||
|
||||
vim.o.undofile = true
|
||||
|
||||
plugin({
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
keys = {
|
||||
{
|
||||
"<leader>?",
|
||||
function()
|
||||
require("which-key").show({ global = false })
|
||||
end,
|
||||
desc = "Buffer Local Keymaps (which-key)",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
plugin({
|
||||
"lewis6991/gitsigns.nvim",
|
||||
})
|
||||
|
||||
plugin({
|
||||
"tpope/vim-abolish",
|
||||
})
|
||||
|
||||
plugin({
|
||||
{
|
||||
"kevinhwang91/nvim-ufo",
|
||||
dependencies = {
|
||||
{ "kevinhwang91/promise-async" },
|
||||
},
|
||||
config = function()
|
||||
require("ufo").setup({
|
||||
provider_selector = function(bufnr, filetype, buftype)
|
||||
return { "treesitter", "indent" }
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
plugin({
|
||||
"vim-test/vim-test",
|
||||
})
|
||||
|
||||
map("n", "<leader>tt", "<cmd>:TestNearest<cr>", { desc = "Test Nearest" })
|
||||
|
||||
plugin({
|
||||
"kelly-lin/ranger.nvim",
|
||||
config = function()
|
||||
require("ranger-nvim").setup({ replace_netrw = true })
|
||||
vim.api.nvim_set_keymap("n", "<leader>ff", "", {
|
||||
noremap = true,
|
||||
callback = function()
|
||||
require("ranger-nvim").open(true)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
plugin({
|
||||
"rachartier/tiny-inline-diagnostic.nvim",
|
||||
event = "VeryLazy", -- Or `LspAttach`
|
||||
priority = 1000, -- needs to be loaded in first
|
||||
config = function()
|
||||
require("tiny-inline-diagnostic").setup()
|
||||
vim.diagnostic.config({ virtual_text = false }) -- Only if needed in your configuration, if you already have native LSP diagnostics
|
||||
end,
|
||||
})
|
||||
|
||||
map("n", "<leader>x", function()
|
||||
Snacks.bufdelete()
|
||||
end, { desc = "Delete Buffer" })
|
||||
map("n", "<Esc>", "<cmd>noh<CR>", { desc = "general clear highlights" })
|
||||
|
||||
map("n", "dm", function()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local cur_line = vim.fn.line(".")
|
||||
---@type { mark: string, pos: number[] }[]
|
||||
local all_marks_local = vim.fn.getmarklist(bufnr)
|
||||
for _, mark in ipairs(all_marks_local) do
|
||||
if mark.pos[2] == cur_line and string.match(mark.mark, "'[a-z]") then
|
||||
vim.notify("Deleting mark: " .. string.sub(mark.mark, 2, 2))
|
||||
vim.api.nvim_buf_del_mark(bufnr, string.sub(mark.mark, 2, 2))
|
||||
end
|
||||
end
|
||||
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
||||
---@type { file: string, mark: string, pos: number[] }[]
|
||||
local all_marks_global = vim.fn.getmarklist()
|
||||
for _, mark in ipairs(all_marks_global) do
|
||||
local expanded_file_name = vim.fn.fnamemodify(mark.file, ":p")
|
||||
if bufname == expanded_file_name and mark.pos[2] == cur_line and string.match(mark.mark, "'[A-Z]") then
|
||||
vim.notify("Deleting mark: " .. string.sub(mark.mark, 2, 2))
|
||||
vim.api.nvim_del_mark(string.sub(mark.mark, 2, 2))
|
||||
end
|
||||
end
|
||||
end, { desc = "delete marks" })
|
||||
3
lua/file_handling.lua
Normal file
3
lua/file_handling.lua
Normal file
@ -0,0 +1,3 @@
|
||||
map("n", "<C-s>", "<cmd>w<CR>", { desc = "general save file" })
|
||||
map("n", "<leader>/", "gcc", { desc = "toggle comment", remap = true })
|
||||
map("v", "<leader>/", "gc", { desc = "toggle comment", remap = true })
|
||||
23
lua/format.lua
Normal file
23
lua/format.lua
Normal file
@ -0,0 +1,23 @@
|
||||
plugin({
|
||||
"stevearc/conform.nvim",
|
||||
event = { "BufWritePre" },
|
||||
cmd = { "ConformInfo" },
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
elixir = { "mix" },
|
||||
javascript = { "prettier" },
|
||||
css = { "prettier" },
|
||||
html = { "prettier" },
|
||||
html = { "prettier" },
|
||||
heex = { "mix" },
|
||||
nix = { "nixfmt" },
|
||||
json = { "prettier" },
|
||||
},
|
||||
format_on_save = {
|
||||
-- These options will be passed to conform.format()
|
||||
timeout_ms = 2000,
|
||||
lsp_fallback = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
7
lua/snippets.lua
Normal file
7
lua/snippets.lua
Normal file
@ -0,0 +1,7 @@
|
||||
plugin({
|
||||
"L3MON4D3/LuaSnip",
|
||||
-- follow latest release.
|
||||
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
|
||||
-- install jsregexp (optional!).
|
||||
build = "make install_jsregexp",
|
||||
})
|
||||
18
lua/theme.lua
Normal file
18
lua/theme.lua
Normal file
@ -0,0 +1,18 @@
|
||||
-- plugin({
|
||||
-- "catppuccin/nvim",
|
||||
-- name = "catppuccin",
|
||||
-- priority = 1000,
|
||||
-- init = function()
|
||||
-- vim.cmd.colorscheme("catppuccin-mocha")
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
plugin({
|
||||
"folke/tokyonight.nvim",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
opts = {},
|
||||
init = function()
|
||||
vim.cmd([[colorscheme tokyonight-night]])
|
||||
end,
|
||||
})
|
||||
16
lua/tmux.lua
Normal file
16
lua/tmux.lua
Normal file
@ -0,0 +1,16 @@
|
||||
plugin({
|
||||
"alexghergh/nvim-tmux-navigation",
|
||||
config = function()
|
||||
require("nvim-tmux-navigation").setup({
|
||||
disable_when_zoomed = true, -- defaults to false
|
||||
keybindings = {
|
||||
left = "<C-h>",
|
||||
down = "<C-j>",
|
||||
up = "<C-k>",
|
||||
right = "<C-l>",
|
||||
last_active = "<C-\\>",
|
||||
next = "<C-Space>",
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
11
snippets/global.json
Normal file
11
snippets/global.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"Basic": { "prefix": "ba", "body": "T1=$1 T2=$2 T0=$0" },
|
||||
"Placeholders": { "prefix": "pl", "body": "T1=${1:aa}\nT2=${2:<$1>}" },
|
||||
"Choices": { "prefix": "ch", "body": "T1=${1|a,b|} T2=${2|c,d|}" },
|
||||
"Linked": { "prefix": "li", "body": "T1=$1\n\tT1=$1" },
|
||||
"Variables": { "prefix": "va", "body": "Runtime: $VIMRUNTIME\n" },
|
||||
"Complex": {
|
||||
"prefix": "co",
|
||||
"body": [ "T1=${1:$RANDOM}", "T3=${3:$1_${2:$1}}", "T2=$2" ]
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user