Categorygithub.com/o-kaisan/text-clipper
repositorypackage
1.0.7
Repository: https://github.com/o-kaisan/text-clipper.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# README

Text Clipper

About

Text Clipper is a TUI-based text manager. It allows you to save texts that you use frequently and, through this tool, display them in a list. You can then select the text you want to copy to the clipboard.

Environments

  • WSL 22.04(LTS)
  • Windows 11
  • Go 1.22.1

Windows Setup

To use SQLite within the application on Windows, please follow these steps:

  1. Install GCC

    • Install a GCC compiler such as MinGW or TDM-GCC.
    • Verify the installation by running gcc --version in the command prompt to ensure it was successful.
  2. Enable CGO

    • Set the environment variable CGO_ENABLED to 1. Execute the following command in the command prompt:
set CGO_ENABLED=1

After completing these settings, proceed to install the application.

Installation

go install github.com/o-kaisan/text-clipper@latest

Dependency info and Libraries used

atotto/clipboard ※ for copy text to clipboard

  • OSX
  • Windows10 (probably work on other Windows)
  • Linux, Unix (requires xclip or xsel command to be installed)
  • WSL (The following settings are required)

For WSL Settings to Use Text Clipper

In a WSL environment, atotto/clipboard did not work. Here, settings for both bash and fish are prepared, so add them according to your environment. The mechanism executes the WSL clipboard functionality (write) using the xclip command. As a prerequisite, ensure that the clipboard functionality (write) is available with clip.exe. Reference:[wsl] 地味に便利なclip.exeでのテキストコピー *Note: If you are using xclip or xsel with other tools, check their impact before proceeding.

Common
  • Remove xclip and xsel. If either is installed, it did not work.

    sudo apt-get remove xclip
    sudo apt-get remove xsel
    
Bash
  • Open .bashrc

    vi ~/.bashrc
    
  • Add a function to execute cat | clip.exe using the xclip command

    function xclip(){
        cat | clip.exe
    }
    
  • Reload

    source ~/.bashrc
    
Fish
  • Create a function

    vi ~/.config/fish/functions/xclip.fish
    
  • Add a function to execute cat | clip.exe using the xclip command

    function xclip
        cat | clip.exe
    end
    
  • Reload

    source ~/.config/fish/functions/xclip.fish
    

Configuration File Location

By default, this application creates a .text-clipper directory under the user's home directory. If you want to change the location where this file is stored, please set a new path by specifying the TEXT_CLIPPER_PATH environment variable.

Bash

export TEXT_CLIPPER_PATH=/home/hoge

fish

set -x TEXT_CLIPPER_PATH /home/hoge

To make this setting permanent, add the above command to the appropriate shell configuration file (e.g., .bashrc, .bash_profile, or config.fish).

Usage

  • run

    text-clipper
    

list view

  • key binding

    keydescription
    ↓/jdown
    ↑/kup
    gtop
    Gend
    ctrl+aadd new item
    ctrl+eedit item
    ctrl+ddelete item
    /filter
    q/ctrl+cquit
    ?more help

register view

  • key binding

    keydescription
    tabmove down
    shift+tabmove up
    Enterenter over the submit button to register the item
    ctrl+cback to list view
  • input form

    • title
      • 50 character limit
    • contents
      • no limit

List Sorting Functionality

This configuration defines various criteria for sorting a list. By using the environment variable TEXT_CLIPPER_SORT, you can control the sort order of the list by specifying one of the following keys.

Sort Order Table

KeyDescription
createdAtAsc(Default)Sort by creation date in ascending order
updatedAtAscSort by update date in ascending order
lastUsedAtAscSort by last used date in ascending order
createdAtDescSort by creation date in descending order
updatedAtDescSort by update date in descending order
lastUsedAtDescSort by last used date in descending order

Setting Environment Variables

Bash:

export TEXT_CLIPPER_SORT="createdAtDesc"

**Fish:**

```fish
set -x TEXT_CLIPPER_SORT createdAtDesc