neovim

Personal neovim configuration files
git clone git://gtms.dev/neovim
Log | Files | Refs

commit b5b2890191ac9f39c8c73f5a9e186b49981cd9ca
parent 8943099bd129f018f585548613e65dabe31009c2
Author: Tomas Nemec <owl@gtms.dev>
Date:   Tue, 10 Oct 2023 09:23:21 +0200

update

Diffstat:
Mftplugin/dart.lua | 94++++++++++++++++++++++++++++++++++++++++++-------------------------------------
1 file changed, 50 insertions(+), 44 deletions(-)

diff --git a/ftplugin/dart.lua b/ftplugin/dart.lua @@ -1,8 +1,9 @@ vim.bo.comments = [[sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,://]] vim.bo.commentstring = '//%s' -vim.bo.includeexpr = [[v:lua.require('tms.ft.dart.package').package_path(v:fname)]] -vim.opt_local.isfname:append{ ':' } -vim.opt_local.iskeyword:append{ '$' } +vim.bo.includeexpr = + [[v:lua.require('tms.ft.dart.package').package_path(v:fname)]] +vim.opt_local.isfname:append{':'} +vim.opt_local.iskeyword:append{'$'} vim.b.undo_ftplugin = 'setl com< cms< inex< isf<' vim.cmd.iabbrev('STring', 'String') @@ -11,9 +12,7 @@ vim.bo.makeprg = [[echo && dart %]] vim.bo.efm = [[%f:%l:%c: %m]] local full_path = vim.fn.expand('%:p') -if string.find(full_path, '%.pub%-cache') then - vim.bo.modifiable = false -end +if string.find(full_path, '%.pub%-cache') then vim.bo.modifiable = false end vim.lsp.start(require'tms.lsp'.make_opts('dartls')) @@ -31,44 +30,51 @@ vim.api.nvim_buf_create_user_command(0, 'DartTest', function() end, {}) if pcall(require, 'dart-tools') then - local dt_lsp = require('dart-tools.lsp') - local dt_req = require('dart-tools.lsp.request') - local ddebug = require('tms.ft.dart.debug') + local dt_lsp = require('dart-tools.lsp') + local dt_req = require('dart-tools.lsp.request') + local ddebug = require('tms.ft.dart.debug') - local cmd_opts = {} - vim.api.nvim_buf_create_user_command(0, 'DartDebug', ddebug.func, cmd_opts) - vim.api.nvim_buf_create_user_command(0, 'DartPrint', ddebug.print, cmd_opts) - vim.api.nvim_buf_create_user_command(0, 'DartOrganizeImports', dt_lsp.organize_imports, cmd_opts) - vim.api.nvim_buf_create_user_command(0, 'DartFixAll', dt_lsp.fix_all, cmd_opts) - vim.api.nvim_buf_create_user_command(0, 'DartExtract', dt_lsp.extract_method, cmd_opts) - vim.api.nvim_buf_create_user_command(0, 'DartVariable', dt_lsp.extract_local_variable, cmd_opts) + local cmd_opts = {} + vim.api.nvim_buf_create_user_command(0, 'DartDebug', ddebug.func, cmd_opts) + vim.api.nvim_buf_create_user_command(0, 'DartPrint', ddebug.print, cmd_opts) + vim.api.nvim_buf_create_user_command(0, 'DartOrganizeImports', + dt_lsp.organize_imports, cmd_opts) + vim.api.nvim_buf_create_user_command(0, 'DartFixAll', dt_lsp.fix_all, + cmd_opts) + vim.api.nvim_buf_create_user_command(0, 'DartExtract', + dt_lsp.extract_method, cmd_opts) + vim.api.nvim_buf_create_user_command(0, 'DartVariable', + dt_lsp.extract_local_variable, cmd_opts) - local opts = function(desc) - return { buffer = true, desc = desc } - end - vim.keymap.set('n', '<leader>ap', function() - ddebug.print() - end, opts('Dart Debug Print')) - vim.keymap.set('n', '<leader>ao', dt_lsp.organize_imports, opts('Dart Organize Imports')) - vim.keymap.set('n', '<leader>af', dt_lsp.fix_all, opts('Dart Fix All')) - vim.keymap.set({ 'v', 'n' }, '<leader>ai', dt_lsp.inline_local_variable, opts('Dart Inline Local Varibale')) - vim.keymap.set({ 'v', 'n' }, '<leader>ae', dt_lsp.extract_local_variable, opts('Dart Extract Local Varibale')) - vim.keymap.set({ 'v', 'n' }, '<leader>am', dt_lsp.extract_method, opts('Dart Extract Method')) - vim.keymap.set('n', '<leader>al', dt_lsp.list_code_action_kinds, opts('Dart List Code Actions')) - vim.keymap.set('n', '<leader>as', function() - dt_req.execute_command('refactor.splitVariableDeclaration') - end, opts('Dart Split Variable Declaration')) - vim.keymap.set('n', '<leader>aj', function() - dt_req.execute_command('refactor.joinVariableDeclaration') - end, opts('Dart Join Variable Declaration')) - vim.keymap.set('n', '<leader>ax', function() - dt_req.execute_command('refactor.convert.bodyToExpression') - end, opts('Dart Convert To Expression')) - vim.keymap.set('n', '<leader>aa', function() - dt_req.execute_command('refactor.convert.bodyToAsync') - end, opts('Dart Convert To Async')) - vim.keymap.set('n', '<leader>ab', function() - dt_req.execute_command('refactor.convert.bodyToBlock') - end, opts('Dart Convert To Block')) - vim.keymap.set('n', '<leader>ad', dt_lsp.super, opts('Dart Go to Super Definition')) + local opts = function(desc) return {buffer = true, desc = desc} end + vim.keymap.set('n', '<leader>ap', function() ddebug.print() end, + opts('Dart Debug Print')) + vim.keymap.set('n', '<leader>ao', dt_lsp.organize_imports, + opts('Dart Organize Imports')) + vim.keymap.set('n', '<leader>af', dt_lsp.fix_all, opts('Dart Fix All')) + vim.keymap.set({'v', 'n'}, '<leader>ai', dt_lsp.inline_local_variable, + opts('Dart Inline Local Varibale')) + vim.keymap.set({'v', 'n'}, '<leader>ae', dt_lsp.extract_local_variable, + opts('Dart Extract Local Varibale')) + vim.keymap.set({'v', 'n'}, '<leader>am', dt_lsp.extract_method, + opts('Dart Extract Method')) + vim.keymap.set('n', '<leader>al', dt_lsp.list_code_action_kinds, + opts('Dart List Code Actions')) + vim.keymap.set('n', '<leader>as', function() + dt_req.execute_command('refactor.splitVariableDeclaration') + end, opts('Dart Split Variable Declaration')) + vim.keymap.set('n', '<leader>aj', function() + dt_req.execute_command('refactor.joinVariableDeclaration') + end, opts('Dart Join Variable Declaration')) + vim.keymap.set('n', '<leader>ax', function() + dt_req.execute_command('refactor.convert.bodyToExpression') + end, opts('Dart Convert To Expression')) + vim.keymap.set('n', '<leader>aa', function() + dt_req.execute_command('refactor.convert.bodyToAsync') + end, opts('Dart Convert To Async')) + vim.keymap.set('n', '<leader>ab', function() + dt_req.execute_command('refactor.convert.bodyToBlock') + end, opts('Dart Convert To Block')) + vim.keymap.set('n', '<leader>ad', dt_lsp.super, + opts('Dart Go to Super Definition')) end