mawww / kakoune

mawww's experiment for a better code editor
http://kakoune.org
The Unlicense
9.96k stars 715 forks source link

help formating %sh{} wanted #490

Closed jmwatte closed 8 years ago

jmwatte commented 8 years ago

Hello, am I expecting something wrong or am I doing something wrong? I do this

:nop %sh{ gofmt -w $kak_bufname }

I am trying to send the go-file to the gofmt command. When I do it in the normal shell (zsh), it works and kak picks it up by telling me the file has changed but somehow I expect it to work with that command from out of kak. Am I doing something wrong? grtz jm

mawww commented 8 years ago

Hello,

That should be working, any stderr output would be written to the *debug* buffer so you might want to take a look at that.

As well, formatting is already provided by formatter.kak and golang.kak, using gofmt, you can just use :format to run it (and you do not need to save the buffer prior to that).

jmwatte commented 8 years ago

Great... figured the :format out

I was also trying to use the

:nop %sh{ goimports -w $kak_bufname }

but in the *debug* I get

stat ~/Documents/mygo/src/......../hello.go: no such file or directory

So I did the same command with the full path (changed ~ with/home/jmw/...) and that worked. Is the conclusion that the ~ does not get expanded when it gets to zsh? I tried it with gotype gofmt goimports ... Any suggestions. Oh, and autocompletion with gocode .... have to try that ...that would be nice :)

mawww commented 8 years ago

Hi,

you should use $kak_buffile actually $kak_bufname is more the displayed name of the buffer.

Autocompletion should be implementable following the clang.kak model.