From b215ac82cd29e9b0754620d9298e7a5e90651257 Mon Sep 17 00:00:00 2001 From: Dominic DiTaranto Date: Thu, 11 Dec 2025 09:19:08 -0500 Subject: [PATCH] readding --- .config/i3blocks/battery.py | 62 ++++++++++++++ .config/i3blocks/config | 47 +++++++++++ .config/i3blocks/volume.sh | 15 ++++ .config/nvim/.gitignore | 8 ++ .config/nvim/.neoconf.json | 15 ++++ .config/nvim/init.lua | 84 +++++++++++++++++++ .config/nvim/lsp/pylsp.lua | 51 +++++++++++ .config/nvim/lua/config/autocmds.lua | 82 ++++++++++++++++++ .config/nvim/lua/config/keymaps.lua | 56 +++++++++++++ .config/nvim/lua/config/plugins/autosave.lua | 3 + .config/nvim/lua/config/plugins/barbar.lua | 6 ++ .config/nvim/lua/config/plugins/blink.lua | 8 ++ .config/nvim/lua/config/plugins/dashboard.lua | 41 +++++++++ .config/nvim/lua/config/plugins/lualine.lua | 57 +++++++++++++ .../lua/config/plugins/markdown-renderer.lua | 28 +++++++ .config/nvim/lua/config/plugins/mason.lua | 27 ++++++ .config/nvim/lua/config/plugins/mini.lua | 11 +++ .../lua/config/plugins/nvim-lspconfig.lua | 1 + .config/nvim/lua/config/plugins/nvim-tree.lua | 3 + .config/nvim/lua/config/plugins/prettier.lua | 19 +++++ .config/nvim/lua/config/plugins/telescope.lua | 10 +++ .config/nvim/lua/config/plugins/theme.lua | 3 + .../nvim/lua/config/plugins/treesitter.lua | 67 +++++++++++++++ .../nvim/lua/config/plugins/venv-selector.lua | 19 +++++ .config/nvim/lua/custom/plugins/tabs.lua | 40 +++++++++ .config/nvim/plugin/floaterminal.lua | 58 +++++++++++++ .config/nvim/test.md | 0 27 files changed, 821 insertions(+) create mode 100755 .config/i3blocks/battery.py create mode 100644 .config/i3blocks/config create mode 100755 .config/i3blocks/volume.sh create mode 100644 .config/nvim/.gitignore create mode 100644 .config/nvim/.neoconf.json create mode 100644 .config/nvim/init.lua create mode 100644 .config/nvim/lsp/pylsp.lua create mode 100644 .config/nvim/lua/config/autocmds.lua create mode 100644 .config/nvim/lua/config/keymaps.lua create mode 100644 .config/nvim/lua/config/plugins/autosave.lua create mode 100644 .config/nvim/lua/config/plugins/barbar.lua create mode 100644 .config/nvim/lua/config/plugins/blink.lua create mode 100644 .config/nvim/lua/config/plugins/dashboard.lua create mode 100644 .config/nvim/lua/config/plugins/lualine.lua create mode 100644 .config/nvim/lua/config/plugins/markdown-renderer.lua create mode 100644 .config/nvim/lua/config/plugins/mason.lua create mode 100644 .config/nvim/lua/config/plugins/mini.lua create mode 100644 .config/nvim/lua/config/plugins/nvim-lspconfig.lua create mode 100644 .config/nvim/lua/config/plugins/nvim-tree.lua create mode 100644 .config/nvim/lua/config/plugins/prettier.lua create mode 100644 .config/nvim/lua/config/plugins/telescope.lua create mode 100644 .config/nvim/lua/config/plugins/theme.lua create mode 100644 .config/nvim/lua/config/plugins/treesitter.lua create mode 100644 .config/nvim/lua/config/plugins/venv-selector.lua create mode 100644 .config/nvim/lua/custom/plugins/tabs.lua create mode 100644 .config/nvim/plugin/floaterminal.lua create mode 100644 .config/nvim/test.md diff --git a/.config/i3blocks/battery.py b/.config/i3blocks/battery.py new file mode 100755 index 0000000..5e48f6f --- /dev/null +++ b/.config/i3blocks/battery.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 + +import subprocess + + +BATTERY_ZERO_DATA = subprocess.check_output(["upower", "-i", "/org/freedesktop/UPower/devices/battery_BAT0"]).decode('utf-8') +BATTERY_ONE_DATA = subprocess.check_output(["upower", "-i", "/org/freedesktop/UPower/devices/battery_BAT1"]).decode('utf-8') + +BATTERY_STATE_MAP = { + 'charging': "󰂄", + 'fully-charged': "󱟢", + 'empty': "󰂃", +} + +bat_0 = {} +bat_1 = {} + + +def get_upower_value(data, key): + return data.split(key)[-1].split('\n')[0].strip() + + +def parse_battery_data(data, obj): + obj['state'] = get_upower_value(data, 'state:') + obj['percentage'] = get_upower_value(data, 'percentage:') + + if obj['state'] not in BATTERY_STATE_MAP: + bat_level = int(obj['percentage'].strip('%')) + + if bat_level < 10: + obj['icon'] = "󰁺" + elif 20 > bat_level >= 10: + obj['icon'] = "󰁻" + elif 30 > bat_level >= 20: + obj['icon'] = "󰁼" + elif 40 > bat_level >= 30: + obj['icon'] = "󰁽" + elif 50 > bat_level >= 40: + obj['icon'] = "󰁾" + elif 60 > bat_level >= 50: + obj['icon'] = "󰁿" + elif 70 > bat_level >= 60: + obj['icon'] = "󰂀" + elif 80 > bat_level >= 70: + obj['icon'] = "󰂁" + elif 90 > bat_level >= 80: + obj['icon'] = "󰂂" + elif 100 > bat_level >= 90: + obj['icon'] = "󰁹" + else: + obj['icon'] = "󱈑" + + else: + obj['icon'] = BATTERY_STATE_MAP.get(obj['state'], "󱃌") + + +parse_battery_data(BATTERY_ZERO_DATA, bat_0) +parse_battery_data(BATTERY_ONE_DATA, bat_1) + +print(f"{bat_0['icon']} {bat_0['percentage']} {bat_1['icon']} {bat_1['percentage']}") + + diff --git a/.config/i3blocks/config b/.config/i3blocks/config new file mode 100644 index 0000000..0b51825 --- /dev/null +++ b/.config/i3blocks/config @@ -0,0 +1,47 @@ + +# Guess the weather hourly +#[weather] +#command=curl -Ss 'https://wttr.in?0&T&Q' | cut -c 16- | head -2 | xargs echo +#interval=3600 +#color=#A4C2F4 + +[cpu] +command=cat <(grep 'cpu ' /proc/stat) <(sleep 1 && grep 'cpu ' /proc/stat) | awk -v RS="" '{printf "%.2f%\n", ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)}' +interval=3 +label= + +[temp] +command=sensors | grep Core | head -n 1 | cut -d ' ' -f 10 | cut -d '+' -f 2 +interval=10 + +[pkgs] +command=checkupdates | wc -l +interval=43200 +label= + +[server_pkgs] +command=ssh domdit.com checkupdates | wc -l +interval=43200 +label=󰒐 + +[brightness] +command=brightnessctl | sed -n 2p | cut -d '(' -f 2 | cut -d ')' -f 1 +label=󰳲 +interval=once +signal=20 + +[volume] +command=pactl list sinks | grep '^[[:space:]]Volume:' | head -n $(( $SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' +label= +interval=once +signal=10 + +[battery] +command=/home/dominic/.config/i3blocks/battery.py +interval=5 + +[time] +command=date +"%D %I:%M" +interval=5 + + diff --git a/.config/i3blocks/volume.sh b/.config/i3blocks/volume.sh new file mode 100755 index 0000000..120e15e --- /dev/null +++ b/.config/i3blocks/volume.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +mute=$(pulsemixer --get-mute) +sink_id=$(pulsemixer --list-sinks | grep "Name: Built-in Audio Analog Ster +eo" | cut -f 3 | cut -d ' ' -f 3 | sed 's/,//g' +) + +if [[ $mute -eq 1 ]] +then + echo "Mute" +else + vol=$(pulsemixer --get-volume --id ${sink_id} | cut -d ' ' -f1) + per=% + echo "${vol}${per}" +fi diff --git a/.config/nvim/.gitignore b/.config/nvim/.gitignore new file mode 100644 index 0000000..cc5457a --- /dev/null +++ b/.config/nvim/.gitignore @@ -0,0 +1,8 @@ +tt.* +.tests +doc/tags +debug +.repro +foo.* +*.log +data diff --git a/.config/nvim/.neoconf.json b/.config/nvim/.neoconf.json new file mode 100644 index 0000000..7c48087 --- /dev/null +++ b/.config/nvim/.neoconf.json @@ -0,0 +1,15 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + } +} diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..727f4d2 --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,84 @@ +local vim = vim +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +vim.o.number = true +vim.o.relativenumber = true +vim.o.wrap = true +vim.o.linebreak = true + +vim.o.ignorecase = true +vim.o.smartcase = true +vim.o.inccommand = 'split' + +vim.o.cursorline = true +vim.o.showmode = true +vim.o.hlsearch = false +vim.o.tabstop = 2 +vim.o.shiftwidth = 2 +vim.g.have_nerd_font = true +vim.o.scrolloff = 10 +vim.g.border = "rounded" +vim.o.termguicolors = true + +vim.o.swapfile = false +vim.o.mouse = "a" +vim.o.undofile = true +vim.o.spell = false + +vim.diagnostic.config({ + virtual_text = false, + float = { source = "always", border = "rounded" }, +}) + +require("config.keymaps") +require("config.autocmds") +require("config.plugins.autosave") +require("config.plugins.barbar") +require("config.plugins.blink") +require("config.plugins.dashboard") +require("config.plugins.lualine") +require("config.plugins.mason") +require("config.plugins.mini") +require("config.plugins.nvim-lspconfig") +require("config.plugins.nvim-tree") +require("config.plugins.prettier") +require("config.plugins.telescope") +require("config.plugins.theme") +require("config.plugins.treesitter") +require("config.plugins.venv-selector") +require("config.plugins.markdown-renderer") + +local enable_providers = { + "python3_provider", +} + +for _, plugin in pairs(enable_providers) do + vim.g["loaded_" .. plugin] = nil + vim.cmd("runtime " .. plugin) +end + +vim.g.loaded_python3_provider = nil + +-- lua... I need to move this +vim.lsp.config("lua_ls", { + settings = { + Lua = { + runtime = { + }, + version = "LuaJIT", + diagnostics = { + globals = { + "vim", + "require", + }, + }, + workspace = { + library = vim.api.nvim_get_runtime_file("", true), + }, + telemetry = { + enable = false, + }, + }, + }, +}) diff --git a/.config/nvim/lsp/pylsp.lua b/.config/nvim/lsp/pylsp.lua new file mode 100644 index 0000000..8baa505 --- /dev/null +++ b/.config/nvim/lsp/pylsp.lua @@ -0,0 +1,51 @@ +vim.lsp.config("pylsp", { + settings = { + pylsp = { + plugins = { + pycodestyle = { + ignore = { "W391", "E501" }, + maxLineLength = 100, + }, + }, + }, + }, +}) + +vim.lsp.config('basedpyright', { + cmd = { 'basedpyright-langserver', '--stdio' }, + filetypes = { 'python' }, + root_markers = { + 'pyproject.toml', + 'setup.py', + 'setup.cfg', + 'requirements.txt', + 'Pipfile', + 'pyrightconfig.json', + '.git', + }, + settings = { + basedpyright = { + analysis = { + + diagnosticSeverityOverrides = { + reportAny = false, + reportOptionalOperand = "warning", + reportOptionalMemberAccess = false, + reportOptionalSubscript = false, + reportAttributeAccessIssue = false, + reportMissingTypeArgument = false, + reportMissingTypeStubs = false, + reportUnknownArgumentType = false, + reportUnknownMemberType = false, + reportUnknownParameterType = false, + reportUnknownVariableType = false, + reportUnusedCallResult = false, + }, + autoSearchPaths = true, + useLibraryCodeForTypes = true, + diagnosticMode = 'openFilesOnly', + typeCheckingMode = 'basic', + }, + }, + }, +}) diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua new file mode 100644 index 0000000..b9e9dc3 --- /dev/null +++ b/.config/nvim/lua/config/autocmds.lua @@ -0,0 +1,82 @@ +-- Highlight On Yank +vim.api.nvim_create_autocmd("TextYankPost", { + desc = "Highlight when yanking (copying) text", + group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }), + callback = function() + vim.hl.on_yank() + end, +}) + +-- python specific +vim.api.nvim_create_autocmd("FileType", { + pattern = "python", + command = "setlocal shiftwidth=4 tabstop=4" +}) + +-- restore cursor to file position in previous editing session +vim.api.nvim_create_autocmd("BufReadPost", { + callback = function(args) + local mark = vim.api.nvim_buf_get_mark(args.buf, '"') + local line_count = vim.api.nvim_buf_line_count(args.buf) + if mark[1] > 0 and mark[1] <= line_count then + vim.api.nvim_win_set_cursor(0, mark) + -- defer centering slightly so it's applied after render + vim.schedule(function() + vim.cmd("normal! zz") + end) + end + end, +}) + +-- open help in vertical split +vim.api.nvim_create_autocmd("FileType", { + pattern = "help", + command = "wincmd L", +}) + +-- auto resize splits when the terminal's window is resized +vim.api.nvim_create_autocmd("VimResized", { + command = "wincmd =", +}) + +-- no auto continue comments on new line +vim.api.nvim_create_autocmd("FileType", { + group = vim.api.nvim_create_augroup("no_auto_comment", {}), + callback = function() + vim.opt_local.formatoptions:remove({ "c", "r", "o" }) + end, +}) + +-- ide like highlight when stopping cursor +vim.api.nvim_create_autocmd("CursorMoved", { + group = vim.api.nvim_create_augroup("LspReferenceHighlight", { clear = true }), + desc = "Highlight references under cursor", + callback = function() + -- Only run if the cursor is not in insert mode + if vim.fn.mode() ~= "i" then + local clients = vim.lsp.get_clients({ bufnr = 0 }) + local supports_highlight = false + for _, client in ipairs(clients) do + if client.server_capabilities.documentHighlightProvider then + supports_highlight = true + break -- Found a supporting client, no need to check others + end + end + + -- 3. Proceed only if an LSP is active AND supports the feature + if supports_highlight then + vim.lsp.buf.clear_references() + vim.lsp.buf.document_highlight() + end + end + end, +}) + +-- ide like highlight when stopping cursor +vim.api.nvim_create_autocmd("CursorMovedI", { + group = "LspReferenceHighlight", + desc = "Clear highlights when entering insert mode", + callback = function() + vim.lsp.buf.clear_references() + end, +}) diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua new file mode 100644 index 0000000..6da1bbb --- /dev/null +++ b/.config/nvim/lua/config/keymaps.lua @@ -0,0 +1,56 @@ +-- unset space so it can be used as leader +vim.keymap.set("n", " ", "", { silent = true, remap = false }) + +-- source config +vim.keymap.set("n", "o", ":source $HOME/.config/nvim/init.lua") + +-- move around windows +vim.keymap.set("n", "", "", { desc = "focus to l window" }) +vim.keymap.set("n", "", "", { desc = "focus to r window" }) +vim.keymap.set("n", "", "", { desc = "focus to dwn window" }) +vim.keymap.set("n", "", "", { desc = "focus to up window" }) + +-- move lines up and down +vim.keymap.set("n", "", ":m .+1==") +vim.keymap.set("n", "", ":m .-2==") +vim.keymap.set("v", "", ":m '>+1gv=gv") +vim.keymap.set("v", "", ":m '<-2gv=gv") + +-- quote around highlighted words +vim.keymap.set('v', "'", "c''P") +vim.keymap.set('v', '"', 'c""P') + +-- non-floating terminal +vim.keymap.set('n', 'T', ":belowright split | terminal | :resize 8i") + +-- toggle spellcheck +vim.keymap.set('n', 'st', ':set spell!') + +-- toggle nvim tree +vim.keymap.set("n", "e", ":NvimTreeToggle") + +-- barbar +vim.keymap.set("n", "x", ":BufferClose") +-- (I need both options, one for windows, one for linux) +vim.keymap.set("n", "", ":BufferPrevious") +vim.keymap.set("n", "", ":BufferNext") +vim.keymap.set("n", "", "BufferPrevious") +vim.keymap.set("n", "", "BufferNext") + +-- format +vim.keymap.set("n", "f", ":lua vim.lsp.buf.format()") + +-- diagnostics +vim.keymap.set("n", "ds", ":lua vim.diagnostic.open_float()") +vim.keymap.set("n", "dn", function() vim.diagnostic.jump({ count = 1 }) end) +vim.keymap.set("n", "dp", function() vim.diagnostic.jump({ count = -1 }) end) + +-- markdown autocommands +vim.api.nvim_create_autocmd('FileType', { + pattern = 'markdown', + callback = function() + vim.keymap.set("n", "[", "i- [ ] ") + vim.keymap.set("n", "m", "^3rx") + vim.keymap.set("n", "M", "^3r ") + end +}) diff --git a/.config/nvim/lua/config/plugins/autosave.lua b/.config/nvim/lua/config/plugins/autosave.lua new file mode 100644 index 0000000..1e54ebe --- /dev/null +++ b/.config/nvim/lua/config/plugins/autosave.lua @@ -0,0 +1,3 @@ +vim.pack.add{"https://github.com/Pocco81/auto-save.nvim"} + +require("auto-save").setup() diff --git a/.config/nvim/lua/config/plugins/barbar.lua b/.config/nvim/lua/config/plugins/barbar.lua new file mode 100644 index 0000000..c555fd3 --- /dev/null +++ b/.config/nvim/lua/config/plugins/barbar.lua @@ -0,0 +1,6 @@ +vim.pack.add({ + { src = "https://github.com/nvim-tree/nvim-web-devicons" }, + { src = "https://github.com/romgrk/barbar.nvim" }, +}) + +require("barbar").setup() diff --git a/.config/nvim/lua/config/plugins/blink.lua b/.config/nvim/lua/config/plugins/blink.lua new file mode 100644 index 0000000..2d0879e --- /dev/null +++ b/.config/nvim/lua/config/plugins/blink.lua @@ -0,0 +1,8 @@ +vim.pack.add{"https://github.com/saghen/blink.cmp"} + +require("blink.cmp").setup({ + keymap = { + preset = "enter", + [""] = { "select_and_accept", "fallback" }, + }, +}) diff --git a/.config/nvim/lua/config/plugins/dashboard.lua b/.config/nvim/lua/config/plugins/dashboard.lua new file mode 100644 index 0000000..d2252e7 --- /dev/null +++ b/.config/nvim/lua/config/plugins/dashboard.lua @@ -0,0 +1,41 @@ +vim.pack.add{"https://github.com/nvimdev/dashboard-nvim"} + +local logo = + [[⠀⣰⠋⠀⠀⠀⠀⣸⠃⠀⡞⠀⠀⠀⣠⣏⡧⠤⠶⢶⠾⠳⢤⣇⠀⠀⢠⠞⠁⠀⠀⠀⢱⡀⠀⠀⢸⠁⠹⡄⠀⠀⠀⠀⣧⠀⠀⠀⠀⠀⢸⠀⠀⢠⡀⠀⠸⣄⣀⠀⠀⠀ +⠀⠛⠒⠒⠒⠒⠚⣇⠀⢸⠃⠀⠀⣴⠟⢹⠉⠀⣤⠋⠀⠀⠀⡏⠐⣰⠋⠀⠀⠀⠀⠀⠀⢻⡄⢢⢼⠒⠒⠻⡖⠲⠤⣴⡘⣦⠀⠀⠀⠀⢸⠀⠀⠀⡇⠀⠀⡁⠉⠉⠛⠒ +⠀⠀⠀⠀⠀⠀⢀⡏⢠⡿⡄⠀⡼⠃⠀⢸⢴⡜⠁⠀⠀⠀⠀⣇⡼⠁⠀⠀⠀⠀⠀⠀⠀⠀⢳⡀⡾⠀⠀⠀⠙⣄⠀⣸⠙⢻⣄⠀⠀⠀⢸⠀⠀⠀⡇⠀⠀⡇⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⢸⣇⡟⡧⠃⡞⠁⠀⠀⠸⠎⠀⠀⠀⠀⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⠃⠀⠀⠀⠀⠘⣄⡇⠀⠀⢿⣦⡀⠀⢼⠀⠀⠀⡇⠀⠀⠃⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠸⣿⠤⣇⡞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⠀⠈⣟⠃⠀⡇⠀⠀⢸⠧⠀⢸⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⢠⠇⣠⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⡆⢸⢿⠀⠀⡜⠀⠀⣾⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⣾⢸⠁⡆⠀⠀⠰⠒⠒⠒⠶⠤⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⠎⢸⠀⣰⠧⢤⣸⠃⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⣿⢸⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠓⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⠤⠒⠒⠒⠛⠛⠒⠒⠲⠄⠀⠀⠀⠀⠘⣧⣯⢤⠀⢻⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⢀⣸⡜⣆⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡟⠀⠀⡇⢸⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⢠⡞⠉⠁⠳⣄⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⠁⠀⢸⠀⡄⠀⠀⠀⠀⠀⠀ +⠀⢀⠴⠋⠀⠀⠀⠀⠙⢇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠏⠀⣠⢃⡼⠉⠳⣄⠀⠀⠀⠀ +⢠⣞⠀⣀⠀⠀⠀⠀⠀⢸⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠒⠚⡡⠎⠀⠀⠀⠈⠳⣄⠀⠀ +⠈⠉⠉⡝⠀⠀⠀⠀⠀⠀⢿⡀⠀⠀⠀⠀⠀⠀⠀⢰⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡾⠶⠖⠋⠀⠀⠀⠈⢠⣀⣶⠽⠂⠀ +⠀⠀⢸⣥⣠⣤⠀⠀⠀⠀⠀⡹⣦⠀⠀⠀⠀⠀⠀⠀⠈⠑⠒⠢⠤⠤⠤⠤⠤⠤⠤⠤⠤⠴⠒⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⠁⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⡘⠀⢀⣠⡴⠋⠀⠈⠛⣦⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡔⠉⠀⠑⢤⣀⠀⠀⠀⣶⠒⠒⠛⠀⠀⠀⠀]] + +logo = string.rep("\n", 8) .. logo .. "\n\n" + +require("dashboard").setup({ + theme = "hyper", + hide = { + statusline = true, + tabline = true, + winbar = true, + }, + config = { + shortcut = { + { desc = "変わっていく季節、変わらない毎日。" }, + }, + header = vim.split(logo, "\n"), + packages = { enable = false }, + project = { enable = false }, + mru = { enable = true, limit = 10, label = "最近使ったファイル:", cwd_only = false }, + footer = function() + return { "" } + end, + }, +}) diff --git a/.config/nvim/lua/config/plugins/lualine.lua b/.config/nvim/lua/config/plugins/lualine.lua new file mode 100644 index 0000000..b171a91 --- /dev/null +++ b/.config/nvim/lua/config/plugins/lualine.lua @@ -0,0 +1,57 @@ +vim.pack.add{"https://github.com/nvim-lualine/lualine.nvim"} + +require("lualine").setup({ + options = { + icons_enabled = true, + theme = "everforest", + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + always_show_tabline = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + refresh_time = 16, -- ~60fps + events = { + "WinEnter", + "BufEnter", + "BufWritePost", + "SessionLoadPost", + "FileChangedShellPost", + "VimResized", + "Filetype", + "CursorMoved", + "CursorMovedI", + "ModeChanged", + }, + }, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch", "diff", "diagnostics" }, + lualine_c = { "filename" }, + lualine_x = { "encoding", "fileformat", "filetype" }, + lualine_y = { "progress" }, + lualine_z = { "location" }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { "filename" }, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {}, +}) + diff --git a/.config/nvim/lua/config/plugins/markdown-renderer.lua b/.config/nvim/lua/config/plugins/markdown-renderer.lua new file mode 100644 index 0000000..592901a --- /dev/null +++ b/.config/nvim/lua/config/plugins/markdown-renderer.lua @@ -0,0 +1,28 @@ +vim.pack.add({ "https://github.com/MeanderingProgrammer/render-markdown.nvim" }) + +require("render-markdown").setup({ + file_types = { 'markdown', 'quarto' }, + completions = { lsp = { enabled = true } }, + + checkbox = { + enabled = true, + render_modes = false, + bullet = false, + left_pad = 0, + right_pad = 1, + unchecked = { + icon = "󰄱 ", + highlight = "RenderMarkdownUnchecked", + scope_highlight = nil, + }, + checked = { + icon = "󰱒 ", + highlight = "RenderMarkdownChecked", + scope_highlight = nil, + }, + custom = { + todo = { raw = "[-]", rendered = "󰥔 ", highlight = "RenderMarkdownTodo", scope_highlight = nil }, + }, + scope_priority = nil, + }, +}) diff --git a/.config/nvim/lua/config/plugins/mason.lua b/.config/nvim/lua/config/plugins/mason.lua new file mode 100644 index 0000000..34aae30 --- /dev/null +++ b/.config/nvim/lua/config/plugins/mason.lua @@ -0,0 +1,27 @@ +vim.pack.add({ + { src = "https://github.com/mason-org/mason.nvim" }, + { src = "https://github.com/mason-org/mason-lspconfig.nvim" }, + { src = "https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim" }, +}) + +require("mason").setup() +require("mason-lspconfig").setup() +require("mason-tool-installer").setup({ + ensure_installed = { + "basedpyright", + "biome", + "djlint", + "emmet-language-server", + "html-lsp", + "lua-language-server", + "lwc-language-server", + "omnisharp", + "prettier", + "prettierd", + "python-lsp-server", + "ruff", + "selene", + "stylua", + "typescript-language-server", + }, +}) diff --git a/.config/nvim/lua/config/plugins/mini.lua b/.config/nvim/lua/config/plugins/mini.lua new file mode 100644 index 0000000..3faf6ad --- /dev/null +++ b/.config/nvim/lua/config/plugins/mini.lua @@ -0,0 +1,11 @@ +vim.pack.add{"https://github.com/nvim-mini/mini.nvim"} + +require("mini.ai").setup() +require("mini.surround").setup() +require("mini.pairs").setup({ + modes = { + insert = true, + command = true, + terminal = false, + }, +}) diff --git a/.config/nvim/lua/config/plugins/nvim-lspconfig.lua b/.config/nvim/lua/config/plugins/nvim-lspconfig.lua new file mode 100644 index 0000000..d741eae --- /dev/null +++ b/.config/nvim/lua/config/plugins/nvim-lspconfig.lua @@ -0,0 +1 @@ +vim.pack.add{"https://github.com/neovim/nvim-lspconfig"} diff --git a/.config/nvim/lua/config/plugins/nvim-tree.lua b/.config/nvim/lua/config/plugins/nvim-tree.lua new file mode 100644 index 0000000..888d02a --- /dev/null +++ b/.config/nvim/lua/config/plugins/nvim-tree.lua @@ -0,0 +1,3 @@ +vim.pack.add{"https://github.com/nvim-tree/nvim-tree.lua"} + +require("nvim-tree").setup() diff --git a/.config/nvim/lua/config/plugins/prettier.lua b/.config/nvim/lua/config/plugins/prettier.lua new file mode 100644 index 0000000..588c105 --- /dev/null +++ b/.config/nvim/lua/config/plugins/prettier.lua @@ -0,0 +1,19 @@ +vim.pack.add{"https://github.com/MunifTanjim/prettier.nvim"} + +require("prettier").setup({ + bin = 'prettier', -- or `'prettierd'` (v0.23.3+) + filetypes = { + "css", + "graphql", + "html", + "javascript", + "javascriptreact", + "json", + "less", + "markdown", + "scss", + "typescript", + "typescriptreact", + "yaml", + }, +}) diff --git a/.config/nvim/lua/config/plugins/telescope.lua b/.config/nvim/lua/config/plugins/telescope.lua new file mode 100644 index 0000000..4f30ba6 --- /dev/null +++ b/.config/nvim/lua/config/plugins/telescope.lua @@ -0,0 +1,10 @@ +vim.pack.add({ + { src = "https://github.com/nvim-lua/plenary.nvim" }, + { src = "https://github.com/nvim-telescope/telescope.nvim" }, +}) + +local builtin = require("telescope.builtin") +vim.keymap.set("n", "ff", builtin.find_files, { desc = "Telescope find files" }) +vim.keymap.set("n", "fg", builtin.live_grep, { desc = "Telescope live grep" }) +vim.keymap.set("n", "fb", builtin.buffers, { desc = "Telescope buffers" }) +vim.keymap.set("n", "fh", builtin.help_tags, { desc = "Telescope help tags" }) diff --git a/.config/nvim/lua/config/plugins/theme.lua b/.config/nvim/lua/config/plugins/theme.lua new file mode 100644 index 0000000..d512875 --- /dev/null +++ b/.config/nvim/lua/config/plugins/theme.lua @@ -0,0 +1,3 @@ +vim.pack.add{"https://github.com/neanias/everforest-nvim.git"} + +vim.cmd("colorscheme everforest") diff --git a/.config/nvim/lua/config/plugins/treesitter.lua b/.config/nvim/lua/config/plugins/treesitter.lua new file mode 100644 index 0000000..18520fc --- /dev/null +++ b/.config/nvim/lua/config/plugins/treesitter.lua @@ -0,0 +1,67 @@ +vim.pack.add({ + { + src = "https://github.com/nvim-treesitter/nvim-treesitter", + branch = "main", + build = ":TSUpdate", + lazy = false, + }, + { + src = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects" + } +}) + +require("nvim-treesitter.configs").setup({ + ensure_installed = {}, + modules = {}, + sync_install = false, + auto_install = true, + ignore_install = {}, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + textobjects = { + select = { + enable = true, + + -- Automatically jump forward to textobj, similar to targets.vim + lookahead = true, + + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + -- You can optionally set descriptions to the mappings (used in the desc parameter of + -- nvim_buf_set_keymap) which plugins like which-key display + ["ic"] = { query = "@class.inner", desc = "Select inner part of a class region" }, + -- You can also use captures from other query groups like `locals.scm` + ["as"] = { query = "@local.scope", query_group = "locals", desc = "Select language scope" }, + }, + -- You can choose the select mode (default is charwise 'v') + -- + -- Can also be a function which gets passed a table with the keys + -- * query_string: eg '@function.inner' + -- * method: eg 'v' or 'o' + -- and should return the mode ('v', 'V', or '') or a table + -- mapping query_strings to modes. + selection_modes = { + ['@parameter.outer'] = 'v', -- charwise + ['@function.outer'] = 'V', -- linewise + ['@class.outer'] = '', -- blockwise + }, + -- If you set this to `true` (default is `false`) then any textobject is + -- extended to include preceding or succeeding whitespace. Succeeding + -- whitespace has priority in order to act similarly to eg the built-in + -- `ap`. + -- + -- Can also be a function which gets passed a table with the keys + -- * query_string: eg '@function.inner' + -- * selection_mode: eg 'v' + -- and should return true or false + include_surrounding_whitespace = true, + }, + }, + +}) + diff --git a/.config/nvim/lua/config/plugins/venv-selector.lua b/.config/nvim/lua/config/plugins/venv-selector.lua new file mode 100644 index 0000000..7bc3dc9 --- /dev/null +++ b/.config/nvim/lua/config/plugins/venv-selector.lua @@ -0,0 +1,19 @@ +vim.pack.add({ + { src = "https://github.com/mfussenegger/nvim-dap" }, + { src = "https://github.com/mfussenegger/nvim-dap-python" }, + { src = "https://github.com/linux-cultist/venv-selector.nvim" }, +}) + +require("dap-python").setup("python3") +require("venv-selector").setup({ + -- Optional: Customize search paths for virtual environments + search = { + -- Example: Add a custom search path + -- { path = "~/my_projects/venvs", depth = 1 }, + }, + -- Optional: Customize plugin options + options = { + -- Example: Set a default picker (e.g., "telescope") + -- picker = "telescope", + }, +}) diff --git a/.config/nvim/lua/custom/plugins/tabs.lua b/.config/nvim/lua/custom/plugins/tabs.lua new file mode 100644 index 0000000..96c6a69 --- /dev/null +++ b/.config/nvim/lua/custom/plugins/tabs.lua @@ -0,0 +1,40 @@ +-- Tab display settings +vim.opt.showtabline = 1 -- Always show tabline (0=never, 1=when multiple tabs, 2=always) +vim.opt.tabline = '' -- Use default tabline (empty string uses built-in) + +-- Transparent tabline appearance +vim.cmd([[ + hi TabLineFill guibg=NONE ctermfg=242 ctermbg=NONE +]]) + +-- Alternative navigation (more intuitive) +vim.keymap.set('n', 'tn', ':tabnew', { desc = 'New tab' }) + +-- Tab moving +vim.keymap.set('n', 'tm', ':tabmove', { desc = 'Move tab' }) +vim.keymap.set('n', 't>', ':tabmove +1', { desc = 'Move tab right' }) +vim.keymap.set('n', 't<', ':tabmove -1', { desc = 'Move tab left' }) + +-- Function to open file in new tab +local function open_file_in_tab() + vim.ui.input({ prompt = 'File to open in new tab: ', completion = 'file' }, function(input) + if input and input ~= '' then + vim.cmd('tabnew ' .. input) + end + end) +end + +-- Enhanced keybindings +vim.keymap.set('n', 'tO', open_file_in_tab, { desc = 'Open file in new tab' }) + +-- Function to close buffer but keep tab if it's the only buffer in tab +local function smart_close_buffer() + local buffers_in_tab = #vim.fn.tabpagebuflist() + if buffers_in_tab > 1 then + vim.cmd('bdelete') + else + -- If it's the only buffer in tab, close the tab + vim.cmd('tabclose') + end +end +vim.keymap.set('n', 'x', smart_close_buffer, { desc = 'Smart close buffer/tab' }) diff --git a/.config/nvim/plugin/floaterminal.lua b/.config/nvim/plugin/floaterminal.lua new file mode 100644 index 0000000..703324f --- /dev/null +++ b/.config/nvim/plugin/floaterminal.lua @@ -0,0 +1,58 @@ +vim.keymap.set("t", "", "") + +local state = { + floating = { + buf = -1, + win = -1, + } +} + +local function create_floating_window(opts) + opts = opts or {} + local width = opts.width or math.floor(vim.o.columns * 0.8) + local height = opts.height or math.floor(vim.o.lines * 0.8) + + -- Calculate the position to center the window + local col = math.floor((vim.o.columns - width) / 2) + local row = math.floor((vim.o.lines - height) / 2) + + -- Create a buffer + local buf = nil + if vim.api.nvim_buf_is_valid(opts.buf) then + buf = opts.buf + else + buf = vim.api.nvim_create_buf(false, true) -- No file, scratch buffer + end + + -- Define window configuration + local win_config = { + relative = "editor", + width = width, + height = height, + col = col, + row = row, + style = "minimal", -- No borders or extra UI elements + border = "rounded", + } + + -- Create the floating window + local win = vim.api.nvim_open_win(buf, true, win_config) + + return { buf = buf, win = win } +end + +local toggle_terminal = function() + if not vim.api.nvim_win_is_valid(state.floating.win) then + state.floating = create_floating_window { buf = state.floating.buf } + if vim.bo[state.floating.buf].buftype ~= "terminal" then + vim.cmd.terminal() + end + else + vim.api.nvim_win_hide(state.floating.win) + end +end + +-- Example usage: +-- Create a floating window with default dimensions +vim.api.nvim_create_user_command("Floaterminal", toggle_terminal, {}) +vim.keymap.set({ "n", "t" }, "tt", toggle_terminal) diff --git a/.config/nvim/test.md b/.config/nvim/test.md new file mode 100644 index 0000000..e69de29