Skip to content

Commit c50878d

Browse files
committed
Setup
1 parent 5bdde24 commit c50878d

File tree

2 files changed

+88
-4
lines changed

2 files changed

+88
-4
lines changed

init.lua

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ vim.g.mapleader = ' '
9191
vim.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`
@@ -616,7 +616,46 @@ require('lazy').setup({
616616
-- - settings (table): Override the default settings passed when initializing the server.
617617
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
618618
local servers = {
619-
-- clangd = {},
619+
clangd = {
620+
{
621+
'clangd',
622+
'--background-index',
623+
'--clang-tidy',
624+
'--header-insertion=iwyu',
625+
'--completion-style=detailed',
626+
'--function-arg-placeholders',
627+
'--fallback-style=llvm',
628+
},
629+
init_options = {
630+
usePlaceholders = true,
631+
completeUnimported = true,
632+
clangdFileStatus = true,
633+
},
634+
-- Configure clangd's capabilities
635+
capabilities = {
636+
offsetEncoding = { 'utf-16' },
637+
},
638+
-- Optional: Add custom on_attach function
639+
on_attach = function(client, bufnr)
640+
-- Enable completion triggered by <c-x><c-o>
641+
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
642+
643+
-- Key mappings
644+
local bufopts = { noremap = true, silent = true, buffer = bufnr }
645+
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
646+
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
647+
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
648+
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
649+
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
650+
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
651+
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
652+
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
653+
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
654+
655+
-- Set autoformat on save (optional)
656+
vim.cmd [[autocmd BufWritePre <buffer> lua vim.lsp.buf.format()]]
657+
end,
658+
},
620659
-- gopls = {},
621660
-- pyright = {},
622661
-- rust_analyzer = {},
@@ -849,7 +888,7 @@ require('lazy').setup({
849888
-- Load the colorscheme here.
850889
-- Like many other themes, this one has different styles, and you could load
851890
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
852-
vim.cmd.colorscheme 'tokyonight-night'
891+
vim.cmd.colorscheme 'blue'
853892

854893
-- You can configure highlights by doing something like:
855894
vim.cmd.hi 'Comment gui=none'
@@ -942,7 +981,7 @@ require('lazy').setup({
942981
-- This is the easiest way to modularize your config.
943982
--
944983
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
945-
-- { import = 'custom.plugins' },
984+
{ import = 'custom.plugins' },
946985
--
947986
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
948987
-- Or use telescope!

lua/custom/plugins/neo-tree.lua

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
return {
2+
{
3+
-- Add neo-tree
4+
'nvim-neo-tree/neo-tree.nvim',
5+
branch = 'v3.x',
6+
dependencies = {
7+
'nvim-lua/plenary.nvim',
8+
'nvim-tree/nvim-web-devicons',
9+
'MunifTanjim/nui.nvim',
10+
},
11+
config = function()
12+
require('neo-tree').setup {
13+
close_if_last_window = true,
14+
enable_git_status = true,
15+
enable_diagnostics = true,
16+
filesystem = {
17+
follow_current_file = {
18+
enabled = true,
19+
},
20+
filtered_items = {
21+
visible = false,
22+
hide_dotfiles = false,
23+
hide_gitignored = false,
24+
},
25+
},
26+
window = {
27+
width = 30,
28+
mappings = {
29+
['<space>'] = {
30+
'toggle_node',
31+
nowait = false,
32+
},
33+
['<cr>'] = 'open',
34+
['P'] = { 'toggle_preview', config = { use_float = true } },
35+
['l'] = 'focus_preview',
36+
},
37+
},
38+
}
39+
40+
-- Keymaps
41+
vim.keymap.set('n', '<C-n>', ':Neotree toggle<CR>', { silent = true })
42+
vim.keymap.set('n', '<leader>o', ':Neotree focus<CR>', { silent = true })
43+
end,
44+
},
45+
}

0 commit comments

Comments
 (0)