Skip to content

Commit 8d33138

Browse files
committed
update init.lua
1 parent 092e32f commit 8d33138

1 file changed

Lines changed: 33 additions & 71 deletions

File tree

init.lua

Lines changed: 33 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ vim.o.mouse = 'a'
2424
-- Don't show the mode, since it's already in the status line
2525
vim.o.showmode = false
2626

27-
vim.opt.tags = "./tags,../tags,../../tags,../../../tags,../../../../tags,../../../../../tags,../../../../../../tags,../../../../../../../tags"
27+
vim.opt.tags = './tags,../tags,../../tags,../../../tags,../../../../tags,../../../../../tags,../../../../../../tags,../../../../../../../tags'
2828

2929
vim.opt.backup = true
30-
local home_backup_path = os.getenv('HOME') .. '/.backup'
30+
local home_backup_path = os.getenv 'HOME' .. '/.backup'
3131
vim.opt.backupdir = home_backup_path
3232

3333
vim.opt.errorbells = false
@@ -97,10 +97,10 @@ vim.o.scrolloff = 10
9797
vim.o.confirm = true
9898

9999
vim.opt.foldlevel = 5
100-
vim.opt.foldmethod = "expr"
101-
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
100+
vim.opt.foldmethod = 'expr'
101+
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
102102

103-
vim.opt.diffopt="internal,filler,closeoff,iwhite,linematch:60"
103+
vim.opt.diffopt = 'internal,filler,closeoff,iwhite,linematch:60'
104104

105105
-- [[ Basic Keymaps ]]
106106
-- See `:help vim.keymap.set()`
@@ -170,19 +170,14 @@ vim.api.nvim_create_autocmd('TextYankPost', {
170170
})
171171

172172
vim.api.nvim_create_autocmd('BufReadPost', {
173-
pattern = { '*' },
174-
desc = 'When editing a file, always jump to the last known cursor position',
175-
callback = function()
176-
local line = vim.fn.line '\'"'
177-
if
178-
line >= 1
179-
and line <= vim.fn.line '$'
180-
and vim.bo.filetype ~= 'commit'
181-
and vim.fn.index({ 'xxd', 'gitrebase' }, vim.bo.filetype) == -1
182-
then
183-
vim.cmd 'normal! g`"'
184-
end
185-
end,
173+
pattern = { '*' },
174+
desc = 'When editing a file, always jump to the last known cursor position',
175+
callback = function()
176+
local line = vim.fn.line '\'"'
177+
if line >= 1 and line <= vim.fn.line '$' and vim.bo.filetype ~= 'commit' and vim.fn.index({ 'xxd', 'gitrebase' }, vim.bo.filetype) == -1 then
178+
vim.cmd 'normal! g`"'
179+
end
180+
end,
186181
})
187182

