Big cleanup for a big commit.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
[general]
|
||||
|
||||
[font]
|
||||
size = 12
|
||||
size = 12.4
|
||||
offset = { x = 0, y = 3 }
|
||||
normal = { family = "JetBrainsMono Nerd Font", style = "Regular" }
|
||||
|
||||
@@ -14,39 +14,26 @@ padding.y = 10
|
||||
style.shape = "Beam"
|
||||
style.blinking = "Always"
|
||||
|
||||
# Kanagawa Wave Alacritty Colors
|
||||
[colors.primary]
|
||||
background = '#101010'
|
||||
foreground = '#dcd7ba'
|
||||
foreground = '#ebdbb2'
|
||||
|
||||
[colors.normal]
|
||||
black = '#090618'
|
||||
red = '#c34043'
|
||||
green = '#76946a'
|
||||
yellow = '#c0a36e'
|
||||
blue = '#7e9cd8'
|
||||
magenta = '#957fb8'
|
||||
cyan = '#6a9589'
|
||||
white = '#c8c093'
|
||||
black = '#282828'
|
||||
red = '#cc241d'
|
||||
green = '#98971a'
|
||||
yellow = '#d79921'
|
||||
blue = '#458588'
|
||||
magenta = '#b16286'
|
||||
cyan = '#689d6a'
|
||||
white = '#a89984'
|
||||
|
||||
[colors.bright]
|
||||
black = '#727169'
|
||||
red = '#e82424'
|
||||
green = '#98bb6c'
|
||||
yellow = '#e6c384'
|
||||
blue = '#7fb4ca'
|
||||
magenta = '#938aa9'
|
||||
cyan = '#7aa89f'
|
||||
white = '#dcd7ba'
|
||||
|
||||
[colors.selection]
|
||||
background = '#2d4f67'
|
||||
foreground = '#c8c093'
|
||||
|
||||
[[colors.indexed_colors]]
|
||||
index = 16
|
||||
color = '#ffa066'
|
||||
|
||||
[[colors.indexed_colors]]
|
||||
index = 17
|
||||
color = '#ff5d62'
|
||||
black = '#928374'
|
||||
red = '#fb4934'
|
||||
green = '#b8bb26'
|
||||
yellow = '#fabd2f'
|
||||
blue = '#83a598'
|
||||
magenta = '#d3869b'
|
||||
cyan = '#8ec07c'
|
||||
white = '#ebdbb2'
|
||||
|
||||
-107
@@ -1,107 +0,0 @@
|
||||
# ── Core ─────────────────────────────────────────────────────────────────────
|
||||
set shell bash
|
||||
set shellopts '-eu'
|
||||
set ifs "\n"
|
||||
set scrolloff 8
|
||||
set icons true
|
||||
set period 1
|
||||
set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml"
|
||||
set cursorpreviewfmt "\033[7m"
|
||||
|
||||
# ── UI ───────────────────────────────────────────────────────────────────────
|
||||
set drawbox true
|
||||
set ratios 1:2:3
|
||||
set info size:time
|
||||
set sortby natural
|
||||
set dirfirst true
|
||||
|
||||
# ── Preview ──────────────────────────────────────────────────────────────────
|
||||
set previewer ~/.local/bin/lfpreview
|
||||
set cleaner ~/.local/bin/lfcleaner
|
||||
|
||||
# ── Keybindings ──────────────────────────────────────────────────────────────
|
||||
|
||||
# unmap defaults we're replacing
|
||||
map m
|
||||
map d
|
||||
map e
|
||||
map f
|
||||
|
||||
# navigation (vim)
|
||||
map h updir
|
||||
map l open
|
||||
map j down
|
||||
map k up
|
||||
map g top
|
||||
map G bottom
|
||||
map <c-d> half-down
|
||||
map <c-u> half-up
|
||||
|
||||
# enter key — writes selection path and quits (for tmux-lf-helix script)
|
||||
map <enter> select-and-quit
|
||||
|
||||
# go-to shortcuts
|
||||
map gh cd ~
|
||||
map gc cd ~/.config
|
||||
map gd cd ~/Downloads
|
||||
map gb cd ~/bin
|
||||
|
||||
# file operations
|
||||
map dd cut
|
||||
map dD delete
|
||||
map yy copy
|
||||
map p paste
|
||||
map r rename
|
||||
map R bulk-rename
|
||||
|
||||
map . set hidden!
|
||||
map <space> toggle
|
||||
|
||||
# new file/dir
|
||||
map mf push %touch<space>
|
||||
map md push %mkdir<space>-p<space>
|
||||
|
||||
cmd extract ${{
|
||||
lfextract "$f"
|
||||
}}
|
||||
map z extract
|
||||
|
||||
# ── Commands ─────────────────────────────────────────────────────────────────
|
||||
|
||||
cmd select-and-quit &{{
|
||||
if [ -n "$fs" ]; then
|
||||
# if files are toggled/selected use those
|
||||
echo "$fs" > "$lf_selection_path_file"
|
||||
else
|
||||
# otherwise use the hovered file
|
||||
echo "$f" > "$lf_selection_path_file"
|
||||
fi
|
||||
lf -remote "send $id quit"
|
||||
}}
|
||||
|
||||
cmd bulk-rename ${{
|
||||
old=$(mktemp)
|
||||
new=$(mktemp)
|
||||
[ -n "$fs" ] && fs=$(ls)
|
||||
printf '%s\n' "$fs" > "$old"
|
||||
printf '%s\n' "$fs" > "$new"
|
||||
$EDITOR "$new"
|
||||
[ "$(wc -l < "$new")" -ne "$(wc -l < "$old")" ] && exit
|
||||
paste "$old" "$new" | while IFS= read -r names; do
|
||||
src=$(printf '%s' "$names" | cut -f1)
|
||||
dst=$(printf '%s' "$names" | cut -f2)
|
||||
[ "$src" = "$dst" ] && continue
|
||||
mv -- "$src" "$dst"
|
||||
done
|
||||
rm "$old" "$new"
|
||||
lf -remote "send $id unselect"
|
||||
}}
|
||||
|
||||
cmd open ${{
|
||||
case $(file --mime-type -b "$f") in
|
||||
text/*|application/json|application/toml|application/yaml)
|
||||
$EDITOR "$f" ;;
|
||||
*)
|
||||
xdg-open "$f" >/dev/null 2>&1 & ;;
|
||||
esac
|
||||
}}
|
||||
+6
-31
@@ -1,6 +1,7 @@
|
||||
require("vim._core.ui2").enable({})
|
||||
map = vim.keymap.set
|
||||
vim.o.termguicolors = true
|
||||
vim.o.showmode = false
|
||||
vim.o.nu = true
|
||||
vim.o.swapfile = false
|
||||
vim.o.winborder = "single"
|
||||
@@ -27,6 +28,7 @@ vim.o.completeopt = "menu,menuone,noselect,popup,fuzzy"
|
||||
vim.o.undofile = true
|
||||
vim.o.undodir = vim.fn.stdpath("state") .. "/undo"
|
||||
vim.o.errorformat = "%f(%l:%c) %m,%-G%.%#"
|
||||
vim.cmd.colorscheme('retrobox')
|
||||
-- -----------------------------
|
||||
-- @BINDS
|
||||
-- -----------------------------
|
||||
@@ -50,42 +52,15 @@ map("i", "<C-h>", vim.lsp.buf.signature_help)
|
||||
-- -----------------------------
|
||||
vim.pack.add({
|
||||
{ src = 'https://github.com/ibhagwan/fzf-lua' },
|
||||
{ src = "https://github.com/saghen/blink.lib" },
|
||||
{ src = "https://github.com/Saghen/blink.cmp" },
|
||||
{ src = 'https://github.com/neovim/nvim-lspconfig' },
|
||||
{ src = 'https://github.com/echasnovski/mini.nvim' },
|
||||
{ src = 'https://github.com/nvim-tree/nvim-tree.lua' },
|
||||
{ src = 'https://github.com/romus204/tree-sitter-manager.nvim' },
|
||||
{ src = 'https://github.com/lukas-reineke/indent-blankline.nvim' },
|
||||
{ src = 'https://github.com/rebelot/kanagawa.nvim' },
|
||||
{ src = 'https://github.com/xiyaowong/transparent.nvim' },
|
||||
{ src = "https://github.com/nvim-tree/nvim-tree.lua" },
|
||||
})
|
||||
|
||||
require("terminal")
|
||||
require("mini.completion").setup()
|
||||
require('mini.statusline').setup()
|
||||
require("mini.surround").setup()
|
||||
require("tree-sitter-manager").setup()
|
||||
require("ibl").setup({
|
||||
indent = { char = "│" },
|
||||
scope = { show_start = false, show_end = false },
|
||||
})
|
||||
vim.cmd.colorscheme('kanagawa')
|
||||
vim.api.nvim_set_hl(0, "WinSeparator", { fg = "#54546D" })
|
||||
|
||||
-- Lsp specific, uses nvim-lspconfigs with the below
|
||||
vim.lsp.enable({ "gopls", "ols" })
|
||||
map("n", "gd", ":lua vim.lsp.buf.definition()<CR>")
|
||||
map("n", "gr", ":lua vim.lsp.buf.rename()<CR>")
|
||||
map("n", "ga", ":lua vim.lsp.buf.code_action()<CR>")
|
||||
|
||||
require("fzf-lua").setup({})
|
||||
map("n", "<C-p>", ":FzfLua files<CR>")
|
||||
map("n", "<C-m>", ":FzfLua buffers<CR>")
|
||||
map("n", "<C-i>", ":FzfLua diagnostics_workspace<CR>")
|
||||
map("n", "<C-f>", ":FzfLua live_grep<CR>")
|
||||
map("n", "<C-b>", ":FzfLua grep_curbuf<CR>")
|
||||
|
||||
require("nvim-tree").setup()
|
||||
map("n", "<C-e>", ":NvimTreeToggle<CR>")
|
||||
require("plugins")()
|
||||
-- -----------------------------
|
||||
-- @AUTOCMDS
|
||||
-- -----------------------------
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
local map = vim.keymap.set
|
||||
|
||||
local blink = require("blink.cmp")
|
||||
|
||||
blink.setup({
|
||||
keymap = {
|
||||
["<Tab>"] = {
|
||||
"select_next",
|
||||
"fallback",
|
||||
},
|
||||
|
||||
["<S-Tab>"] = {
|
||||
"select_prev",
|
||||
"fallback",
|
||||
},
|
||||
|
||||
["<C-n>"] = {
|
||||
"select_next",
|
||||
"fallback",
|
||||
},
|
||||
|
||||
["<C-p>"] = {
|
||||
"select_prev",
|
||||
"fallback",
|
||||
},
|
||||
|
||||
["<CR>"] = {
|
||||
"accept",
|
||||
"fallback",
|
||||
},
|
||||
|
||||
["<C-Space>"] = {
|
||||
"show",
|
||||
"show_documentation",
|
||||
"hide_documentation",
|
||||
},
|
||||
|
||||
["<Esc>"] = {
|
||||
"hide",
|
||||
"fallback",
|
||||
},
|
||||
},
|
||||
|
||||
appearance = {
|
||||
nerd_font_variant = "normal",
|
||||
},
|
||||
|
||||
completion = {
|
||||
menu = {
|
||||
border = "single",
|
||||
},
|
||||
|
||||
documentation = {
|
||||
auto_show = true,
|
||||
auto_show_delay_ms = 200,
|
||||
|
||||
window = {
|
||||
border = "single",
|
||||
},
|
||||
},
|
||||
|
||||
ghost_text = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
|
||||
signature = {
|
||||
enabled = true,
|
||||
},
|
||||
|
||||
sources = {
|
||||
default = {
|
||||
"lsp",
|
||||
"path",
|
||||
"buffer",
|
||||
},
|
||||
},
|
||||
|
||||
fuzzy = { implementation = "lua", },
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,35 @@
|
||||
local M = {}
|
||||
|
||||
local function build(args)
|
||||
if vim.fn.filereadable("build.sh") == 0 then
|
||||
vim.notify("No build.sh found in current directory.", vim.log.levels.WARN)
|
||||
return
|
||||
end
|
||||
|
||||
vim.cmd("wall")
|
||||
|
||||
local command = "./build.sh"
|
||||
|
||||
if #args > 0 then
|
||||
command = command .. " " .. table.concat(args, " ")
|
||||
end
|
||||
|
||||
require("terminal").send("clear && " .. command)
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
vim.api.nvim_create_user_command(
|
||||
"Build",
|
||||
function(opts) build(opts.fargs) end,
|
||||
{
|
||||
nargs = "*",
|
||||
desc = "Run project build.sh",
|
||||
}
|
||||
)
|
||||
|
||||
local map = vim.keymap.set
|
||||
map("n", "<C-Space>", function() build({}) end, { desc = "Build project", })
|
||||
map("t", "<C-Space>", function() build({}) end, { desc = "Build project", })
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,49 @@
|
||||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
local map = vim.keymap.set
|
||||
|
||||
require("nvim-tree").setup({
|
||||
view = {
|
||||
width = 35,
|
||||
side = "left",
|
||||
},
|
||||
renderer = {
|
||||
icons = {
|
||||
show = {
|
||||
file = false,
|
||||
folder = false,
|
||||
folder_arrow = false,
|
||||
git = false,
|
||||
diagnostics = false,
|
||||
modified = false,
|
||||
bookmarks = false,
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
},
|
||||
git = {
|
||||
enable = false,
|
||||
},
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
on_attach = function(bufnr)
|
||||
local api = require("nvim-tree.api")
|
||||
api.config.mappings.default_on_attach(bufnr)
|
||||
vim.keymap.del("n", "<C-e>", { buffer = bufnr })
|
||||
vim.opt_local.statusline = " "
|
||||
end,
|
||||
})
|
||||
|
||||
map("n", "<C-e>", "<Cmd>NvimTreeToggle<CR>", { desc = "Toggle file tree", })
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,15 @@
|
||||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
local map = vim.keymap.set
|
||||
|
||||
require("fzf-lua").setup({})
|
||||
|
||||
map("n", "<C-p>", "<Cmd>FzfLua files<CR>")
|
||||
map("n", "<C-m>", "<Cmd>FzfLua buffers<CR>")
|
||||
map("n", "<C-i>", "<Cmd>FzfLua diagnostics_workspace<CR>")
|
||||
map("n", "<C-f>", "<Cmd>FzfLua live_grep<CR>")
|
||||
map("n", "<C-b>", "<Cmd>FzfLua grep_curbuf<CR>")
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,16 @@
|
||||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
require("ibl").setup({
|
||||
indent = {
|
||||
char = "│",
|
||||
},
|
||||
|
||||
scope = {
|
||||
show_start = false,
|
||||
show_end = false,
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,39 @@
|
||||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
local map = vim.keymap.set
|
||||
|
||||
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||
|
||||
vim.lsp.config("gopls", {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.lsp.config("ols", {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.lsp.enable({
|
||||
"gopls",
|
||||
"ols",
|
||||
})
|
||||
|
||||
map("n", "gd", vim.lsp.buf.definition)
|
||||
map("n", "gD", vim.lsp.buf.declaration)
|
||||
map("n", "gi", vim.lsp.buf.implementation)
|
||||
map("n", "gr", vim.lsp.buf.references)
|
||||
|
||||
map("n", "K", vim.lsp.buf.hover)
|
||||
map("i", "<C-h>", vim.lsp.buf.signature_help)
|
||||
|
||||
map("n", "<leader>rn", vim.lsp.buf.rename)
|
||||
map("n", "<leader>ca", vim.lsp.buf.code_action)
|
||||
|
||||
map("n", "[d", vim.diagnostic.goto_prev)
|
||||
map("n", "]d", vim.diagnostic.goto_next)
|
||||
|
||||
map("n", "<leader>d", vim.diagnostic.open_float)
|
||||
map("n", "<leader>q", vim.diagnostic.setloclist)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,15 @@
|
||||
return function()
|
||||
require("fuzzyfinder").setup()
|
||||
require("treesitter").setup()
|
||||
require("indent").setup()
|
||||
require("autocomplete").setup()
|
||||
require("lsp").setup()
|
||||
require("terminal").setup()
|
||||
require("filetree").setup()
|
||||
require("build").setup()
|
||||
require("statusbar").setup({
|
||||
bg = "#111111",
|
||||
fg = "#ffffff",
|
||||
separator = " │ ",
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,188 @@
|
||||
local M = {}
|
||||
|
||||
local config = {
|
||||
bg = "#202020",
|
||||
fg = "#ffffff",
|
||||
separator = " │ ",
|
||||
}
|
||||
|
||||
local mode_names = {
|
||||
["n"] = "NORMAL",
|
||||
["no"] = "NORMAL",
|
||||
["nov"] = "NORMAL",
|
||||
["noV"] = "NORMAL",
|
||||
["no\22"] = "NORMAL",
|
||||
["niI"] = "NORMAL",
|
||||
["niR"] = "NORMAL",
|
||||
["niV"] = "NORMAL",
|
||||
|
||||
["i"] = "INSERT",
|
||||
["ic"] = "INSERT",
|
||||
["ix"] = "INSERT",
|
||||
|
||||
["v"] = "VISUAL",
|
||||
["V"] = "V-LINE",
|
||||
["\22"] = "V-BLOCK",
|
||||
|
||||
["s"] = "SELECT",
|
||||
["S"] = "S-LINE",
|
||||
["\19"] = "S-BLOCK",
|
||||
|
||||
["R"] = "REPLACE",
|
||||
["Rc"] = "REPLACE",
|
||||
["Rv"] = "V-REPLACE",
|
||||
|
||||
["c"] = "COMMAND",
|
||||
["cv"] = "COMMAND",
|
||||
["ce"] = "COMMAND",
|
||||
|
||||
["r"] = "PROMPT",
|
||||
["rm"] = "MORE",
|
||||
["r?"] = "CONFIRM",
|
||||
|
||||
["!"] = "SHELL",
|
||||
["t"] = "TERMINAL",
|
||||
}
|
||||
|
||||
local function mode()
|
||||
return mode_names[vim.fn.mode()] or "UNKNOWN"
|
||||
end
|
||||
|
||||
local function filename()
|
||||
local name = vim.fn.expand("%:t")
|
||||
|
||||
if name == "" then
|
||||
return "[No Name]"
|
||||
end
|
||||
|
||||
return name
|
||||
end
|
||||
|
||||
local function git_branch()
|
||||
local branch = vim.b.gitsigns_head
|
||||
|
||||
if branch and branch ~= "" then
|
||||
return " " .. branch
|
||||
end
|
||||
|
||||
return ""
|
||||
end
|
||||
|
||||
local function filetype()
|
||||
if vim.bo.filetype == "" then
|
||||
return "text"
|
||||
end
|
||||
|
||||
return vim.bo.filetype
|
||||
end
|
||||
|
||||
local function active_lsp()
|
||||
local clients = vim.lsp.get_clients({
|
||||
bufnr = 0,
|
||||
})
|
||||
|
||||
if #clients == 0 then
|
||||
return "-"
|
||||
end
|
||||
|
||||
local names = {}
|
||||
|
||||
for _, client in ipairs(clients) do
|
||||
table.insert(names, client.name)
|
||||
end
|
||||
|
||||
return table.concat(names, ",")
|
||||
end
|
||||
|
||||
local function diagnostics()
|
||||
local errors = #vim.diagnostic.get(0, {
|
||||
severity = vim.diagnostic.severity.ERROR,
|
||||
})
|
||||
|
||||
if errors > 0 then
|
||||
return "%#StatusError#●%*"
|
||||
end
|
||||
|
||||
local warnings = #vim.diagnostic.get(0, {
|
||||
severity = vim.diagnostic.severity.WARN,
|
||||
})
|
||||
|
||||
if warnings > 0 then
|
||||
return "%#StatusWarn#●%*"
|
||||
end
|
||||
|
||||
return "%#StatusNormal#●%*"
|
||||
end
|
||||
|
||||
local function position()
|
||||
return string.format("%d:%d", vim.fn.line("."), vim.fn.col("."))
|
||||
end
|
||||
|
||||
local function build()
|
||||
local left = table.concat({
|
||||
" ",
|
||||
mode(),
|
||||
config.separator,
|
||||
diagnostics(),
|
||||
config.separator,
|
||||
filename(),
|
||||
})
|
||||
|
||||
local right = {}
|
||||
|
||||
local branch = git_branch()
|
||||
|
||||
if branch ~= "" then
|
||||
table.insert(right, branch)
|
||||
end
|
||||
|
||||
table.insert(right, filetype())
|
||||
table.insert(right, active_lsp())
|
||||
table.insert(right, position())
|
||||
|
||||
return left
|
||||
.. "%="
|
||||
.. " "
|
||||
.. table.concat(right, config.separator)
|
||||
.. " "
|
||||
end
|
||||
|
||||
function M.setup(opts)
|
||||
config = vim.tbl_extend("force", config, opts or {})
|
||||
|
||||
vim.api.nvim_set_hl(0, "StatusLine", {
|
||||
fg = config.fg,
|
||||
bg = config.bg,
|
||||
})
|
||||
|
||||
vim.api.nvim_set_hl(0, "StatusLineNC", {
|
||||
fg = config.fg,
|
||||
bg = config.bg,
|
||||
})
|
||||
|
||||
vim.api.nvim_set_hl(0, "StatusNormal", {
|
||||
fg = "#808080",
|
||||
bg = config.bg,
|
||||
})
|
||||
|
||||
vim.api.nvim_set_hl(0, "StatusLsp", {
|
||||
fg = "#61afef",
|
||||
bg = config.bg,
|
||||
})
|
||||
|
||||
vim.api.nvim_set_hl(0, "StatusWarn", {
|
||||
fg = "#e5c07b",
|
||||
bg = config.bg,
|
||||
})
|
||||
|
||||
vim.api.nvim_set_hl(0, "StatusError", {
|
||||
fg = "#e06c75",
|
||||
bg = config.bg,
|
||||
})
|
||||
|
||||
_G.StatusBar = build
|
||||
|
||||
vim.o.statusline = "%!v:lua.StatusBar()"
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,58 +1,96 @@
|
||||
local M = {}
|
||||
|
||||
local term_buf = nil
|
||||
|
||||
local function open_term_split()
|
||||
vim.cmd('botright vsplit')
|
||||
local win = vim.api.nvim_get_current_win()
|
||||
if term_buf and vim.api.nvim_buf_is_valid(term_buf) then
|
||||
vim.api.nvim_win_set_buf(win, term_buf)
|
||||
else
|
||||
vim.cmd('terminal')
|
||||
term_buf = vim.api.nvim_get_current_buf()
|
||||
end
|
||||
vim.api.nvim_win_set_width(win, math.floor(vim.o.columns * 0.37))
|
||||
vim.cmd('startinsert')
|
||||
vim.cmd("botright vsplit")
|
||||
|
||||
local win = vim.api.nvim_get_current_win()
|
||||
|
||||
if term_buf and vim.api.nvim_buf_is_valid(term_buf) then
|
||||
vim.api.nvim_win_set_buf(win, term_buf)
|
||||
else
|
||||
vim.cmd("terminal")
|
||||
term_buf = vim.api.nvim_get_current_buf()
|
||||
end
|
||||
|
||||
vim.api.nvim_win_set_width(win, math.floor(vim.o.columns * 0.37))
|
||||
vim.cmd("startinsert")
|
||||
end
|
||||
|
||||
local function toggle_term()
|
||||
-- Check if terminal is already visible in a window
|
||||
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
||||
if vim.api.nvim_win_get_buf(win) == term_buf then
|
||||
vim.api.nvim_win_close(win, false)
|
||||
return
|
||||
end
|
||||
end
|
||||
open_term_split()
|
||||
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
||||
if vim.api.nvim_win_get_buf(win) == term_buf then
|
||||
vim.api.nvim_win_close(win, false)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
open_term_split()
|
||||
end
|
||||
|
||||
local function open_term_fullscreen()
|
||||
if term_buf and vim.api.nvim_buf_is_valid(term_buf) then
|
||||
vim.api.nvim_set_current_buf(term_buf)
|
||||
else
|
||||
vim.cmd('terminal')
|
||||
term_buf = vim.api.nvim_get_current_buf()
|
||||
end
|
||||
vim.cmd('startinsert')
|
||||
if term_buf and vim.api.nvim_buf_is_valid(term_buf) then
|
||||
vim.api.nvim_set_current_buf(term_buf)
|
||||
else
|
||||
vim.cmd("terminal")
|
||||
term_buf = vim.api.nvim_get_current_buf()
|
||||
end
|
||||
|
||||
vim.cmd("startinsert")
|
||||
end
|
||||
|
||||
local function prev_non_term_buf()
|
||||
local cur = vim.api.nvim_get_current_buf()
|
||||
local bufs = vim.fn.getbufinfo({ buflisted = 1 })
|
||||
local candidates = {}
|
||||
for _, info in ipairs(bufs) do
|
||||
if info.bufnr ~= cur and vim.bo[info.bufnr].buftype ~= 'terminal' then
|
||||
table.insert(candidates, info)
|
||||
end
|
||||
end
|
||||
if #candidates == 0 then
|
||||
print('No previous non-terminal buffer')
|
||||
return
|
||||
end
|
||||
table.sort(candidates, function(a, b) return a.lastused > b.lastused end)
|
||||
vim.api.nvim_set_current_buf(candidates[1].bufnr)
|
||||
local current = vim.api.nvim_get_current_buf()
|
||||
local buffers = vim.fn.getbufinfo({ buflisted = 1 })
|
||||
local candidates = {}
|
||||
|
||||
for _, buffer in ipairs(buffers) do
|
||||
if buffer.bufnr ~= current and vim.bo[buffer.bufnr].buftype ~= "terminal" then
|
||||
table.insert(candidates, buffer)
|
||||
end
|
||||
end
|
||||
|
||||
if #candidates == 0 then
|
||||
print("No previous non-terminal buffer")
|
||||
return
|
||||
end
|
||||
|
||||
table.sort(candidates, function(a, b)
|
||||
return a.lastused > b.lastused
|
||||
end)
|
||||
|
||||
vim.api.nvim_set_current_buf(candidates[1].bufnr)
|
||||
end
|
||||
|
||||
map('n', '<C-j>', toggle_term, { desc = 'Toggle terminal split' })
|
||||
map('n', '<C-o>', open_term_fullscreen, { desc = 'Open terminal fullscreen' })
|
||||
map('t', '<C-o>', prev_non_term_buf, { desc = 'Exit terminal mode' })
|
||||
map('t', '<C-j>', toggle_term, { desc = 'Toggle terminal split' })
|
||||
map('t', '<C-o>', prev_non_term_buf, { desc = 'Exit terminal mode' })
|
||||
function M.setup()
|
||||
local map = vim.keymap.set
|
||||
|
||||
map("n", "<C-j>", toggle_term, { desc = "Toggle terminal split", })
|
||||
map("n", "<C-o>", open_term_fullscreen, { desc = "Open terminal fullscreen", })
|
||||
map("t", "<C-j>", toggle_term, { desc = "Toggle terminal split", })
|
||||
map("t", "<C-o>", prev_non_term_buf, { desc = "Return to previous buffer", })
|
||||
end
|
||||
|
||||
function M.send(command)
|
||||
local terminal_visible = false
|
||||
|
||||
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
||||
if term_buf and vim.api.nvim_win_get_buf(win) == term_buf then
|
||||
terminal_visible = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not terminal_visible then
|
||||
open_term_split()
|
||||
end
|
||||
|
||||
local job = vim.b[term_buf].terminal_job_id
|
||||
|
||||
if job then
|
||||
vim.api.nvim_chan_send(job, command .. "\n")
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
require("tree-sitter-manager").setup()
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"folders":
|
||||
[
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,435 +0,0 @@
|
||||
{
|
||||
"auto_complete":
|
||||
{
|
||||
"selected_items":
|
||||
[
|
||||
]
|
||||
},
|
||||
"buffers":
|
||||
[
|
||||
{
|
||||
"contents": "",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 0,
|
||||
"line_ending": "Unix"
|
||||
}
|
||||
}
|
||||
],
|
||||
"build_system": "",
|
||||
"build_system_choices":
|
||||
[
|
||||
],
|
||||
"build_varint": "",
|
||||
"command_palette":
|
||||
{
|
||||
"height": 0.0,
|
||||
"last_filter": "",
|
||||
"selected_items":
|
||||
[
|
||||
[
|
||||
"key",
|
||||
"Preferences: Key Bindings"
|
||||
],
|
||||
[
|
||||
"toggle ",
|
||||
"View: Toggle Tabs"
|
||||
],
|
||||
[
|
||||
"terminal set",
|
||||
"Preferences: Terminal Settings"
|
||||
],
|
||||
[
|
||||
"install pacakge",
|
||||
"Package Control: Install Package"
|
||||
],
|
||||
[
|
||||
"remove packa",
|
||||
"Package Control: Remove Package"
|
||||
],
|
||||
[
|
||||
"termi",
|
||||
"Terminus: Toggle Panel"
|
||||
],
|
||||
[
|
||||
"colo",
|
||||
"UI: Select Color Scheme"
|
||||
],
|
||||
[
|
||||
"ui",
|
||||
"UI: Select Color Scheme"
|
||||
],
|
||||
[
|
||||
"setting",
|
||||
"Preferences: Settings"
|
||||
],
|
||||
[
|
||||
"ke",
|
||||
"Preferences: Key Bindings"
|
||||
],
|
||||
[
|
||||
"insta",
|
||||
"Package Control: Install Package"
|
||||
],
|
||||
[
|
||||
"remove",
|
||||
"Package Control: Remove Package"
|
||||
],
|
||||
[
|
||||
"settin",
|
||||
"Preferences: Settings"
|
||||
],
|
||||
[
|
||||
"ui ",
|
||||
"UI: Select Theme"
|
||||
],
|
||||
[
|
||||
"keybinds",
|
||||
"Preferences: Key Bindings"
|
||||
],
|
||||
[
|
||||
"lsp",
|
||||
"Preferences: LSP Settings"
|
||||
],
|
||||
[
|
||||
"keyb",
|
||||
"Preferences: Key Bindings"
|
||||
],
|
||||
[
|
||||
"install",
|
||||
"Package Control: Install Package"
|
||||
],
|
||||
[
|
||||
"inst",
|
||||
"Package Control: Install Package"
|
||||
],
|
||||
[
|
||||
"tab",
|
||||
"View: Toggle Tabs"
|
||||
],
|
||||
[
|
||||
"theme",
|
||||
"UI: Customize Color Scheme"
|
||||
],
|
||||
[
|
||||
"tabs",
|
||||
"View: Toggle Tabs"
|
||||
],
|
||||
[
|
||||
"mini",
|
||||
"View: Toggle Minimap"
|
||||
],
|
||||
[
|
||||
"color",
|
||||
"UI: Select Color Scheme"
|
||||
],
|
||||
[
|
||||
"Ui",
|
||||
"UI: Select Color Scheme"
|
||||
],
|
||||
[
|
||||
"instal",
|
||||
"Package Control: Install Package"
|
||||
],
|
||||
[
|
||||
"remove ",
|
||||
"Package Control: Remove Package"
|
||||
],
|
||||
[
|
||||
"settings",
|
||||
"Preferences: Settings"
|
||||
],
|
||||
[
|
||||
"cust",
|
||||
"UI: Customize Theme"
|
||||
],
|
||||
[
|
||||
"custom",
|
||||
"UI: Customize Color Scheme"
|
||||
],
|
||||
[
|
||||
"color scheme",
|
||||
"UI: Select Color Scheme"
|
||||
],
|
||||
[
|
||||
"ins",
|
||||
"Package Control: Install Package"
|
||||
]
|
||||
],
|
||||
"width": 0.0
|
||||
},
|
||||
"console":
|
||||
{
|
||||
"height": 250.0,
|
||||
"history":
|
||||
[
|
||||
"sublime.log_commands(True)"
|
||||
]
|
||||
},
|
||||
"distraction_free":
|
||||
{
|
||||
"menu_visible": true,
|
||||
"show_minimap": false,
|
||||
"show_open_files": false,
|
||||
"show_tabs": false,
|
||||
"side_bar_visible": false,
|
||||
"status_bar_visible": false
|
||||
},
|
||||
"expanded_folders":
|
||||
[
|
||||
"/home/jason/.dotfiles",
|
||||
"/home/jason/.dotfiles/config",
|
||||
"/home/jason/.dotfiles/config/awesome",
|
||||
"/home/jason/.dotfiles/config/awesome/config",
|
||||
"/home/jason/.dotfiles/config/nvim"
|
||||
],
|
||||
"file_history":
|
||||
[
|
||||
"/home/jason/.dotfiles/config/awesome/config/rules.lua",
|
||||
"/home/jason/.dotfiles/config/awesome/config/theme.lua",
|
||||
"/home/jason/.dotfiles/config/awesome/rc.lua",
|
||||
"/home/jason/.dotfiles/config/nvim/init.lua",
|
||||
"/home/jason/.dotfiles/scripts/installs/install_odin",
|
||||
"/home/jason/.dotfiles/scripts/bin/bookmarks",
|
||||
"/home/jason/.dotfiles/config/alacritty/alacritty.toml",
|
||||
"/home/jason/.dotfiles/scripts/installs/install_php",
|
||||
"/home/jason/.dotfiles/install.sh",
|
||||
"/home/jason/.dotfiles/.gitignore",
|
||||
"/home/jason/.config/sublime-text/Packages/User/Find Results.sublime-settings",
|
||||
"/home/jason/.config/sublime-text/Packages/BetterFindBuffer/Find Results.sublime-settings",
|
||||
"/home/jason/.dotfiles/README.md",
|
||||
"/home/jason/.config/sublime-text/Packages/BetterFindBuffer/BetterFindBuffer.sublime-settings",
|
||||
"/home/jason/.config/sublime-text/Packages/User/BetterFindBuffer.sublime-settings",
|
||||
"/home/jason/.config/sublime-text/Packages/Default/Preferences.sublime-settings",
|
||||
"/home/jason/.config/sublime-text/Packages/User/Default (Linux).sublime-keymap",
|
||||
"/home/jason/.config/sublime-text/Packages/Default/Default (Linux).sublime-keymap",
|
||||
"/home/jason/Projects/octal_cookie/src/machine/cpu.odin",
|
||||
"/home/jason/.dotfiles/config/nvim/nvim-pack-lock.json",
|
||||
"/home/jason/.dotfiles/config/kanata/kanata.kbd"
|
||||
],
|
||||
"find":
|
||||
{
|
||||
"height": 51.0
|
||||
},
|
||||
"find_in_files":
|
||||
{
|
||||
"height": 175.0,
|
||||
"where_history":
|
||||
[
|
||||
]
|
||||
},
|
||||
"find_state":
|
||||
{
|
||||
"case_sensitive": false,
|
||||
"find_history":
|
||||
[
|
||||
],
|
||||
"highlight": true,
|
||||
"in_selection": false,
|
||||
"preserve_case": false,
|
||||
"regex": false,
|
||||
"replace_history":
|
||||
[
|
||||
],
|
||||
"reverse": false,
|
||||
"scrollbar_highlights": true,
|
||||
"show_context": true,
|
||||
"use_buffer2": true,
|
||||
"use_gitignore": true,
|
||||
"whole_word": false,
|
||||
"wrap": true
|
||||
},
|
||||
"groups":
|
||||
[
|
||||
{
|
||||
"sheets":
|
||||
[
|
||||
{
|
||||
"buffer": 0,
|
||||
"selected": true,
|
||||
"semi_transient": false,
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 0,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
0,
|
||||
0
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"lsp_uri": "buffer:156",
|
||||
"syntax": "Packages/Text/Plain text.tmLanguage"
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 0.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"stack_index": 0,
|
||||
"stack_multiselect": false,
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"incremental_find":
|
||||
{
|
||||
"height": 51.0
|
||||
},
|
||||
"input":
|
||||
{
|
||||
"height": 73.0
|
||||
},
|
||||
"layout":
|
||||
{
|
||||
"cells":
|
||||
[
|
||||
[
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1
|
||||
]
|
||||
],
|
||||
"cols":
|
||||
[
|
||||
0.0,
|
||||
1.0
|
||||
],
|
||||
"rows":
|
||||
[
|
||||
0.0,
|
||||
1.0
|
||||
]
|
||||
},
|
||||
"menu_visible": false,
|
||||
"output.LSP Log Panel":
|
||||
{
|
||||
"height": 0.0,
|
||||
"history":
|
||||
[
|
||||
]
|
||||
},
|
||||
"output.buffers":
|
||||
{
|
||||
"height": 1116.0,
|
||||
"history":
|
||||
[
|
||||
]
|
||||
},
|
||||
"output.diagnostics":
|
||||
{
|
||||
"height": 0.0,
|
||||
"history":
|
||||
[
|
||||
]
|
||||
},
|
||||
"output.find_results":
|
||||
{
|
||||
"height": 0.0,
|
||||
"history":
|
||||
[
|
||||
]
|
||||
},
|
||||
"output.mdpopups":
|
||||
{
|
||||
"height": 0.0,
|
||||
"history":
|
||||
[
|
||||
]
|
||||
},
|
||||
"pinned_build_system": "",
|
||||
"project": "dotfiles.sublime-project",
|
||||
"replace":
|
||||
{
|
||||
"height": 98.0
|
||||
},
|
||||
"save_all_on_build": true,
|
||||
"select_file":
|
||||
{
|
||||
"height": 0.0,
|
||||
"last_filter": "",
|
||||
"selected_items":
|
||||
[
|
||||
[
|
||||
"awesomeconfig/",
|
||||
"config/awesome/config/rules.lua"
|
||||
],
|
||||
[
|
||||
"awesome/",
|
||||
"config/awesome/rc.lua"
|
||||
],
|
||||
[
|
||||
"install_od",
|
||||
"scripts/installs/install_odin"
|
||||
],
|
||||
[
|
||||
"ini",
|
||||
"config/nvim/init.lua"
|
||||
],
|
||||
[
|
||||
"cpu",
|
||||
"src/machine/cpu.odin"
|
||||
],
|
||||
[
|
||||
"nvim",
|
||||
"config/nvim/nvim-pack-lock.json"
|
||||
]
|
||||
],
|
||||
"width": 0.0
|
||||
},
|
||||
"select_project":
|
||||
{
|
||||
"height": 657.0,
|
||||
"last_filter": "",
|
||||
"selected_items":
|
||||
[
|
||||
[
|
||||
"",
|
||||
"~/Projects/octal_cookie/octal_cookie.sublime-project"
|
||||
],
|
||||
[
|
||||
"gra",
|
||||
"~/Projects/gravekeeper/gravekeeper.sublime-project"
|
||||
],
|
||||
[
|
||||
"oc",
|
||||
"~/Projects/octal_cookie/octal_cookie.sublime-project"
|
||||
],
|
||||
[
|
||||
"do",
|
||||
"~/.dotfiles/dotfiles.sublime-project"
|
||||
]
|
||||
],
|
||||
"width": 499.0
|
||||
},
|
||||
"select_symbol":
|
||||
{
|
||||
"height": 0.0,
|
||||
"last_filter": "",
|
||||
"selected_items":
|
||||
[
|
||||
],
|
||||
"width": 0.0
|
||||
},
|
||||
"selected_group": 0,
|
||||
"settings":
|
||||
{
|
||||
"_vintageous_reset_during_init": true,
|
||||
"lsp_show_inlay_hints": false
|
||||
},
|
||||
"show_minimap": false,
|
||||
"show_open_files": false,
|
||||
"show_tabs": false,
|
||||
"side_bar_visible": true,
|
||||
"side_bar_width": 481.0,
|
||||
"status_bar_visible": true,
|
||||
"template_settings":
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# rofi-bookmarks: pick a Chromium bookmark and open it (new tab or new window)
|
||||
|
||||
set -euo pipefail
|
||||
awesome-client 'show_dim()' >/dev/null 2>&1
|
||||
|
||||
BOOKMARKS_FILE="$HOME/.config/chromium/Default/Bookmarks"
|
||||
|
||||
if [ ! -f "$BOOKMARKS_FILE" ]; then
|
||||
notify-send "Bookmarks" "Chromium bookmarks file not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Recursively walk the bookmark tree (roots -> bookmark_bar / other / synced)
|
||||
# and emit "title\turl" for every leaf ("type": "url"), skipping folders.
|
||||
list=$(jq -r '
|
||||
def walk_nodes:
|
||||
if .type == "url" then
|
||||
"\(.name)\t\(.url)"
|
||||
elif .children then
|
||||
.children[] | walk_nodes
|
||||
else
|
||||
empty
|
||||
end;
|
||||
.roots | to_entries[] | .value | walk_nodes
|
||||
' "$BOOKMARKS_FILE")
|
||||
|
||||
if [ -z "$list" ]; then
|
||||
notify-send "Bookmarks" "No bookmarks found"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
chosen=$(echo "$list" | awk -F'\t' '{print $1}' | rofi -dmenu -i -p "Bookmarks" \
|
||||
-theme-str 'listview { lines: 5; }' \
|
||||
-theme-str 'window { width: 21%; }' \
|
||||
-theme-str 'window { height: 400px; }')
|
||||
|
||||
[ -z "$chosen" ] && exit 0
|
||||
|
||||
url=$(echo "$list" | awk -F'\t' -v title="$chosen" '$1 == title { print $2; exit }')
|
||||
|
||||
[ -z "$url" ] && exit 0
|
||||
|
||||
# Open in a new tab of the existing Chromium window if one's running,
|
||||
# otherwise this also launches Chromium fresh with that tab.
|
||||
librewolf --new-tab "$url"
|
||||
trap 'awesome-client "hide_dim()" >/dev/null 2>&1' EXIT
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Nothing to clean for the previewer above, but lf requires this script.
|
||||
exit 0
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
for file in "$@"; do
|
||||
case "$file" in
|
||||
*.tar) tar xvf "$file" ;;
|
||||
*.tar.gz|*.tgz) tar xzvf "$file" ;;
|
||||
*.tar.bz2|*.tbz2) tar xjvf "$file" ;;
|
||||
*.tar.xz|*.txz) tar xJvf "$file" ;;
|
||||
*.zip) unzip "$file" ;;
|
||||
*.rar) unrar x "$file" ;;
|
||||
*.7z) 7z x "$file" ;;
|
||||
*.gz) gunzip "$file" ;;
|
||||
*.bz2) bunzip2 "$file" ;;
|
||||
*.xz) unxz "$file" ;;
|
||||
*) echo "Unknown archive type: $file" ;;
|
||||
esac
|
||||
done
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
file="$1"
|
||||
w="$2"
|
||||
h="$3"
|
||||
|
||||
case "$(file -Lb --mime-type "$file")" in
|
||||
text/*|application/json|application/x-empty|inode/x-empty)
|
||||
bat --theme="ansi" --color=always --style=numbers --line-range=:500 --terminal-width="$w" "$file"
|
||||
;;
|
||||
image/*)
|
||||
echo "Image: $file"
|
||||
;;
|
||||
application/pdf)
|
||||
pdftotext -l 10 -nopgbrk -q "$file" - | fold -s -w "$w"
|
||||
;;
|
||||
application/zip|application/x-tar|application/x-rar|application/x-7z-compressed|application/gzip|application/x-bzip2|application/x-xz)
|
||||
echo "Archive: $file"
|
||||
echo
|
||||
case "$file" in
|
||||
*.zip) unzip -l "$file" ;;
|
||||
*.tar|*.tar.*|*.tgz) tar tf "$file" ;;
|
||||
*.rar) unrar l "$file" ;;
|
||||
*.7z) 7z l "$file" ;;
|
||||
*) echo "Archive listing not supported" ;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
file -Lb "$file"
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user