Fork me on GitHub
#vim
<
2022-10-24
>
Fredrik Andersson21:10:25

I wonder what indent you are using with vim? I'm using 2 spaces and guns/vimsexp with tpope/vim-sexp-mappings-for-regular-people and finally vim-parinfer. I find myself aligning one space back and forth all the time

walterl21:10:53

> "I find myself aligning one space back and forth all the time" Would this be for aligning multi-line lists to the first element?

Martynas Maciulevičius04:10:51

I use vim-sexp but I don't use their alignment or vim's built-in alignment. I solely rely on LSP formatting the buffer on save. And even if I make any alignment using plugins then file save overwrites that.

Fredrik Andersson13:10:10

@UJY23QLS1 sometimes, sometimes it's just because previous line/lines were indented by one or two and I want everything to be consistent

Fredrik Andersson13:10:34

@U028ART884X okay, thats a good idea. how did you configure that?

Martynas Maciulevičius13:10:23

I have this:

Plug 'lukas-reineke/lsp-format.nvim'
Then I have this:
require('lsp-format').setup {}
Then I also do this (notice the client):
local on_attach = function(client, bufnr)

-- Foramt on save via `lukas-reineke/lsp-format.nvim`
require('lsp-format').on_attach(client)
Then I take this on_attach and use it here:
local lspconfig = require('lspconfig')
for _, lsp_plugin_config in pairs(lsp_plugin_configs) do
  local lsp_plugin_name = lsp_plugin_config[1]
  local lsp_plugin_on_init = lsp_plugin_config[2]

  lspconfig[lsp_plugin_name].setup({
    capabilities = capabilities, -- nvim-cmp
    on_attach    = on_attach,

(this stuff is too long)
Pretty painful to set it up. But now it works for all kinds of languages and it's great! 😄 There are probably better ways to set it up. With my config I have a list of language names and this loop simply activates all of them.

Fredrik Andersson13:10:25

hm ok i'm looking at the plugin now