cmake, neo-tree, cpp and clang support

cmak support, neo-tree, cpp, clang, etc,,,
This commit is contained in:
Simon Ayoub 2024-07-27 12:44:30 +10:00
parent b6f7005702
commit 897d3c9beb
3 changed files with 59 additions and 12 deletions

View file

@ -154,6 +154,8 @@ vim.opt.cursorline = true
-- Minimal number of screen lines to keep above and below the cursor. -- Minimal number of screen lines to keep above and below the cursor.
vim.opt.scrolloff = 10 vim.opt.scrolloff = 10
vim.opt.smartindent = true
-- [[ Basic Keymaps ]] -- [[ Basic Keymaps ]]
-- See `:help vim.keymap.set()` -- See `:help vim.keymap.set()`
@ -190,7 +192,10 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }) vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
-- [[ Basic Autocommands ]] -- vim.o.winbar = '%=%m %f'
vim.o.winbar = '%f'
-- [[ Basic Autocommands ]]:
-- See `:help lua-guide-autocommands` -- See `:help lua-guide-autocommands`
-- Highlight when yanking (copying) text -- Highlight when yanking (copying) text
@ -207,7 +212,7 @@ vim.api.nvim_create_autocmd('TextYankPost', {
-- [[ Install `lazy.nvim` plugin manager ]] -- [[ Install `lazy.nvim` plugin manager ]]
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then if not vim.uv.fs_stat(lazypath) then
local lazyrepo = 'https://github.com/folke/lazy.nvim.git' local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
end ---@diagnostic disable-next-line: undefined-field end ---@diagnostic disable-next-line: undefined-field
@ -255,6 +260,7 @@ require('lazy').setup({
topdelete = { text = '' }, topdelete = { text = '' },
changedelete = { text = '~' }, changedelete = { text = '~' },
}, },
current_line_blame = true,
}, },
}, },
@ -353,11 +359,14 @@ require('lazy').setup({
-- You can put your default mappings / updates / etc. in here -- You can put your default mappings / updates / etc. in here
-- All the info you're looking for is in `:help telescope.setup()` -- All the info you're looking for is in `:help telescope.setup()`
-- --
-- defaults = { defaults = {
-- mappings = { mappings = {
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' }, i = { ['<c-enter>'] = 'to_fuzzy_refine' },
-- }, },
-- }, file_ignore_patterns = {
'build/*',
},
},
-- pickers = {} -- pickers = {}
extensions = { extensions = {
['ui-select'] = { ['ui-select'] = {
@ -466,6 +475,12 @@ require('lazy').setup({
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end end
-- Define the map function with support for arguments
local map_with_args = function(keys, func, desc, args)
vim.keymap.set('n', keys, function()
func(args)
end, { buffer = event.buf, desc = 'LSP: ' .. desc })
end
-- Jump to the definition of the word under your cursor. -- Jump to the definition of the word under your cursor.
-- This is where a variable was first declared, or where a function is defined, etc. -- This is where a variable was first declared, or where a function is defined, etc.
-- To jump back, press <C-t>. -- To jump back, press <C-t>.
@ -485,7 +500,7 @@ require('lazy').setup({
-- Fuzzy find all the symbols in your current document. -- Fuzzy find all the symbols in your current document.
-- Symbols are things like variables, functions, types, etc. -- Symbols are things like variables, functions, types, etc.
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') map_with_args('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols', { fname_width = 0.5, symbol_width = 0.75 })
-- Fuzzy find all the symbols in your current workspace. -- Fuzzy find all the symbols in your current workspace.
-- Similar to document symbols, except searches over your entire project. -- Similar to document symbols, except searches over your entire project.
@ -544,6 +559,9 @@ require('lazy').setup({
map('<leader>th', function() map('<leader>th', function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end, '[T]oggle Inlay [H]ints') end, '[T]oggle Inlay [H]ints')
-- enable inlay on by default.
vim.lsp.inlay_hint.enable()
end end
end, end,
}) })
@ -778,13 +796,15 @@ require('lazy').setup({
-- change the command in the config to whatever the name of that colorscheme is. -- change the command in the config to whatever the name of that colorscheme is.
-- --
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
'folke/tokyonight.nvim', 'catppuccin/nvim',
name = 'catppuccin',
priority = 1000, -- Make sure to load this before all the other start plugins. priority = 1000, -- Make sure to load this before all the other start plugins.
init = function() init = function()
-- Load the colorscheme here. -- Load the colorscheme here.
-- Like many other themes, this one has different styles, and you could load -- Like many other themes, this one has different styles, and you could load
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
vim.cmd.colorscheme 'tokyonight-night' -- colorscheme catppuccin " catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha
vim.cmd.colorscheme 'catppuccin-mocha'
-- You can configure highlights by doing something like: -- You can configure highlights by doing something like:
vim.cmd.hi 'Comment gui=none' vim.cmd.hi 'Comment gui=none'
@ -876,7 +896,7 @@ require('lazy').setup({
-- require 'kickstart.plugins.debug', -- require 'kickstart.plugins.debug',
require 'kickstart.plugins.indent_line', require 'kickstart.plugins.indent_line',
-- require 'kickstart.plugins.lint', -- require 'kickstart.plugins.lint',
-- require 'kickstart.plugins.autopairs', require 'kickstart.plugins.autopairs',
require 'kickstart.plugins.neo-tree', require 'kickstart.plugins.neo-tree',
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps

View file

@ -2,4 +2,26 @@
-- I promise not to create any merge conflicts in this directory :) -- I promise not to create any merge conflicts in this directory :)
-- --
-- See the kickstart.nvim README for more information -- See the kickstart.nvim README for more information
return { 'Civitasv/cmake-tools.nvim' } return {
'Civitasv/cmake-tools.nvim',
lazy = true,
init = function()
local loaded = false
local function check()
local cwd = vim.uv.cwd()
if vim.fn.filereadable(cwd .. '/CMakeLists.txt') == 1 then
require('lazy').load { plugins = { 'cmake-tools.nvim' } }
loaded = true
end
end
check()
vim.api.nvim_create_autocmd('DirChanged', {
callback = function()
if not loaded then
check()
end
end,
})
end,
opts = {},
}

View file

@ -20,6 +20,11 @@ return {
['\\'] = 'close_window', ['\\'] = 'close_window',
}, },
}, },
filtered_items = {
visible = true,
hide_dotfiles = false,
hide_gitignored = false,
},
}, },
}, },
} }