@@ -91,7 +91,7 @@ vim.g.mapleader = ' '
9191vim .g .maplocalleader = ' '
9292
9393-- Set to true if you have a Nerd Font installed and selected in the terminal
94- vim .g .have_nerd_font = false
94+ vim .g .have_nerd_font = true
9595
9696-- [[ Setting options ]]
9797-- See `:help vim.opt`
@@ -102,7 +102,7 @@ vim.g.have_nerd_font = false
102102vim .opt .number = true
103103-- You can also add relative line numbers, to help with jumping.
104104-- Experiment for yourself to see if you like it!
105- -- vim.opt.relativenumber = true
105+ vim .opt .relativenumber = true
106106
107107-- Enable mouse mode, can be useful for resizing splits for example!
108108vim .opt .mouse = ' a'
@@ -328,8 +328,7 @@ require('lazy').setup({
328328 { ' <leader>c' , group = ' [C]ode' , mode = { ' n' , ' x' } },
329329 { ' <leader>d' , group = ' [D]ocument' },
330330 { ' <leader>r' , group = ' [R]ename' },
331- { ' <leader>s' , group = ' [S]earch' },
332- { ' <leader>w' , group = ' [W]orkspace' },
331+
333332 { ' <leader>t' , group = ' [T]oggle' },
334333 { ' <leader>h' , group = ' Git [H]unk' , mode = { ' n' , ' v' } },
335334 },
@@ -393,11 +392,12 @@ require('lazy').setup({
393392 -- You can put your default mappings / updates / etc. in here
394393 -- All the info you're looking for is in `:help telescope.setup()`
395394 --
396- -- defaults = {
397- -- mappings = {
398- -- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
399- -- },
400- -- },
395+ defaults = {
396+ file_ignore_patterns = { ' third_party/.*' },
397+ -- mappings = {
398+ -- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
399+ -- },
400+ },
401401 -- pickers = {}
402402 extensions = {
403403 [' ui-select' ] = {
@@ -658,7 +658,7 @@ require('lazy').setup({
658658 -- - settings (table): Override the default settings passed when initializing the server.
659659 -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
660660 local servers = {
661- -- clangd = {},
661+ clangd = {},
662662 -- gopls = {},
663663 -- pyright = {},
664664 -- rust_analyzer = {},
@@ -1022,3 +1022,61 @@ require('lazy').setup({
10221022
10231023-- The line beneath this is called `modeline`. See `:help modeline`
10241024-- vim: ts=2 sts=2 sw=2 et
1025+
1026+ -- My custom configurations
1027+
1028+ -- Do not continue comment on new line
1029+ vim .cmd ' autocmd BufEnter * set formatoptions-=cro'
1030+ vim .cmd ' autocmd BufEnter * setlocal formatoptions-=cro'
1031+
1032+ -- Switch buffers
1033+ vim .keymap .set (' n' , ' <Tab>' , ' :bnext<CR>' , { desc = ' Next Buffer' })
1034+ vim .keymap .set (' n' , ' <S-Tab>' , ' :bprevious<CR>' , { desc = ' Previous Buffer' })
1035+
1036+ -- Builds
1037+ vim .opt .makeprg = ' cmake --build build'
1038+
1039+ vim .keymap .set (' n' , ' <leader>cc' , function ()
1040+ vim .cmd ' !cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON'
1041+ print ' 🔄 compile_commands.json updated!'
1042+ end , { desc = ' [C]Make: Update compile_commands.json ' })
1043+
1044+ local function find_executable ()
1045+ -- Find only macOS executable inside `build/`
1046+ local handle = io.popen ' find build -type f -perm +111' -- Find files with exec
1047+ if not handle then
1048+ print ' ⚠️ Error: Could not execute command.'
1049+ return nil
1050+ end
1051+
1052+ local exec = handle :read ' *l' -- Read first result
1053+ handle :close ()
1054+
1055+ if exec and exec ~= ' ' then
1056+ return exec
1057+ else
1058+ print ' ⚠️ No exectuable found in build/. Did you build the project?'
1059+ return nil
1060+ end
1061+ end
1062+
1063+ vim .keymap .set (' n' , ' <leader>m' , function ()
1064+ vim .cmd ' make' -- Run `:make` (compiles the project
1065+ vim .cmd ' silent! redraw!' -- Skip the "Press ENTER" prompt
1066+
1067+ -- Check if there are compilation errors
1068+ -- local errors = vim.fn.getqflist()
1069+ -- if #errors > 0 then
1070+ -- vim.cmd 'copen' -- Open the quickfix list to show errors
1071+ -- print '❌ Compilation failed. Check quickfix list.'
1072+ -- return
1073+ -- end
1074+
1075+ -- Check if there are compilation errors
1076+ local exec = find_executable ()
1077+ if exec then
1078+ vim .cmd (' ! ' .. exec ) -- Run the executable
1079+ else
1080+ print ' ⚠️ No executable found in build/.'
1081+ end
1082+ end , { desc = ' [M]ake & Run' })
0 commit comments