Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme improvements #69

Closed
LamprosPitsillos opened this issue Oct 26, 2023 · 1 comment
Closed

Readme improvements #69

LamprosPitsillos opened this issue Oct 26, 2023 · 1 comment

Comments

@LamprosPitsillos
Copy link

It would be greatly appreciated if the README was a bit more detailed . With some added installation instructions and how to use .

For example:

Assuming otter.nvim is configured and added to nvim-cmp as a completion source

These are never mentioned and the only docs is the README

require'otter'.activate({'python', 'r', })

Should this be called like .setup() or should this be called on file enter with all the languages the file is potentially going to have ?

and a few other stuff.

Thanks for your hard work!

@gzagatti
Copy link

gzagatti commented Oct 31, 2023

Recently I have become interested in Otter. I've come up with a turnkey solution using Packer.

  use {
    'jmbuhr/otter.nvim',
    requires = { 'neovim/nvim-lspconfig' },
    config = function()
        function otter_extensions(arglead, _, _)
          local extensions = require'otter.tools.extensions'
          local out = {}
          for k, v in pairs(extensions) do
            if arglead == nil then
              table.insert(out, "*.otter." .. v)
            elseif k:find("^" .. arglead) ~= nil then
              table.insert(out, k)
            end
          end
          return out
        end
        print(vim.inspect(otter_extensions()))
        vim.api.nvim_create_autocmd({'BufNewFile', 'BufRead'}, {
          group = vim.api.nvim_create_augroup("lspconfig", { clear = false }),
          pattern = otter_extensions(),
          callback = function(ev)
            local buf = ev.buf
            local ft = vim.api.nvim_get_option_value("filetype", { buf = ev.buf })
            local matching_configs = require('lspconfig.util').get_config_by_ft(ft)
              for _, config in ipairs(matching_configs) do
                print("Activating ", config.name, " LspOtter in buffer ", buf, "...")
                config.launch(buf)
              end
          end
        })
        vim.cmd [[ command! -nargs=* -complete=customlist,v:lua.otter_extensions LspOtter lua require'otter'.activate({<f-args>}) ]]
    end
  }

Whenever you want to use Otter just call in the command line:

:LspOtter python

Any suggestions to improve the code are welcome.

@jmbuhr jmbuhr closed this as completed Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants