Compare commits

..

5 Commits

Author SHA1 Message Date
Buddy Sandidge 5c6815a6f9 Update external 10 months ago
Buddy Sandidge 5e80781558 Add floating terminal to nvim config 10 months ago
Buddy Sandidge cc13e44e9f Update protobufs 10 months ago
Buddy Sandidge edc517757b Update plugins 10 months ago
Buddy Sandidge 233dba0dfe Update buf 10 months ago

@ -2,7 +2,7 @@
#{{- /* vim: set filetype=toml: */ -}}
[".local/share/nvim/lazy/lazy.nvim"]
type = "archive"
url = "https://github.com/folke/lazy.nvim/archive/refs/tags/v11.16.0.tar.gz"
url = "https://github.com/folke/lazy.nvim/archive/refs/tags/v11.16.2.tar.gz"
exact = true
stripComponents = 1
refreshPeriod = "2196h"
@ -10,25 +10,25 @@
#{{ if eq .chezmoi.os "linux" }}
[".local/share/fonts/BitstreamVeraSansMono"]
type = "archive"
url = "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/BitstreamVeraSansMono.zip"
url = "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.3.0/BitstreamVeraSansMono.zip"
exclude = [".uuid"]
refreshPeriod = "2196h"
[".local/share/fonts/IBMPlexMono"]
type = "archive"
url = "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/IBMPlexMono.zip"
url = "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.3.0/IBMPlexMono.zip"
exclude = [".uuid"]
refreshPeriod = "2196h"
[".local/share/fonts/JetBrainsMono"]
type = "archive"
url = "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/JetBrainsMono.zip"
url = "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.3.0/JetBrainsMono.zip"
exclude = [".uuid"]
refreshPeriod = "2196h"
[".local/bin/nvim.appimage"]
type = "file"
url = "https://github.com/neovim/neovim/releases/download/v0.10.0/nvim.appimage"
url = "https://github.com/neovim/neovim/releases/download/v0.10.2/nvim.appimage"
executable = true
refreshPeriod = "2196h"
#{{ end }}

