8000 Merge dev into main by dclong · Pull Request #119 · legendu-net/icon · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Merge dev into main #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .idx/dev.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{pkgs, ...}: {
channel = "stable-24.11";
packages = with pkgs; [
moreutils
bash-completion
gitui
neovim
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

// Update icon.
func version(cmd *cobra.Command, args []string) {
fmt.Println("0.26.0")
fmt.Println("0.26.1")
}

var versionCmd = &cobra.Command{
Expand Down
30 changes: 28 additions & 2 deletions utils/data/bash-it/plugins/custom.plugins.bash
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function fzf.cs {
alias fcs=fzf.cs
alias fcd=fzf.cs


function _fzf.bat.usage {
cat << EOF
Search for files using fzf and preview it using bat.
Expand All @@ -65,13 +66,14 @@ function fzf.bat {
if [[ $# > 0 ]]; then
dir="$@"
fi
o="$(find $dir -type f -print0 2> /dev/null | \
fzf --read0 --preview 'bat --color=always {}')"
o="$(find $dir -type f -print0 2> /dev/null | fzf --read0 --preview 'bat --color=always {}')"
echo $o
nvim $o
}

alias fbat=fzf.bat


function _fzf.ripgrep.nvim.usage {
cat << EOF
Leverage fzf as the UI to search for files by content using ripgrep, \
Expand Down Expand Up @@ -108,3 +110,27 @@ function fzf.ripgrep.nvim (
)

alias frgvim=fzf.ripgrep.nvim


function _fzf.history.usage {
cat << EOF
Search for files using fzf and preview it using bat.
Syntax: fzf.bat [-h] [dir]
Args:
dir: The directory (default to .) under which to search for files.
EOF
}

function fzf.history {
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
_fzf.history.usage
return 0
fi
local command=$(fc -ln 1 | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | fzf | vipe)
echo $command
eval "$command"
}

alias fhist=fzf.history
alias fh=fzf.history

25 changes: 4 additions & 21 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -1043,36 +1043,19 @@ func GetBashConfigFile() string {
// ConfigBash configures the Bash shell environment.
//
// This function performs the following configurations to the Bash shell:
//
// - Retrieves the appropriate Bash configuration file path using GetBashConfigFile().
// - Calls ConfigShellPath() to configure the shell's PATH environment variable.
// - Appends a block of code to the Bash configuration file to set the default
// editor to either `nvim` (if available) or `vim` (as a fallback).
// - If the operating system is Linux, it also appends a block of code to
// ~/.bash_profile to source in ~/.bashrc, ensuring that any configurations
// in ~/.bashrc are loaded.
//
// The function uses AppendToTextFile() to add the code blocks to the respective
// files, with the `checkExistence` flag set to true to avoid adding duplicate
// content. If any errors occur during file operations, the function will
// terminate with a fatal log message.
//
// @example
//
// ConfigBash() // Configures the Bash shell environment by setting the editor
// // and sourcing in ~/.bashrc on Linux.
//
// @remarks
// The function does nothing if it fail to retreive the bash config file.
// - configure the shell's PATH environment variable smartly
// - set the environment variables VISUAL and EDITOR to nvim with a fallback to vim.
func ConfigBash() {
bashConfigFile := GetBashConfigFile()
ConfigShellPath(bashConfigFile)
AppendToTextFile(
bashConfigFile,
`
if which nvim > /dev/null; then
export VISUAL=nvim
export EDITOR=nvim
else
export VISUAL=vim
export EDITOR=vim
fi
`,
Expand Down
Loading
0