Skip to content

Commit 3261235

Browse files
pgolikPgolik
authored andcommitted
Adding difftool
Adding simple LSP for C++ Cmake Adding linter for C++ Cmake Adding formatter for C++
1 parent f761c6b commit 3261235

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

init.lua

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ vim.opt.scrolloff = 10
181181
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
182182

183183
-- Diagnostic keymaps
184+
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
185+
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
186+
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
184187
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
185188

186189
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
@@ -253,7 +256,12 @@ require('lazy').setup({
253256
--
254257
-- Use `opts = {}` to force a plugin to be loaded.
255258
--
259+
-- This is equivalent to:
260+
-- require('Comment').setup({})
256261

262+
-- "gc" to comment visual regions/lines
263+
{ 'numToStr/Comment.nvim', opts = {} },
264+
{ 'sindrets/diffview.nvim', opts = {} },
257265
-- Here is a more advanced example where we pass configuration
258266
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
259267
-- require('gitsigns').setup({ ... })
@@ -630,7 +638,7 @@ require('lazy').setup({
630638
-- - settings (table): Override the default settings passed when initializing the server.
631639
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
632640
local servers = {
633-
-- clangd = {},
641+
clangd = {},
634642
-- gopls = {},
635643
-- pyright = {},
636644
-- rust_analyzer = {},
@@ -643,6 +651,7 @@ require('lazy').setup({
643651
-- ts_ls = {},
644652
--
645653

654+
cmake = {},
646655
lua_ls = {
647656
-- cmd = {...},
648657
-- filetypes = { ...},
@@ -723,6 +732,7 @@ require('lazy').setup({
723732
}
724733
end,
725734
formatters_by_ft = {
735+
cmake = { 'cmakelang' },
726736
cpp = { 'clang_format' },
727737
lua = { 'stylua' },
728738
-- Conform can also run multiple formatters sequentially
@@ -926,12 +936,21 @@ require('lazy').setup({
926936
},
927937
indent = { enable = true, disable = { 'ruby' } },
928938
},
929-
-- There are additional nvim-treesitter modules that you can use to interact
930-
-- with nvim-treesitter. You should go explore a few and see what interests you:
931-
--
932-
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
933-
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
934-
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
939+
config = function(_, opts)
940+
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
941+
942+
-- Prefer git instead of curl in order to improve connectivity in some environments
943+
require('nvim-treesitter.install').prefer_git = true
944+
---@diagnostic disable-next-line: missing-fields
945+
require('nvim-treesitter.configs').setup(opts)
946+
947+
-- There are additional nvim-treesitter modules that you can use to interact
948+
-- with nvim-treesitter. You should go explore a few and see what interests you:
949+
--
950+
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
951+
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
952+
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
953+
end,
935954
},
936955

937956
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
@@ -954,8 +973,6 @@ require('lazy').setup({
954973
-- This is the easiest way to modularize your config.
955974
--
956975
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
957-
<<<<<<< HEAD
958-
=======
959976
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
960977
{ 'kdheepak/lazygit.nvim' },
961978
{
@@ -970,7 +987,6 @@ require('lazy').setup({
970987
}
971988
end,
972989
},
973-
>>>>>>> b708f3d (Add files via upload)
974990
-- { import = 'custom.plugins' },
975991
--
976992
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`

0 commit comments

Comments
 (0)