Skip to content

Commit

Permalink
add formatter and linter
Browse files Browse the repository at this point in the history
  • Loading branch information
wongsingfo committed Oct 30, 2023
1 parent c5303c7 commit 86fc2bb
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ RUN fish -c 'curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main
# The "sleep *" is a workaround for https://github.com/nvim-treesitter/nvim-treesitter/issues/2900
RUN curl -L https://github.com/neovim/neovim/releases/download/stable/nvim-linux64.tar.gz | sudo tar zxf - -C /usr/local/ --strip-components=1 && \
nvim --headless +"Lazy restore" +"TSUpdateSync" +"MasonUpdate" \
+"MasonInstall pyright" +"MasonInstall clangd" \
+"MasonInstall pyright" +"MasonInstall black" +"MasonInstall clangd" \
+"sleep 20" +qall

2 changes: 2 additions & 0 deletions stow-dotfiles/nvim/.config/nvim/lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"fidget.nvim": { "branch": "legacy", "commit": "90c22e47be057562ee9566bad313ad42d622c1d3" },
"gitsigns.nvim": { "branch": "main", "commit": "5d73da785a3c05fd63ac31769079db05169a6ec7" },
"gruvbox": { "branch": "master", "commit": "bf2885a95efdad7bd5e4794dd0213917770d79b7" },
"guard-collection": { "branch": "main", "commit": "41d4e036e350c44316c00eeaa651bb00ac24916f" },
"guard.nvim": { "branch": "main", "commit": "71a5e4861fc65dd6298bdb6e6d3027e81c134708" },
"lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" },
"lsp_signature.nvim": { "branch": "master", "commit": "58d4e810801da74c29313da86075d6aea537501f" },
"lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
Expand Down
6 changes: 6 additions & 0 deletions stow-dotfiles/nvim/.config/nvim/lua/core/keybindings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ wk.register({
l = {
name = 'Lazygit',
},
c = {
name = "Copy to clipboard",
},
}, { prefix = '<leader>' })

-- LSP Saga
Expand Down Expand Up @@ -126,6 +129,9 @@ keymap("n", "<leader>gK", "<cmd>Lspsaga hover_doc ++keep<CR>")
-- keymap("n", "<Leader>ci", "<cmd>Lspsaga incoming_calls<CR>")
-- keymap("n", "<Leader>co", "<cmd>Lspsaga outgoing_calls<CR>")

-- Format
keymap("n", "<leader>gf", "<cmd>GuardFmt<CR>")

-- Floating terminal
keymap({"n", "t"}, "<A-d>", "<cmd>Lspsaga term_toggle<CR>")

Expand Down
25 changes: 25 additions & 0 deletions stow-dotfiles/nvim/.config/nvim/lua/core/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,31 @@ require('lazy').setup({
}
},
},
{
"nvimdev/guard.nvim",
-- Builtin configuration, optional
dependencies = {
"nvimdev/guard-collection",
},
config = function()
local ft = require('guard.filetype')
-- -- Assuming you have guard-collection
-- ft('lang'):fmt('format-tool-1')
-- :append('format-tool-2')
-- :env(env_table)
-- :lint('lint-tool-1')
-- :extra(extra_args)
ft('python'):fmt('black')

-- Call setup() LAST!
require('guard').setup({
-- the only options for the setup function
fmt_on_save = false,
-- Use lsp if no formatter was defined for this filetype
lsp_as_default_formatter = true,
})
end,
},
},
},
{
Expand Down

0 comments on commit 86fc2bb

Please sign in to comment.