188183
--vim.api.nvim_set_hl(0, '@lsp.type.comment.cpp', {})
@@ -251,8 +246,8 @@ require('lazy').setup({
251246
},
252247

253248
{
254-
"folke/flash.nvim",
255-
event = "VeryLazy",
249+
'folke/flash.nvim',
250+
event = 'VeryLazy',
256251
-- @type Flash.Config
257252
opts = {},
258253
-- stylua: ignore
@@ -375,19 +370,17 @@ require('lazy').setup({
375370
-- },
376371
--},
377372
pickers = {
378-
find_files = {
379-
find_command = { "rg", "--files", "-g", "!**/**Linux_x86_64/**", "-g", "!compile_commands.json"},
380-
},
381-
live_grep = {
382-
additional_args = {"-w", "-g", "!**/**Linux_x86_64/**"},
383-
},
384-
grep_string = {
385-
additional_args = {"-w", "-g", "!**/**Linux_x86_64/**"},
386-
},
373+
find_files = {
374+
find_command = { 'rg', '--files', '-g', '!**/**Linux_x86_64/**', '-g', '!compile_commands.json' },
375+
},
376+
live_grep = {
377+
additional_args = { '-w', '-g', '!**/**Linux_x86_64/**' },
378+
},
379+
grep_string = {
380+
additional_args = { '-w', '-g', '!**/**Linux_x86_64/**' },
381+
},
387382
},
388-
cond = function (lang, bufnr)
389-
return lang == "cpp" and vim.api.nvim_buf_line_count(bufnr) < 10000
390-
end,
383+
cond = function(lang, bufnr) return lang == 'cpp' and vim.api.nvim_buf_line_count(bufnr) < 10000 end,
391384
extensions = {
392385
['ui-select'] = { require('telescope.themes').get_dropdown() },
393386
},
@@ -410,8 +403,8 @@ require('lazy').setup({
410403
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
411404
vim.keymap.set('n', '<leader>sc', builtin.commands, { desc = '[S]earch [C]ommands' })
412405
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
413-
vim.keymap.set("n", "<C-q>", "<cmd> Telescope grep_string<CR>", {desc="Telescope Grep String"})
414-
vim.keymap.set("n", "<C-p>", "<cmd> Telescope find_files<CR>", {desc="Telescope Files"})
406+
vim.keymap.set('n', '<C-q>', '<cmd> Telescope grep_string<CR>', { desc = 'Telescope Grep String' })
407+
vim.keymap.set('n', '<C-p>', '<cmd> Telescope find_files<CR>', { desc = 'Telescope Files' })
415408

416409
-- This runs on LSP attach per buffer (see main LSP attach function in 'neovim/nvim-lspconfig' config for more info,
417410
-- it is better explained there). This allows easily switching between pickers if you prefer using something else!
@@ -479,7 +472,7 @@ require('lazy').setup({
479472
{
480473
-- Main LSP Configuration
481474
'neovim/nvim-lspconfig',
482-
ft = {"lua", "cpp", "python"},
475+
ft = { 'lua', 'python' },
483476
dependencies = {
484477
-- Automatically install LSPs and related tools to stdpath for Neovim
485478
-- Mason must be loaded before its dependents so we need to set it up here.
@@ -600,37 +593,6 @@ require('lazy').setup({
600593
-- See `:help lsp-config` for information about keys and how to configure
601594
---@type table<string, vim.lsp.Config>
602595
local servers = {
603-
clangd = {
604-
mason = true,
605-
cmd = {'/home/utils/llvm-17.0.6/bin/clangd',
606-
"--background-index",
607-
"--clang-tidy",
608-
"--header-insertion=never",
609-
"--j=2"},
610-
init_options = {
611-
clangdFileStatus = true,
612-
inlayHints= {
613-
enabled = true,
614-
parameterNames = true,
615-
autoDeducedTypes = true, -- Enable auto type hints
616-
typeHints = true,
617-
typeNameLimit = 24,
618-
lambdaReturnType = true,
619-
blockEnd = true,
620-
designators = true,
621-
},
622-
},
623-
filetypes = {"cpp"},
624-
single_file_support = true,
625-
capabilities = capabilities,
626-
--on_attach = on_attach,
627-
--root_dir = function()
628-
-- return vim.fn.getcwd()
629-
--end
630-
root_dir = function(fname)
631-
return require('lspconfig/util').root_pattern( unpack({'compile_commands.json'}))(fname)
632-
end
633-
},
634596
-- gopls = {},
635597
pyright = {},
636598
-- rust_analyzer = {},
@@ -745,7 +707,7 @@ require('lazy').setup({
745707
'L3MON4D3/LuaSnip',
746708
version = '2.*',
747709
build = (function()
748-
CC={"/home/utils/gcc-14.1.0/bin/gcc"}
710+
CC = { '/home/utils/gcc-14.1.0/bin/gcc' }
749711
-- Build Step is needed for regex support in snippets.
750712
-- This step is not supported in many windows environments.
751713
-- Remove the below condition to re-enable on windows.
@@ -759,8 +721,8 @@ require('lazy').setup({
759721
{
760722
'rafamadriz/friendly-snippets',
761723
config = function()
762-
require('luasnip.loaders.from_vscode').lazy_load({ include={"cpp", "python", "lua"} })
763-
require('luasnip.loaders.from_vscode').lazy_load({ paths = vim.fn.stdpath("config").."/snippets/" })
724+
require('luasnip.loaders.from_vscode').lazy_load { include = { 'cpp', 'python', 'lua' } }
725+
require('luasnip.loaders.from_vscode').lazy_load { paths = vim.fn.stdpath 'config' .. '/snippets/' }
764726
end,
765727
},
766728
},
@@ -849,11 +811,11 @@ require('lazy').setup({
849811
-- Load the colorscheme here.
850812
-- Like many other themes, this one has different styles, and you could load
851813
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
852-
vim.cmd.colorscheme 'catppuccin-mocha'
814+
vim.cmd.colorscheme 'tokyonight-night'
853815

854816
-- You can configure highlights by doing something like:
855817
vim.cmd.hi 'Comment gui=none'
856-
vim.api.nvim_set_hl(0, "LspInlayHint", {fg = "#9DA9A0", bg="#000000" })
818+
vim.api.nvim_set_hl(0, 'LspInlayHint', { fg = '#9DA9A0', bg = '#000000' })
857819
end,
858820
},
859821

0 commit comments

Comments
 (0)