readding
This commit is contained in:
parent
6d1e83b84a
commit
b215ac82cd
27 changed files with 821 additions and 0 deletions
62
.config/i3blocks/battery.py
Executable file
62
.config/i3blocks/battery.py
Executable file
|
|
@ -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']}")
|
||||
|
||||
|
||||
47
.config/i3blocks/config
Normal file
47
.config/i3blocks/config
Normal file
|
|
@ -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
|
||||
|
||||
|
||||
15
.config/i3blocks/volume.sh
Executable file
15
.config/i3blocks/volume.sh
Executable file
|
|
@ -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
|
||||
8
.config/nvim/.gitignore
vendored
Normal file
8
.config/nvim/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
tt.*
|
||||
.tests
|
||||
doc/tags
|
||||
debug
|
||||
.repro
|
||||
foo.*
|
||||
*.log
|
||||
data
|
||||
15
.config/nvim/.neoconf.json
Normal file
15
.config/nvim/.neoconf.json
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"neodev": {
|
||||
"library": {
|
||||
"enabled": true,
|
||||
"plugins": true
|
||||
}
|
||||
},
|
||||
"neoconf": {
|
||||
"plugins": {
|
||||
"lua_ls": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
84
.config/nvim/init.lua
Normal file
84
.config/nvim/init.lua
Normal file
|
|
@ -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,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
51
.config/nvim/lsp/pylsp.lua
Normal file
51
.config/nvim/lsp/pylsp.lua
Normal file
|
|
@ -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',
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
82
.config/nvim/lua/config/autocmds.lua
Normal file
82
.config/nvim/lua/config/autocmds.lua
Normal file
|
|
@ -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,
|
||||
})
|
||||
56
.config/nvim/lua/config/keymaps.lua
Normal file
56
.config/nvim/lua/config/keymaps.lua
Normal file
|
|
@ -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", "<leader>o", ":source $HOME/.config/nvim/init.lua<CR>")
|
||||
|
||||
-- move around windows
|
||||
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "focus to l window" })
|
||||
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "focus to r window" })
|
||||
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "focus to dwn window" })
|
||||
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "focus to up window" })
|
||||
|
||||
-- move lines up and down
|
||||
vim.keymap.set("n", "<A-j>", ":m .+1<CR>==")
|
||||
vim.keymap.set("n", "<A-k>", ":m .-2<CR>==")
|
||||
vim.keymap.set("v", "<A-j>", ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set("v", "<A-k>", ":m '<-2<CR>gv=gv")
|
||||
|
||||
-- quote around highlighted words
|
||||
vim.keymap.set('v', "'", "c''<Esc>P")
|
||||
vim.keymap.set('v', '"', 'c""<Esc>P')
|
||||
|
||||
-- non-floating terminal
|
||||
vim.keymap.set('n', 'T', ":belowright split | terminal<CR> | :resize 8<CR>i")
|
||||
|
||||
-- toggle spellcheck
|
||||
vim.keymap.set('n', '<leader>st', ':set spell!<CR>')
|
||||
|
||||
-- toggle nvim tree
|
||||
vim.keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>")
|
||||
|
||||
-- barbar
|
||||
vim.keymap.set("n", "<leader>x", ":BufferClose<CR>")
|
||||
-- (I need both options, one for windows, one for linux)
|
||||
vim.keymap.set("n", "<A-h>", ":BufferPrevious<CR>")
|
||||
vim.keymap.set("n", "<A-l>", ":BufferNext<CR>")
|
||||
vim.keymap.set("n", "<A-,>", "<Cmd>BufferPrevious<CR>")
|
||||
vim.keymap.set("n", "<A-.>", "<Cmd>BufferNext<CR>")
|
||||
|
||||
-- format
|
||||
vim.keymap.set("n", "<leader>f", ":lua vim.lsp.buf.format()<CR>")
|
||||
|
||||
-- diagnostics
|
||||
vim.keymap.set("n", "<leader>ds", ":lua vim.diagnostic.open_float()<CR>")
|
||||
vim.keymap.set("n", "<leader>dn", function() vim.diagnostic.jump({ count = 1 }) end)
|
||||
vim.keymap.set("n", "<leader>dp", function() vim.diagnostic.jump({ count = -1 }) end)
|
||||
|
||||
-- markdown autocommands
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = 'markdown',
|
||||
callback = function()
|
||||
vim.keymap.set("n", "<leader>[", "i- [ ] <CR><Esc>")
|
||||
vim.keymap.set("n", "m", "^3<right>rx")
|
||||
vim.keymap.set("n", "M", "^3<right>r ")
|
||||
end
|
||||
})
|
||||
3
.config/nvim/lua/config/plugins/autosave.lua
Normal file
3
.config/nvim/lua/config/plugins/autosave.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
vim.pack.add{"https://github.com/Pocco81/auto-save.nvim"}
|
||||
|
||||
require("auto-save").setup()
|
||||
6
.config/nvim/lua/config/plugins/barbar.lua
Normal file
6
.config/nvim/lua/config/plugins/barbar.lua
Normal file
|
|
@ -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()
|
||||
8
.config/nvim/lua/config/plugins/blink.lua
Normal file
8
.config/nvim/lua/config/plugins/blink.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
vim.pack.add{"https://github.com/saghen/blink.cmp"}
|
||||
|
||||
require("blink.cmp").setup({
|
||||
keymap = {
|
||||
preset = "enter",
|
||||
["<CR>"] = { "select_and_accept", "fallback" },
|
||||
},
|
||||
})
|
||||
41
.config/nvim/lua/config/plugins/dashboard.lua
Normal file
41
.config/nvim/lua/config/plugins/dashboard.lua
Normal file
|
|
@ -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,
|
||||
},
|
||||
})
|
||||
57
.config/nvim/lua/config/plugins/lualine.lua
Normal file
57
.config/nvim/lua/config/plugins/lualine.lua
Normal file
|
|
@ -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 = {},
|
||||
})
|
||||
|
||||
28
.config/nvim/lua/config/plugins/markdown-renderer.lua
Normal file
28
.config/nvim/lua/config/plugins/markdown-renderer.lua
Normal file
|
|
@ -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,
|
||||
},
|
||||
})
|
||||
27
.config/nvim/lua/config/plugins/mason.lua
Normal file
27
.config/nvim/lua/config/plugins/mason.lua
Normal file
|
|
@ -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",
|
||||
},
|
||||
})
|
||||
11
.config/nvim/lua/config/plugins/mini.lua
Normal file
11
.config/nvim/lua/config/plugins/mini.lua
Normal file
|
|
@ -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,
|
||||
},
|
||||
})
|
||||
1
.config/nvim/lua/config/plugins/nvim-lspconfig.lua
Normal file
1
.config/nvim/lua/config/plugins/nvim-lspconfig.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
vim.pack.add{"https://github.com/neovim/nvim-lspconfig"}
|
||||
3
.config/nvim/lua/config/plugins/nvim-tree.lua
Normal file
3
.config/nvim/lua/config/plugins/nvim-tree.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
vim.pack.add{"https://github.com/nvim-tree/nvim-tree.lua"}
|
||||
|
||||
require("nvim-tree").setup()
|
||||
19
.config/nvim/lua/config/plugins/prettier.lua
Normal file
19
.config/nvim/lua/config/plugins/prettier.lua
Normal file
|
|
@ -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",
|
||||
},
|
||||
})
|
||||
10
.config/nvim/lua/config/plugins/telescope.lua
Normal file
10
.config/nvim/lua/config/plugins/telescope.lua
Normal file
|
|
@ -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", "<leader>ff", builtin.find_files, { desc = "Telescope find files" })
|
||||
vim.keymap.set("n", "<leader>fg", builtin.live_grep, { desc = "Telescope live grep" })
|
||||
vim.keymap.set("n", "<leader>fb", builtin.buffers, { desc = "Telescope buffers" })
|
||||
vim.keymap.set("n", "<leader>fh", builtin.help_tags, { desc = "Telescope help tags" })
|
||||
3
.config/nvim/lua/config/plugins/theme.lua
Normal file
3
.config/nvim/lua/config/plugins/theme.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
vim.pack.add{"https://github.com/neanias/everforest-nvim.git"}
|
||||
|
||||
vim.cmd("colorscheme everforest")
|
||||
67
.config/nvim/lua/config/plugins/treesitter.lua
Normal file
67
.config/nvim/lua/config/plugins/treesitter.lua
Normal file
|
|
@ -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 '<c-v>') or a table
|
||||
-- mapping query_strings to modes.
|
||||
selection_modes = {
|
||||
['@parameter.outer'] = 'v', -- charwise
|
||||
['@function.outer'] = 'V', -- linewise
|
||||
['@class.outer'] = '<c-v>', -- 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,
|
||||
},
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
19
.config/nvim/lua/config/plugins/venv-selector.lua
Normal file
19
.config/nvim/lua/config/plugins/venv-selector.lua
Normal file
|
|
@ -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",
|
||||
},
|
||||
})
|
||||
40
.config/nvim/lua/custom/plugins/tabs.lua
Normal file
40
.config/nvim/lua/custom/plugins/tabs.lua
Normal file
|
|
@ -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', '<leader>tn', ':tabnew<CR>', { desc = 'New tab' })
|
||||
|
||||
-- Tab moving
|
||||
vim.keymap.set('n', '<leader>tm', ':tabmove<CR>', { desc = 'Move tab' })
|
||||
vim.keymap.set('n', '<leader>t>', ':tabmove +1<CR>', { desc = 'Move tab right' })
|
||||
vim.keymap.set('n', '<leader>t<', ':tabmove -1<CR>', { 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', '<leader>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', '<leader>x', smart_close_buffer, { desc = 'Smart close buffer/tab' })
|
||||
58
.config/nvim/plugin/floaterminal.lua
Normal file
58
.config/nvim/plugin/floaterminal.lua
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
vim.keymap.set("t", "<esc><esc>", "<c-\\><c-n>")
|
||||
|
||||
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" }, "<space>tt", toggle_terminal)
|
||||
0
.config/nvim/test.md
Normal file
0
.config/nvim/test.md
Normal file
Loading…
Reference in a new issue