# More things better

**URL:** <https://discuss.kakoune.com/t/more-things-better/1035>\
**Category:** Help\
**Tags:** language, lsp\
**Created:** [May 26, 2020, 3:53pm UTC](https://discuss.kakoune.com/t/more-things-better/1035 "2020-05-26T15:53:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![The-BigDaddy](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/the-bigdaddy/32/1562_2.png) [@The-BigDaddy](https://discuss.kakoune.com/u/The-BigDaddy)\
**Post date:** [May 26, 2020, 3:53pm UTC](https://discuss.kakoune.com/t/more-things-better/1035/1 "2020-05-26T15:53:54Z")

</div>

Hello everyone!

So I have more questions.

1. Find and select files with FZF (not in Kakoune)

2. Language server fun

3. Log file?

4. Linting output

**EDIT** :

1. Copying, yanking, pasting

---

<div class="post-metadata">

**Author:** ![andreyorst](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/andreyorst/32/29_2.png) [@andreyorst](https://discuss.kakoune.com/u/andreyorst)\
**Post date:** [May 26, 2020, 5:39pm UTC](https://discuss.kakoune.com/t/more-things-better/1035/2 "2020-05-26T17:39:37Z")

</div>

I believe you don’t really need that `eval %sh{}` block in your lsp config, since `lsp-enable-window` pretty much does that, so you enable lsp twice

---

<div class="post-metadata">

**Author:** ![Delapouite](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/delapouite/32/10_2.png) [@Delapouite](https://discuss.kakoune.com/u/Delapouite)\
**Post date:** [May 26, 2020, 7:29pm UTC](https://discuss.kakoune.com/t/more-things-better/1035/3 "2020-05-26T19:29:38Z")

</div>

> [@The-BigDaddy](#):
>
> `kak $(ls -R -i dir-pattern-to-ignore ~/path/to/dir | fzf)`

I think you want to use `-I` (capital) instead of `-i`.

The small `-i` prints the inode of each file, so Kakoune basically receives 2 words: `12345` and `foo`. As `12345`, the inode number, is not a file name, Kakoune starts with an empty buffer.

---

<div class="post-metadata">

**Author:** ![The-BigDaddy](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/the-bigdaddy/32/1562_2.png) [@The-BigDaddy](https://discuss.kakoune.com/u/The-BigDaddy)\
**Post date:** [May 26, 2020, 8:30pm UTC](https://discuss.kakoune.com/t/more-things-better/1035/4 "2020-05-26T20:30:52Z")

</div>

Oh whoops. I got it write trying it out in the commandline but mixed it up writing this out.

**EDIT** : though that doesn’t change that Kakoune doesn’t open the selected file in the containing directory. It just opens a new file of the selected ones name in the current directory. Ex. In the home directoy and doing `kak $(ls -R ~/.config/kak | fzf)` with selecting `kakrc` will just create an empty file in Kakoune that’s in the home directory named `kakrc`.

---

<div class="post-metadata">

**Author:** ![The-BigDaddy](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/the-bigdaddy/32/1562_2.png) [@The-BigDaddy](https://discuss.kakoune.com/u/The-BigDaddy)\
**Post date:** [May 26, 2020, 8:31pm UTC](https://discuss.kakoune.com/t/more-things-better/1035/5 "2020-05-26T20:31:51Z")

</div>

That does make sense.

---

<div class="post-metadata">

**Author:** ![Screwtapello](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/screwtapello/32/12_2.png) [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Post date:** [May 27, 2020, 11:47am UTC](https://discuss.kakoune.com/t/more-things-better/1035/6 "2020-05-27T11:47:19Z")

</div>

> [@The-BigDaddy](#):
>
> Find and select files with FZF (not in Kakoune)

This isn’t related to Kakoune. If you straight-up run:

```
ls -R -i dir-pattern-to-ignore ~/path/to/dir

```

…you’ll see it prints each path as relative to `~/path/to/dir`, so `fzf` can only offer you those relative paths, and so when the result gets passed to Kakoune, it opens a relative path - but relative to the wrong directory. By contrast, `rg` always includes the start-point you provide at the beginning of each printed path, so by the time the paths make it through to Kakoune, it still has enough context to open the correct file.

There doesn’t appear to be a way to make `ls` include the full path with each filename it prints, so `rg` is probably the right choice here.

> [@The-BigDaddy](#):
>
> However opening my project I…don’t think the language server is started.

I know you need to source the `kak-lsp` configuration, and then run the `lsp-enable` command it creates, before LSP stuff will appear. Once you run `lsp-enable`, it will try to launch (or re-use) a language-server for each buffer you create, though, you don’t have to re-enable it every time.

> [@The-BigDaddy](#):
>
> For my configuration for kak-lsp, and I would think there would be a log file in `~/.config/kak-lsp` but there isn’t.

I notice you set the log file to `$XDG_CONFIG_HOME/kak-lsp/kak-lsp.log`, but `$XDG_CONFIG_HOME` generally isn’t set, so it’s probably trying to write to `/kak-lsp/kak-lsp.log`, getting a “permission denied” error, and having nowhere to report it. Since you manually write out `~/.config` for the config file, you might as well do it for the log file too.

Personally, when debugging kak-lsp issues I just launch it manually in another terminal like:

```
kak-lsp -s somesession

```

…and then I launch Kakoune with:

```
kak -s somesession

```

…and when Kakoune tries to communicate with kak-lsp, it communicates with the one that’s running where I can see it, instead of starting a background one whose errors and warnings vanish into the ether.

> [@The-BigDaddy](#):
>
> One of the things I would like is to have is for the output of the lint command to show up in a split or something instead of me having to go over to the `*lint-output*` buffer.

Kakoune itself doesn’t do splits, but if you create a separate window (with `:new`) and set it to be the “toolsclient”, then the output of commands like `:lint` and `:make` will automatically be displayed there. See [IDE Mode](https://github.com/mawww/kakoune/wiki/IDE) in the wiki for more information.

> [@The-BigDaddy](#):
>
> My `y` and `Y` doesn’t actually append anything to the default yank/paste register

Your mappings for `Y` and `y` (inside the `evaluate-commands` block) run _instead_ of the default implementations, so they’ll only interact with the X11 clipboard and not with the rest of Kakoune.

I think the `NormalKey` hook at the top will run in _addition_ to the default implementations, but it’s redundant with the mappings below it.

Hopefully one day somebody will implement [register hooks](https://github.com/mawww/kakoune/issues/859) and we can have simpler and more reliable clipboard integration.

---

<div class="post-metadata">

**Author:** ![The-BigDaddy](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/the-bigdaddy/32/1562_2.png) [@The-BigDaddy](https://discuss.kakoune.com/u/The-BigDaddy)\
**Post date:** [May 27, 2020, 4:50pm UTC](https://discuss.kakoune.com/t/more-things-better/1035/7 "2020-05-27T16:50:29Z")

</div>

> There doesn’t appear to be a way to make ls include the full path with each filename it prints, so rg is probably the right choice here.

Yea looking around, the means to make `ls` also give the full path would be wonky. It’d be easier to just use `rg --files`.

> I know you need to source the `kak-lsp` configuration, and then run the `lsp-enable` command it creates, before LSP stuff will appear. Once you run `lsp-enable`, it will try to launch (or re-use) a language-server for each buffer you create, though, you don’t have to re-enable it every time.

Mmmm, looking at the code for kak-lsp, I don’t know why I didn’t think there would be an [option to set the command](https://github.com/ul/kak-lsp/blob/00ebb6b5fa2fc3472e664a0c86bf51c6b2c3f378/rc/lsp.kak#L5) for `kak-lsp`.

So now I have

```
set-option global lsp_cmd "kak-lsp -vvv -c ~/.config/kak-lsp/kak-lsp.toml -s %val{session} --log ~/.config/kak-lsp/kak-lsp.log"

```

and hopefully that’ll get me somewhere.

I also put

```
echo -debug "Enabling LSP for filtetype %opt{filetype}"

```

Inside of a

```
hook global WinSetOption filetype=(c|cpp|objc|d|rust|haskell|nim|elixir|latex|javascript) %{}

```

So that way I have a starting indicator if something done fucked up.

> [@Screwtapello](#):
>
> Kakoune itself doesn’t do splits, but if you create a separate window (with `:new` ) and set it to be the “toolsclient”, then the output of commands like `:lint` and `:make` will automatically be displayed there. See [IDE Mode](https://github.com/mawww/kakoune/wiki/IDE) in the wiki for more information.

Oh yea I remember looking at that.

Is there anything more needed to be done? Because all that’s given is the code snippet and then

> Then it’s up to tmux or your window manager (dwm, i3, xmonad…) to fit them correctly on your monitor.

So is

```
def ide %{
    rename-client main
    set global jumpclient main

    new rename-client tools
    set global toolsclient tools

    new rename-client docs
    set global docsclient docs
}

```

all that’s needed?

---

<div class="post-metadata">

**Author:** ![Screwtapello](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/screwtapello/32/12_2.png) [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Post date:** [May 28, 2020, 1:22am UTC](https://discuss.kakoune.com/t/more-things-better/1035/8 "2020-05-28T01:22:30Z")

</div>

> [@The-BigDaddy](#):
>
> Mmmm, looking at the code for kak-lsp, I don’t know why I didn’t think there would be an [option to set the command](https://github.com/ul/kak-lsp/blob/00ebb6b5fa2fc3472e664a0c86bf51c6b2c3f378/rc/lsp.kak#L5) for `kak-lsp` .

I’m not sure how useful that option will be — before you can set the option that says how to run `kak-lsp`, you already need to have run `kak-lsp` to define the option. But, if it’s working for you, then great!

> [@The-BigDaddy](#):
>
> Is there anything more needed to be done?

`def` is short for `define-command`. Nothing will happen until you run the `:ide` command, and then it will open a bunch of windows and set the `*client` options appropriately.
