Added Format command to nvim
This commit is contained in:
parent
5ff77c5bf3
commit
d860d44f44
@ -27,10 +27,10 @@ keymap("n", "<C-+>", "<C-}>", opts)
|
||||
|
||||
-- Normal --
|
||||
-- Better window navigation
|
||||
keymap("n", "<C-h>", "<C-w>h", opts)
|
||||
keymap("n", "<C-j>", "<C-w>j", opts)
|
||||
keymap("n", "<C-k>", "<C-w>k", opts)
|
||||
keymap("n", "<C-l>", "<C-w>l", opts)
|
||||
keymap("n", "<leader>h", "<C-w>h", opts)
|
||||
keymap("n", "<leader>j", "<C-w>j", opts)
|
||||
keymap("n", "<leader>k", "<C-w>k", opts)
|
||||
keymap("n", "<leader>l", "<C-w>l", opts)
|
||||
|
||||
keymap("n", "<leader>e", ":NvimTreeToggle<cr>", opts)
|
||||
|
||||
@ -80,3 +80,8 @@ keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", term_opts)
|
||||
keymap("n", "<leader>f", "<cmd>lua require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ previewer = false }))<cr>", opts)
|
||||
keymap("n", "<c-t>", "<cmd>Telescope live_grep<cr>", opts)
|
||||
|
||||
-- Format document --
|
||||
keymap("n", "<leader><leader>f", "<cmd>Format<cr>", opts)
|
||||
|
||||
-- close buffer --
|
||||
keymap("n", "<leader>q", "<cmd>Bdelete! %d<cr>",opts)
|
||||
|
17
nvim/.config/nvim/lua/user/lsp/null-ls.lua
Normal file
17
nvim/.config/nvim/lua/user/lsp/null-ls.lua
Normal file
@ -0,0 +1,17 @@
|
||||
local null_ls_status_ok, null_ls = pcall(require, "null-ls")
|
||||
if not null_ls_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
||||
local formatting = null_ls.builtins.formatting
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
|
||||
null_ls.setup {
|
||||
debug = false,
|
||||
sources = {
|
||||
formatting.clang_format,
|
||||
diagnostics.gccdiag,
|
||||
},
|
||||
}
|
Loading…
Reference in New Issue
Block a user