Skip to content

Commit

Permalink
random
Browse files Browse the repository at this point in the history
  • Loading branch information
kkga committed Sep 11, 2021
1 parent 2b388f3 commit d4430d4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 28 deletions.
9 changes: 5 additions & 4 deletions cmd/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func (c *EditCmd) Run() error {
}

if len(c.fs.Args()) > 0 {
// TODO refactor FP to use same style as cmd (Name())
fp, err := NewFilepath(c.fs.Args())
if err != nil {
return err
Expand All @@ -51,18 +52,18 @@ func (c *EditCmd) Run() error {
b := strings.Builder{}
b.WriteString(fmt.Sprintf("edit -existing %s", fp.Name))
if fp.Line != 0 {
b.WriteString(fmt.Sprintf("%d", fp.Line))
b.WriteString(fmt.Sprintf(" %d", fp.Line))
}
if fp.Column != 0 {
b.WriteString(fmt.Sprintf("%d", fp.Column))
b.WriteString(fmt.Sprintf(" %d", fp.Column))
}

fmt.Println(b.String())

kak.Send(b.String(), "", sess, cl)
}
}

// TODO refactor FP to use same style as cmd (Name())

return nil
}

Expand Down
21 changes: 0 additions & 21 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,6 @@ func main() {

// editCmd := flag.NewFlagSet("edit", flag.ExitOnError)

// sCmds := []*flag.FlagSet{editCmd, sendCmd, attachCmd, getCmd, killCmd}
// cCmds := []*flag.FlagSet{editCmd, sendCmd, attachCmd, getCmd}

// var sessArg string
// var clArg string

// for _, cmd := range sCmds {
// cmd.StringVar(&sessArg, "s", "", "Kakoune session")
// }

// for _, cmd := range cCmds {
// cmd.StringVar(&clArg, "c", "", "Kakoune client")
// }

// if len(os.Args) < 2 {
// // printHelp()
// os.Exit(0)
// }

// cmdArgs := os.Args[2:]

// // create new session
// if newCmd.Parsed() {
// name := newCmd.Arg(0)
Expand Down
7 changes: 4 additions & 3 deletions scripts/kks-lines
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# - ripgrep (https://github.com/BurntSushi/ripgrep)
# - fzf (https://github.com/junegunn/fzf)

rg --line-number '.+' "$@" |
kks cat |
nl -w4 -s' ' |
fzf --height 100% --prompt 'lines> ' |
cut -d':' -f1 |
xargs -I % kks send execute-keys '%gx'
awk '{print $1}' |
xargs -I % 'kks send execute-keys %gx'

0 comments on commit d4430d4

Please sign in to comment.