mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 14:12:41 +00:00
Added swift.nvim plugin
This commit is contained in:
@@ -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 <control>-b to build swift package in terminal window.
|
||||
keymap('n', '<C-b>', '<cmd>lua SWIFT_BUILD()<cr>', default_options)
|
||||
|
||||
-- Key map <control>-b to build swift package in terminal window.
|
||||
keymap('n', '<C-u>', '<cmd>lua SWIFT_TEST()<cr>', default_options)
|
||||
|
||||
-- Format swift files when buffer is written
|
||||
autocmd(
|
||||
"BufWritePost",
|
||||
{
|
||||
pattern = { "*.swift" },
|
||||
command=":silent exec '!swift-format --in-place %'"
|
||||
}
|
||||
)
|
||||
@@ -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" },
|
||||
|
||||
@@ -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"
|
||||
-- }
|
||||
}
|
||||
|
||||
14
nvim/m-housh/lua/plugin-config/swift.lua
Normal file
14
nvim/m-housh/lua/plugin-config/swift.lua
Normal file
@@ -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', '<c-b>', actions.build, default_options)
|
||||
vim.keymap.set('n', '<c-u>', actions.test, default_options)
|
||||
end
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user