@ -1,154 +1,10 @@
# Nushell Config File
#
# version = "0.100.0"
# For more information on defining custom themes, see
# https://www.nushell.sh/book/coloring_and_theming.html
# And here is the theme collection
# https://github.com/nushell/nu_scripts/tree/main/themes
let dark_theme = {
# color for nushell primitives
separator: white
# no fg, no bg, attr none effectively turns this off
leading_trailing_space_bg: { attr: n }
header: green_bold
empty: blue
# Closures can be used to choose colors for specific values.
# The value (in this case, a bool) is piped into the closure.
# eg) {|| if $in { 'light_cyan' } else { 'light_gray' } }
bool: light_cyan
int: white
filesize: cyan
duration: white
date: purple
range: white
float: white
string: white
nothing: white
binary: white
cell-path: white
row_index: green_bold
record: white
list: white
block: white
hints: dark_gray
search_result: { bg: red fg: white }
shape_and: purple_bold
shape_binary: purple_bold
shape_block: blue_bold
shape_bool: light_cyan
shape_closure: green_bold
shape_custom: green
shape_datetime: cyan_bold
shape_directory: cyan
shape_external: cyan
shape_externalarg: green_bold
shape_external_resolved: light_yellow_bold
shape_filepath: cyan
shape_flag: blue_bold
shape_float: purple_bold
# shapes are used to change the cli syntax highlighting
shape_garbage: { fg: white bg: red attr: b }
shape_glob_interpolation: cyan_bold
shape_globpattern: cyan_bold
shape_int: purple_bold
shape_internalcall: cyan_bold
shape_keyword: cyan_bold
shape_list: cyan_bold
shape_literal: blue
shape_match_pattern: green
shape_matching_brackets: { attr: u }
shape_nothing: light_cyan
shape_operator: yellow
shape_or: purple_bold
shape_pipe: purple_bold
shape_range: yellow_bold
shape_record: cyan_bold
shape_redirection: purple_bold
shape_signature: green_bold
shape_string: green
shape_string_interpolation: cyan_bold
shape_table: blue_bold
shape_variable: purple
shape_vardecl: purple
shape_raw_string: light_purple
}
let light_theme = {
# color for nushell primitives
separator: dark_gray
# no fg, no bg, attr none effectively turns this off
leading_trailing_space_bg: { attr: n }
header: green_bold
empty: blue
# Closures can be used to choose colors for specific values.
# The value (in this case, a bool) is piped into the closure.
# eg) {|| if $in { 'dark_cyan' } else { 'dark_gray' } }
bool: dark_cyan
int: dark_gray
filesize: cyan_bold
duration: dark_gray
date: purple
range: dark_gray
float: dark_gray
string: dark_gray
nothing: dark_gray
binary: dark_gray
cell-path: dark_gray
row_index: green_bold
record: dark_gray
list: dark_gray
block: dark_gray
hints: dark_gray
search_result: { fg: white bg: red }
shape_and: purple_bold
shape_binary: purple_bold
shape_block: blue_bold
shape_bool: light_cyan
shape_closure: green_bold
shape_custom: green
shape_datetime: cyan_bold
shape_directory: cyan
shape_external: cyan
shape_externalarg: green_bold
shape_external_resolved: light_purple_bold
shape_filepath: cyan
shape_flag: blue_bold
shape_float: purple_bold
# shapes are used to change the cli syntax highlighting
shape_garbage: { fg: white bg: red attr: b }
shape_glob_interpolation: cyan_bold
shape_globpattern: cyan_bold
shape_int: purple_bold
shape_internalcall: cyan_bold
shape_keyword: cyan_bold
shape_list: cyan_bold
shape_literal: blue
shape_match_pattern: green
shape_matching_brackets: { attr: u }
shape_nothing: light_cyan
shape_operator: yellow
shape_or: purple_bold
shape_pipe: purple_bold
shape_range: yellow_bold
shape_record: cyan_bold
shape_redirection: purple_bold
shape_signature: green_bold
shape_string: green
shape_string_interpolation: cyan_bold
shape_table: blue_bold
shape_variable: purple
shape_vardecl: purple
shape_raw_string: light_purple
}
source ($nu.default-config-dir | path join 'themes.nu')
# External completer example
# let carapace_completer = {|spans|
# carapace $spans.0 nushell ...$spans | from json
# }
# The default config record. This is where much of your global configuration
# is setup.
$env.config = {
# true or false to enable or disable the welcome banner at startup
show_banner: false
@ -176,6 +32,13 @@ $env.config = {
show_empty: true
# a left right padding of each column in a table
padding: { left: 1, right: 1 }
# show header text on separator/border line
header_on_separator: false
# render footer in parent table if child is big enough
# (extended table option)
footer_inheritance: false
# limit data rows from top and bottom after reaching a set point
# abbreviated_row_count: 10
trim: {
# wrapping or truncating
methodology: wrapping
@ -184,13 +47,6 @@ $env.config = {
# A suffix used by the 'truncating' methodology
truncating_suffix: "…"
}
# show header text on separator/border line
header_on_separator: false
# render footer in parent table if child is big enough
# (extended table option)
footer_inheritance: false
# limit data rows from top and bottom after reaching a set point
# abbreviated_row_count: 10
}
# "fancy" or "plain" for screen reader-friendly error messages
@ -259,6 +115,9 @@ $env.config = {
# "smart" (alphabetical for prefix matching, fuzzy score for
# fuzzy matching) or "alphabetical"
sort: "smart"
# set this to true to enable file/path/directory completions
# using LS_COLORS
use_ls_colors: true
external: {
# set to false to prevent nushell looking into $env.PATH to find
# more suggestions, `false` recommended for WSL users as this look
@ -270,9 +129,6 @@ $env.config = {
# check 'carapace_completer' above as an example
completer: null
}
# set this to true to enable file/path/directory completions
# using LS_COLORS
use_ls_colors: true
}
filesize: {
@ -299,7 +155,7 @@ $env.config = {
#color_config: $dark_theme
# if you want a more interesting theme, you can replace the empty record
# with `$dark_theme`, `$light_theme` or another custom record
color_config: $light_theme
color_config: $dark_theme
# always, never, number_of_rows, auto
footer_mode: 25
# the precision for displaying floats in tables

@ -17,11 +17,10 @@ $env.XDG_VIDEOS_DIR = $'($env.HOME)/videos'
let xdg = $env
| transpose name value
| each {|e| if $e.name =~ 'XDG_' { $e } else { null }}
| each {|e| {
| each {|e| if $e.name =~ 'XDG_' {{
name: ($e.name | str replace 'XDG_' '' | str downcase),
value: $e.value
}}
}} else { null }}
| reduce --fold {} {|e, memo| {
...$memo,
$e.name: ($e.value | if $in =~ ':' { split row ':' } else { $e.value })

@ -1,5 +1,6 @@
require('core.config')
vim.opt.runtimepath:prepend(vim.fn.stdpath('data') .. '/lazy/lazy.nvim')
require('lazy').setup('plugins', {
require("core.config")
require("core.keymaps")
vim.opt.runtimepath:prepend(vim.fn.stdpath("data") .. "/lazy/lazy.nvim")
require("lazy").setup("plugins", {
version = "*",
})

@ -0,0 +1,16 @@
vim.api.nvim_create_user_command("W", "write", {})
vim.api.nvim_create_user_command("Q", "qall!", {})
-- Create a floating terminal
vim.api.nvim_create_user_command("FloaTerm", require("core.lib.toggle_terminal"), {
desc = "Toggle a floating terminal",
})
-- highlight text on copy
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight when yanking (copying) text",
callback = vim.highlight.on_yank,
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", {
clear = true,
}),
})

@ -1,16 +1,15 @@
vim.g.mapleader = ','
vim.g.maplocalleader = ','
vim.g.mapleader = ","
vim.g.maplocalleader = ","
vim.opt.fileformats = { 'unix', 'dos', 'mac' }
vim.opt.fileformats = { "unix", "dos", "mac" }
vim.opt.mouse = 'a'
vim.opt.clipboard = 'unnamedplus'
vim.opt.mouse = "a"
vim.opt.clipboard = "unnamedplus"
vim.opt.breakindent = true
vim.opt.undofile = true
vim.opt.signcolumn = 'yes'
vim.opt.updatetime = 250
vim.opt.timeoutlen = 300
vim.opt.timeoutlen = 1000
vim.opt.splitright = true
vim.opt.splitbelow = true
@ -29,8 +28,8 @@ vim.opt.number = true
vim.opt.numberwidth = 4
vim.opt.relativenumber = true
vim.opt.showmatch = true
vim.opt.spelllang = 'en_us'
vim.opt.wildmode = 'list:longest'
vim.opt.spelllang = "en_us"
vim.opt.wildmode = "list:longest"
vim.opt.cursorline = true
-- Indent
@ -42,41 +41,13 @@ vim.opt.shiftround = true
-- Text Formatting/Layout
vim.opt.ignorecase = true
vim.opt.list = true
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '' }
vim.opt.inccommand = 'split'
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "" }
vim.opt.inccommand = "split"
vim.opt.smartcase = true
vim.opt.wrap = false
vim.opt.whichwrap:append {
['<'] = true,
['>'] = true,
['['] = true,
[']'] = true,
["<"] = true,
[">"] = true,
["["] = true,
["]"] = true,
}
vim.api.nvim_create_user_command('W', 'write', {})
vim.api.nvim_create_user_command('Q', 'qall!', {})
vim.keymap.set('n', '<leader>l', ':nohlsearch<CR>', { desc = 'clear highlighted search' })
vim.keymap.set('n', '<leader>ts', [[:%s/\s\s*$//g<CR>]], { desc = '[T]rim trailing [S]pace' })
vim.keymap.set('n', '<leader>ss', ':setlocal spell!<CR>', { desc = '[S]et [S]pell' })
vim.keymap.set('n', '<leader>p', ':set paste!<CR>', { desc = '[P]aste' })
vim.keymap.set('n', '<leader>nn', ':set nonumber norelativenumber<CR>', { desc = '[N]o [N]umber removed number and relative number' })
vim.keymap.set('n', '<leader>rn', ':set number relativenumber<CR>', { desc = '[R]elative [N]umber - set relative number and absolute number' })
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnopstic [Q]uickfix list' })
-- Use <Ctrl-h/j/k/l> to move between windows, no need for <Ctrl-w> first
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus up window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus down window' })
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus left window' })
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus right window' })
-- highlight text on copy
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
callback = vim.highlight.on_yank,
})

@ -0,0 +1,23 @@
require("core.commands")
local toggle_terminal = require("core.lib.toggle_terminal")
vim.keymap.set("n", "<leader>l", ":nohlsearch<CR>", { desc = "clear highlighted search" })
vim.keymap.set("n", "<leader>ts", [[:%s/\s\s*$//g<CR>]], { desc = "[T]rim trailing [S]pace" })
vim.keymap.set("n", "<leader>ss", ":setlocal spell!<CR>", { desc = "[S]et [S]pell" })
vim.keymap.set("n", "<leader>p", ":set paste!<CR>", { desc = "[P]aste" })
vim.keymap.set("n", "<leader>nn", ":set nonumber norelativenumber<CR>", { desc = "[N]o [N]umber removed number and relative number" })
vim.keymap.set("n", "<leader>rn", ":set number relativenumber<CR>", { desc = "[R]elative [N]umber - set relative number and absolute number" })
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous [D]iagnostic message" })
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next [D]iagnostic message" })
vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" })
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnopstic [Q]uickfix list" })
-- Use <Ctrl-h/j/k/l> to move between windows, no need for <Ctrl-w> first
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus up window" })
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus down window" })
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus left window" })
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus right window" })
vim.keymap.set({ "n", "t" }, "<leader>tt", toggle_terminal)
vim.keymap.set("t", "<esc><esc>", "<c-\\><c-n>")

@ -0,0 +1,25 @@
-- Telescope live_grep in git root
-- Function to find the git root directory based on the current buffer's path
local function find_git_root()
-- Use the current buffer's path as the starting point for the git search
local current_file = vim.api.nvim_buf_get_name(0)
local current_dir
local cwd = vim.fn.getcwd()
-- If the buffer is not associated with a file, return nil
if current_file == '' then
current_dir = cwd
else
-- Extract the directory from the current file's path
current_dir = vim.fn.fnamemodify(current_file, ':h')
end
-- Find the Git root directory from the current file's path
local git_root = vim.fn.systemlist('git -C ' .. vim.fn.escape(current_dir, ' ') .. ' rev-parse --show-toplevel')[1]
if vim.v.shell_error ~= 0 then
print('Not a git repository. Searching on current working directory')
return cwd
end
return git_root
end
return find_git_root

@ -0,0 +1,45 @@
local state = {
floating = {
buf = -1,
win = -1,
}
}
local function create_floating_window(ops)
ops = ops or {}
local width = ops.width or math.floor(vim.o.columns * 0.8)
local height = ops.height or math.floor(vim.o.lines * 0.8)
local buf
if vim.api.nvim_buf_is_valid(state.floating.buf) then
buf = state.floating.buf
vim.cmd("startinsert")
else
buf = vim.api.nvim_create_buf(false, true)
end
local win = vim.api.nvim_open_win(buf, true, {
relative = "editor",
style = "minimal",
border = "rounded",
width = width,
height = height,
col = math.floor((vim.o.columns - width) / 2),
row = math.floor((vim.o.lines - height) / 2),
})
return { buf = buf, win = win }
end
local function toggle_terminal()
if vim.api.nvim_win_is_valid(state.floating.win) then
vim.api.nvim_win_hide(state.floating.win)
else
state.floating = create_floating_window { buf = state.floating.buf }
if vim.bo[state.floating.buf].buftype ~= "terminal" then
vim.cmd.terminal()
vim.cmd("startinsert")
end
end
end
return toggle_terminal

@ -1,6 +1,14 @@
local function config()
local cmp = require 'cmp'
local luasnip = require 'luasnip'
local M = { "hrsh7th/nvim-cmp" }
M.name = "cmp"
M.dependencies = {
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lsp",
}
function M.config()
local cmp = require "cmp"
local luasnip = require "luasnip"
local function expand(args)
luasnip.lsp_expand(args.body)
@ -31,19 +39,19 @@ local function config()
snippet = { expand = expand },
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = "nvim_lsp" },
{ name = "luasnip" },
},
mapping = cmp.mapping.preset.insert {
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete({}),
['<Tab>'] = cmp.mapping(tab_mapping, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(back_tab_mapping, { 'i', 's' }),
['<CR>'] = cmp.mapping.confirm {
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete({}),
["<Tab>"] = cmp.mapping(tab_mapping, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(back_tab_mapping, { "i", "s" }),
["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
@ -51,12 +59,4 @@ local function config()
}
end
return {
'hrsh7th/nvim-cmp',
name = 'cmp',
config = config,
dependencies = {
'saadparwaiz1/cmp_luasnip',
'hrsh7th/cmp-nvim-lsp',
},
}
return M

@ -1,8 +1,17 @@
return {
'tpope/vim-surround',
tag = 'v2.2',
dependencies = {
{ 'tpope/vim-sleuth', tag = 'v2.0' },
{ 'numToStr/Comment.nvim', opts = {}, lazy = false },
},
-- https://github.com/tpope/vim-surround
-- surround.vim: Delete/change/add parentheses/quotes/XML-tags/much more with ease
local M = { "tpope/vim-surround" }
M.tag = "v2.2"
M.dependencies = {
-- https://github.com/tpope/vim-sleuth
-- sleuth.vim: Heuristically set buffer options
{ "tpope/vim-sleuth", tag = "v2.0" },
-- https://github.com/numToStr/Comment.nvim
-- 🧠 💪 // Smart and powerful comment plugin for neovim.
-- Supports treesitter, dot repeat, left-right/up-down motions, hooks, and more
{ "numToStr/Comment.nvim", opts = {}, lazy = false },
}
return M

@ -1,16 +1,20 @@
local function config()
require("go").setup()
end
-- https://github.com/ray-x/go.nvim
-- A modern go neovim plugin based on treesitter, nvim-lsp and dap debugger.
local M = { "ray-x/go.nvim" }
return {
'ray-x/go.nvim',
name = 'go',
config = config,
event = { 'CmdlineEnter' },
ft = { 'go', 'gomod' },
dependencies = {
'ray-x/guihua.lua',
'lspconfig',
'treesitter',
},
M.name = "go"
M.event = { "CmdlineEnter" }
M.ft = { "go", "gomod" }
M.dependencies = {
-- https://github.com/ray-x/guihua.lua
-- Guihua: A Lua Gui and util library for nvim plugins
"ray-x/guihua.lua",
"lspconfig",
"treesitter",
}
function M.config()
require("go").setup()
end
return M

@ -1,20 +1,31 @@
# chezmoi:template:left-delimiter=--{{
--{{- /* vim: set filetype=lua: */ -}}
local M = { "neovim/nvim-lspconfig" }
M.name = "lspconfig"
M.tag = "v1.0.0"
M.dependencies = {
{ "j-hui/fidget.nvim", tag = "legacy", opts = {} },
{ "folke/trouble.nvim", tag = "v3.6.0" },
{ "folke/lazydev.nvim", tag = "v1.9.0", ft = "lua", opts = {} },
}
local function format_buffer(_)
vim.lsp.buf.format()
end
local function on_attach(_, buffer)
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(buffer, 'Format', format_buffer, {
desc = 'Format current buffer with LSP',
vim.api.nvim_buf_create_user_command(buffer, "Format", format_buffer, {
desc = "Format current buffer with LSP",
})
end
local function config()
local lspconfig = require('lspconfig')
function M.config()
local lspconfig = require("lspconfig")
local capabilities = require('cmp_nvim_lsp').default_capabilities(
local capabilities = require("cmp_nvim_lsp").default_capabilities(
vim.lsp.protocol.make_client_capabilities())
--{{ if lookPath "bash-language-server" -}}
@ -25,6 +36,14 @@ local function config()
settings = {},
}
--{{- end }}
--
--{{ if lookPath "buf" -}}
lspconfig.buf_ls.setup {
capabilities = capabilities,
on_attach = on_attach,
settings = {},
}
--{{- end }}
--{{ if lookPath "go" -}}
lspconfig.gopls.setup {
@ -91,14 +110,4 @@ local function config()
--{{- end }}
end
return {
'neovim/nvim-lspconfig',
name = 'lspconfig',
tag = 'v1.0.0',
config = config,
dependencies = {
{ 'j-hui/fidget.nvim', tag = 'legacy', opts = {} },
{ 'folke/trouble.nvim', tag = 'v3.6.0' },
{ 'folke/lazydev.nvim', tag = 'v1.9.0', ft = "lua", opts = {} },
},
}
return M

@ -1,13 +1,15 @@
local function config()
local luasnip = require 'luasnip'
-- https://github.com/L3MON4D3/LuaSnip
-- Snippet Engine for Neovim written in Lua.
local M = { "L3MON4D3/LuaSnip" }
M.tag = "v2.3.0"
M.dependencies = {}
function M.config()
local luasnip = require "luasnip"
luasnip.setup()
luasnip.config.setup({})
require("luasnip.loaders.from_snipmate").lazy_load()
end
return {
'L3MON4D3/LuaSnip',
config = config,
tag = 'v2.3.0',
dependencies = {},
}
return M

@ -1,49 +1,37 @@
-- Telescope live_grep in git root
-- Function to find the git root directory based on the current buffer's path
local function find_git_root()
-- Use the current buffer's path as the starting point for the git search
local current_file = vim.api.nvim_buf_get_name(0)
local current_dir
local cwd = vim.fn.getcwd()
-- If the buffer is not associated with a file, return nil
if current_file == '' then
current_dir = cwd
else
-- Extract the directory from the current file's path
current_dir = vim.fn.fnamemodify(current_file, ':h')
end
local find_git_root = require("core.lib.find_git_root")
local M = { "nvim-telescope/telescope.nvim" }
-- Find the Git root directory from the current file's path
local git_root = vim.fn.systemlist('git -C ' .. vim.fn.escape(current_dir, ' ') .. ' rev-parse --show-toplevel')[1]
if vim.v.shell_error ~= 0 then
print('Not a git repository. Searching on current working directory')
return cwd
end
return git_root
end
M.branch = "0.1.x"
M.event = "VimEnter"
M.dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-ui-select.nvim",
"nvim-tree/nvim-web-devicons",
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
}
-- Custom live_grep function to search in git root
local function live_grep_git_root()
local git_root = find_git_root()
if git_root then
require('telescope.builtin').live_grep({
require("telescope.builtin").live_grep({
search_dirs = { git_root },
})
end
end
vim.api.nvim_create_user_command('LiveGrepGitRoot', live_grep_git_root, {})
vim.api.nvim_create_user_command("LiveGrepGitRoot", live_grep_git_root, {})
local function config()
function M.config()
-- See `:help telescope` and `:help telescope.setup()`
local telescope = require('telescope')
local builtin = require('telescope.builtin')
local themes = require('telescope.themes')
local telescope = require("telescope")
local builtin = require("telescope.builtin")
local themes = require("telescope.themes")
telescope.setup({
-- pickers = {}
extensions = {
['ui-select'] = {
["ui-select"] = {
themes.get_dropdown(),
},
},
@ -51,19 +39,19 @@ local function config()
defaults = {
mappings = {
i = {
['<C-u>'] = false,
['<C-d>'] = false,
['<C-enter>'] = 'to_fuzzy_refine',
["<C-u>"] = false,
["<C-d>"] = false,
["<C-enter>"] = "to_fuzzy_refine",
},
},
},
})
-- Enable telescope fzf native, if installed
pcall(telescope.load_extension, 'fzf')
pcall(telescope.load_extension, 'ui-select')
pcall(telescope.load_extension, "fzf")
pcall(telescope.load_extension, "ui-select")
local function fuzzy_find ()
local function fuzzy_find()
-- You can pass additional configuration to telescope to change theme,
-- layout, etc.
builtin.current_buffer_fuzzy_find(themes.get_dropdown({
@ -73,38 +61,19 @@ local function config()
end
-- See `:help telescope.builtin`
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader>sG', live_grep_git_root, { desc = '[S]earch by [G]rep on Git Root' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>/', fuzzy_find, { desc = '[/] Fuzzily search in current buffer' })
vim.keymap.set('n', '<leader>gf', builtin.git_files, { desc = 'Search [G]it [F]iles' })
vim.keymap.set("n", "<leader>sh", builtin.help_tags, { desc = "[S]earch [H]elp" })
vim.keymap.set("n", "<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" })
vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "[S]earch [F]iles" })
vim.keymap.set("n", "<leader>ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" })
vim.keymap.set("n", "<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
vim.keymap.set("n", "<leader>sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" })
vim.keymap.set("n", "<leader>sr", builtin.resume, { desc = "[S]earch [R]esume" })
vim.keymap.set("n", "<leader>s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set("n", "<leader>sG", live_grep_git_root, { desc = "[S]earch by [G]rep on Git Root" })
vim.keymap.set("n", "<leader><leader>", builtin.buffers, { desc = "[ ] Find existing buffers" })
vim.keymap.set("n", "<leader>/", fuzzy_find, { desc = "[/] Fuzzily search in current buffer" })
vim.keymap.set("n", "<leader>gf", builtin.git_files, { desc = "Search [G]it [F]iles" })
end
local function is_make_installed()
return vim.fn.executable('make') == 1
end
return {
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
config = config,
event = 'VimEnter',
dependencies = {
'nvim-lua/plenary.nvim',
{
'nvim-telescope/telescope-fzf-native.nvim',
cond = is_make_installed,
build = 'make',
},
'nvim-telescope/telescope-ui-select.nvim',
'nvim-tree/nvim-web-devicons',
},
}
return M

@ -1,25 +1,27 @@
local function config()
vim.cmd.colorscheme 'gruvbox'
end
-- https://github.com/morhetz/gruvbox
local M = { "morhetz/gruvbox" }
return {
'morhetz/gruvbox',
priority = 1000,
config = config,
dependencies = {
'nvim-lualine/lualine.nvim',
opts = {
options = {
theme = 'gruvbox',
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'diagnostics' },
lualine_c = { { 'filename', path = 3 } },
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' }
},
M.priority = 1000
M.dependencies = {
-- https://github.com/nvim-lualine/lualine.nvim
"nvim-lualine/lualine.nvim",
opts = {
options = {
theme = "gruvbox",
},
sections = {
lualine_a = { "mode" },
lualine_b = { "diagnostics" },
lualine_c = { { "filename", path = 3 } },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { "location" }
},
},
}
function M.config()
vim.cmd.colorscheme("gruvbox")
end
return M

@ -2,7 +2,30 @@ vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.opt.termguicolors = true
local function handle_closed(window)
local M = { "nvim-tree/nvim-tree.lua" }
M.tag = "nvim-tree-v1.9.0"
M.keys = {
{ "<leader>nt", ":NvimTreeToggle<CR>", desc = "toggle nvim tree" }
}
M.dependencies = {
-- https://github.com/nvim-tree/nvim-web-devicons
"nvim-tree/nvim-web-devicons", opts = {}
}
function M.config()
require("nvim-tree").setup()
vim.api.nvim_create_autocmd("WinClosed", {
nested = true,
callback = function()
M.handle_closed(tonumber(vim.fn.expand("<amatch>")))
end,
})
end
function M.handle_closed(window)
local tab = vim.api.nvim_win_get_tabpage(window)
local buffer = vim.api.nvim_win_get_buf(window)
local info = vim.fn.getbufinfo(buffer)[1]
@ -14,9 +37,9 @@ local function handle_closed(window)
local windows = vim.tbl_filter(filter_window, vim.api.nvim_tabpage_list_wins(tab))
local buffers = vim.tbl_map(vim.api.nvim_win_get_buf, windows)
if info.name:match('.*NvimTree_%d*$') then
if info.name:match(".*NvimTree_%d*$") then
if not vim.tbl_isempty(buffers) then
require('nvim-tree.api').tree.close()
require("nvim-tree.api").tree.close()
end
return
end
@ -26,10 +49,10 @@ local function handle_closed(window)
end
local last_info = vim.fn.getbufinfo(buffers[1])[1]
if last_info.name:match('.*NvimTree_%d*$') then
if last_info.name:match(".*NvimTree_%d*$") then
vim.schedule(function()
if #vim.api.nvim_list_wins() == 1 then
vim.cmd 'quit'
vim.cmd "quit"
else
vim.api.nvim_win_close(windows[1], true)
end
@ -37,24 +60,4 @@ local function handle_closed(window)
end
end
local function config()
require('nvim-tree').setup()
vim.api.nvim_create_autocmd('WinClosed', {
nested = true,
callback = function()
local window = tonumber(vim.fn.expand('<amatch>'))
handle_closed(window)
end,
})
end
return {
'nvim-tree/nvim-tree.lua',
config = config,
keys = {
{ '<leader>nt', ':NvimTreeToggle<CR>', desc = 'toggle nvim tree' }
},
dependencies = {
'nvim-tree/nvim-web-devicons', opts = {}
},
}
return M

@ -1,8 +1,24 @@
local treesitter_config_setup = {
local M = {"nvim-treesitter/nvim-treesitter" }
M.name = "treesitter"
M.build = ":TSUpdate"
M.dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects"
}
function M.config ()
vim.defer_fn(M.treesitter_configs, 0)
end
function M.treesitter_configs()
require("nvim-treesitter.configs").setup(M.treesitter_config_setup)
end
M.treesitter_config_setup = {
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = {
'bash', 'c', 'cpp', 'go', 'lua', 'python', 'rust',
'tsx', 'javascript', 'typescript', 'vimdoc', 'vim',
"bash", "c", "cpp", "go", "lua", "python", "rust",
"tsx", "javascript", "typescript", "vimdoc", "vim",
},
auto_install = true,
@ -17,10 +33,10 @@ local treesitter_config_setup = {
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<M-space>',
init_selection = "<c-space>",
node_incremental = "<c-space>",
scope_incremental = "<c-s>",
node_decremental = "<M-space>",
},
},
@ -31,22 +47,22 @@ local treesitter_config_setup = {
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
["<leader>a"] = "@parameter.inner",
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
["<leader>A"] = "@parameter.inner",
},
},
@ -55,41 +71,23 @@ local treesitter_config_setup = {
-- whether to set jumps in the jumplist
set_jumps = true,
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
["]m"] = "@function.outer",
["]]"] = "@class.outer",
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
},
},
}
local function treesitter_configs()
require 'nvim-treesitter.configs'
.setup(treesitter_config_setup)
end
local function config()
vim.defer_fn(treesitter_configs, 0)
end
return {
-- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
name = 'treesitter',
config = config,
build = ':TSUpdate',
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
},
}
return M

@ -5,7 +5,7 @@ set -euo pipefail
# shellcheck disable=SC1090
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
VERSION=${VERSION:-v1.36.0}
VERSION=${VERSION:-v1.47.2}
DEST=${XDG_DATA_HOME}/apps/releases/buf
CURRENT=${DEST}/current
URL=https://github.com/bufbuild/buf/releases/download/${VERSION}/buf-$(uname)-$(uname -m).tar.gz

@ -3,7 +3,7 @@
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=fzf
VERSION=${VERSION:-0.53.0}
VERSION=${VERSION:-0.57.0}
DEST=${XDG_DATA_HOME}/apps/releases/${APP}
URL=https://github.com/junegunn/fzf/releases/download/${VERSION}/fzf-${VERSION}-$(get_os)_$(get_arch).tar.gz

@ -5,8 +5,8 @@ set -euo pipefail
# shellcheck disable=SC1090
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
VERSION=${VERSION:-2.23.1}
DEST=${XDG_DATA_HOME}/apps/releases/protoc-grpc-gatewa
VERSION=${VERSION:-2.24.0}
DEST=${XDG_DATA_HOME}/apps/releases/protoc-grpc-gateway
BASE_URL=https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v${VERSION}
GRPC_GATEWAY_URL=${BASE_URL}/protoc-gen-grpc-gateway-v${VERSION}-$(get_os)-$(uname -m)
OPENAPI_V2_URL=${BASE_URL}/protoc-gen-openapiv2-v${VERSION}-$(get_os)-$(uname -m)

@ -6,7 +6,7 @@ set -euo pipefail
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=protoc-gen-go
VERSION=${VERSION:-1.34.2}
VERSION=${VERSION:-1.36.0}
DEST="${XDG_DATA_HOME}/apps/releases/${APP}"
URL=https://github.com/protocolbuffers/protobuf-go/releases/download/v${VERSION}/protoc-gen-go.v${VERSION}.$(get_os).$(get_arch).tar.gz

@ -5,7 +5,7 @@ set -euo pipefail
# shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
VERSION=${VERSION:-28.0}
VERSION=${VERSION:-29.1}
APP=protoc
APPS_DIR=${XDG_DATA_HOME}/apps/releases/${APP}
VER_DIR=${APPS_DIR}/${VERSION}

@ -5,7 +5,7 @@ set -euo pipefail
# shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
PROTOC_VERSION=${VERSION:-28.0}
PROTOC_VERSION=${VERSION:-29.1}
PROTOC_ZIP=protoc-$PROTOC_VERSION-linux-x86_64.zip
TMP_DIR=$(mktemp --directory)
DEST_FILE=$TMP_DIR/$PROTOC_ZIP

Loading…
Cancel
Save