diff --git a/nvim/m-housh/ftplugin/swift.lua b/nvim/m-housh/ftplugin/swift.lua deleted file mode 100644 index e47c5ef..0000000 --- a/nvim/m-housh/ftplugin/swift.lua +++ /dev/null @@ -1,44 +0,0 @@ -local o = vim.opt -local keymap = vim.api.nvim_set_keymap -local default_options = {noremap = true, silent = true} -local Terminal = require("toggleterm.terminal").Terminal -local autocmd = vim.api.nvim_create_autocmd - -o.tabstop = 2 -o.softtabstop = 2 -o.shiftwidth = 2 - -function SWIFT_TEST() - local swifttest = Terminal:new({ - cmd = "swift test", - hidden = true, - close_on_exit = false, - auto_scroll = true, - }) - swifttest:toggle() -end - -function SWIFT_BUILD() - local swiftbuild = Terminal:new({ - cmd = "swift build", - hidden = true, - close_on_exit = false, - auto_scroll = true, - }) - swiftbuild:toggle() -end - --- Key map -b to build swift package in terminal window. -keymap('n', '', 'lua SWIFT_BUILD()', default_options) - --- Key map -b to build swift package in terminal window. -keymap('n', '', 'lua SWIFT_TEST()', default_options) - --- Format swift files when buffer is written -autocmd( - "BufWritePost", - { - pattern = { "*.swift" }, - command=":silent exec '!swift-format --in-place %'" - } -) diff --git a/nvim/m-housh/lazy-lock.json b/nvim/m-housh/lazy-lock.json index 4ccf5e4..bd0f2ba 100644 --- a/nvim/m-housh/lazy-lock.json +++ b/nvim/m-housh/lazy-lock.json @@ -15,17 +15,18 @@ "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "2451adb9bdb0fd32140bf3aa8dbc17ff60050db3" }, "mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" }, - "neo-tree.nvim": { "branch": "v3.x", "commit": "2d89ca96e08eb6e9c8e50e1bb4738bc5125c9f12" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "71f1841ba6c652908678cece623f52c1fea8a6cd" }, "neogit": { "branch": "master", "commit": "dfacf16679b120c50c8a2dcefe00f77932523708" }, "nightfox.nvim": { "branch": "main", "commit": "ee3525fdfbe2ed81270a336ccbe62f433165357b" }, "nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" }, "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, "nvim-lsp-installer": { "branch": "main", "commit": "17e0bfa5f2c8854d1636fcd036dc8284db136baa" }, "nvim-lspconfig": { "branch": "master", "commit": "ede4114e1fd41acb121c70a27e1b026ac68c42d6" }, - "nvim-treesitter": { "branch": "master", "commit": "af6b3ecea9b3cff18b9244027e23e7f2c34ebdd5" }, + "nvim-treesitter": { "branch": "master", "commit": "0960322686bfa38afd4f1e0b9660473cf77e24b6" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "bd103502252027434ec42f628d2dbf54821d4ce6" }, - "nvim-web-devicons": { "branch": "master", "commit": "b844d3da4affb77fb2ba56ed235946f0ba0ab200" }, + "nvim-web-devicons": { "branch": "master", "commit": "480a756df82a0c231622c9bf2173bb6634713716" }, "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" }, + "swift.nvim": { "branch": "main", "commit": "a84cb608b0076aef39d3d4b1d20448a86a73b2eb" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope.nvim": { "branch": "0.1.x", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }, "toggleterm.nvim": { "branch": "main", "commit": "0427b908ebefcb3701c7f2cfbdafa37d11afe71a" }, diff --git a/nvim/m-housh/lua/plugin-config/init.lua b/nvim/m-housh/lua/plugin-config/init.lua index 47b2e0f..2a6d912 100644 --- a/nvim/m-housh/lua/plugin-config/init.lua +++ b/nvim/m-housh/lua/plugin-config/init.lua @@ -6,8 +6,7 @@ return { vim.g.vsnip_snippet_dir = os.getenv('HOME') .. '/.config/nvim/snippets/' end }, - -- Local development plugin for swift. - { - dir = "~/LocalProjects/swift.nvim" - } +-- { +-- dir = "~/LocalProjects/plugins/m-housh/swift.nvim" +-- } } diff --git a/nvim/m-housh/lua/plugin-config/swift.lua b/nvim/m-housh/lua/plugin-config/swift.lua new file mode 100644 index 0000000..06a6a72 --- /dev/null +++ b/nvim/m-housh/lua/plugin-config/swift.lua @@ -0,0 +1,14 @@ +return { + 'm-housh/swift.nvim', + dependencies = { + 'akinsho/toggleterm.nvim' + }, + config = function() + require('swift').setup() + local default_options = { noremap = true, silent = true } + local actions = require('swift.actions') + + vim.keymap.set('n', '', actions.build, default_options) + vim.keymap.set('n', '', actions.test, default_options) + end +} diff --git a/nvim/m-housh/lua/plugins.lua b/nvim/m-housh/lua/plugins.lua index 16f83a8..c280baa 100644 --- a/nvim/m-housh/lua/plugins.lua +++ b/nvim/m-housh/lua/plugins.lua @@ -15,4 +15,12 @@ vim.opt.rtp:prepend(lazypath) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -require("lazy").setup('plugin-config') +require("lazy").setup( + 'plugin-config', + { + dev = { + path = '~/LocalProjects/plugins', + fallback = true + } + } +)