Add flutter-tools neovim plugin

pull/1/head
Ensar Sarajčić 2021-03-17 20:34:03 +01:00
parent 610563bde4
commit 11a9ac9f30
2 changed files with 19 additions and 10 deletions

View File

@ -67,13 +67,16 @@ return require('packer').startup {
use 'nvim-treesitter/playground' -- TSPlaygroundToggle - access treesitter data use 'nvim-treesitter/playground' -- TSPlaygroundToggle - access treesitter data
-- LSP -- -- LSP --
use 'tjdevries/nlua.nvim' -- Built-in Lua integration with LSP
use 'neovim/nvim-lspconfig' -- Easy LSP Config use 'neovim/nvim-lspconfig' -- Easy LSP Config
use 'alexaandru/nvim-lspupdate' -- Easy install and update for many LSP servers use 'alexaandru/nvim-lspupdate' -- Easy install and update for many LSP servers
use 'nvim-lua/completion-nvim' -- LSP completion integration use 'nvim-lua/completion-nvim' -- LSP completion integration
use 'nvim-treesitter/completion-treesitter' -- Treesitter completion integration use 'nvim-treesitter/completion-treesitter' -- Treesitter completion integration
use 'nvim-lua/lsp_extensions.nvim' -- LSP extensions (like closing labels for Dart) use 'nvim-lua/lsp_extensions.nvim' -- LSP extensions (like closing labels for Dart)
-- LSP language specific
use 'tjdevries/nlua.nvim' -- Built-in Lua integration with LSP
use 'akinsho/flutter-tools.nvim' -- Additional flutter integrations
-- Lua support -- -- Lua support --
use 'tjdevries/astronauta.nvim' -- Support for lua ftplugins and plugins use 'tjdevries/astronauta.nvim' -- Support for lua ftplugins and plugins
use 'nvim-lua/popup.nvim' -- Popup API integration - needed for some plugins use 'nvim-lua/popup.nvim' -- Popup API integration - needed for some plugins

View File

@ -12,7 +12,7 @@ local on_attach = function(client, bufnr)
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
default_opts = {noremap = true, silent = true} local default_opts = {noremap = true, silent = true}
-- Lsp keymaps -- Lsp keymaps
buf_set_keymap('n', '<C-]>', '<cmd>lua vim.lsp.buf.definition()<CR>', default_opts) buf_set_keymap('n', '<C-]>', '<cmd>lua vim.lsp.buf.definition()<CR>', default_opts)
@ -25,14 +25,14 @@ local on_attach = function(client, bufnr)
buf_set_keymap('n', '<Leader>ac', '<cmd>lua vim.lsp.buf.code_action()<CR>', default_opts) buf_set_keymap('n', '<Leader>ac', '<cmd>lua vim.lsp.buf.code_action()<CR>', default_opts)
buf_set_keymap('n', '<Leader>a', '<cmd>lua vim.lsp.buf.code_action_range()<CR>', default_opts) buf_set_keymap('n', '<Leader>a', '<cmd>lua vim.lsp.buf.code_action_range()<CR>', default_opts)
completion_opts = {silent = true} local completion_opts = {silent = true}
-- Completion keymaps -- Completion keymaps
buf_set_keymap('i', '<C-n>', '<Plug>(completion_trigger)', completion_opts) buf_set_keymap('i', '<C-n>', '<Plug>(completion_trigger)', completion_opts)
end end
-- Lsp default language servers -- Lsp default language servers
local servers = { "bashls", "clangd", "dartls", "jsonls", "pyright", "rust_analyzer", "kotlin_language_server", "vimls" } local servers = { "bashls", "clangd", "jsonls", "pyright", "rust_analyzer", "kotlin_language_server", "vimls" }
for _, lsp in ipairs(servers) do for _, lsp in ipairs(servers) do
lspconfig[lsp].setup { on_attach = on_attach } lspconfig[lsp].setup { on_attach = on_attach }
end end
@ -42,6 +42,12 @@ require('nlua.lsp.nvim').setup(lspconfig, {
on_attach = on_attach, on_attach = on_attach,
-- Include globals you want to tell the LSP are real :) -- Include globals you want to tell the LSP are real :)
globals = { globals = {}
}
}) })
-- Flutter tools
require('flutter-tools').setup {
lsp = {
on_attach = on_attach
}
}