Own changes:
* Include vimtree * hlsearch set to true * diagnostic * clangd options * select in item list * Remove trailing white space when saving Change-Id: I01a02333163f1d8720dc2349a524f0da3c32e1db
This commit is contained in:
parent
98ad2ee32a
commit
275bf96cb0
54
init.lua
54
init.lua
|
@ -188,6 +188,11 @@ require('lazy').setup({
|
|||
},
|
||||
},
|
||||
},
|
||||
-- File browser
|
||||
{
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" }
|
||||
},
|
||||
|
||||
{
|
||||
-- Highlight, edit, and navigate code
|
||||
|
@ -198,6 +203,18 @@ require('lazy').setup({
|
|||
build = ':TSUpdate',
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
version = "*",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
config = function()
|
||||
require("nvim-tree").setup {}
|
||||
end,
|
||||
},
|
||||
'jremmen/vim-ripgrep',
|
||||
|
||||
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
||||
-- These are some example plugins that I've included in the kickstart repository.
|
||||
-- Uncomment any of the lines below to enable them.
|
||||
|
@ -218,7 +235,7 @@ require('lazy').setup({
|
|||
-- NOTE: You can change these options as you wish!
|
||||
|
||||
-- Set highlight on search
|
||||
vim.o.hlsearch = false
|
||||
vim.o.hlsearch = true
|
||||
|
||||
-- Make line numbers default
|
||||
vim.wo.number = true
|
||||
|
@ -288,6 +305,8 @@ require('telescope').setup {
|
|||
},
|
||||
}
|
||||
|
||||
require("telescope").load_extension "file_browser"
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
|
||||
|
@ -381,6 +400,9 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnos
|
|||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|
||||
|
||||
-- Nvim Tree browser
|
||||
vim.keymap.set('n', '<C-e>', "<cmd>NvimTreeToggle<CR>", { desc = "Open file explorer" })
|
||||
|
||||
-- [[ Configure LSP ]]
|
||||
-- This function gets run when an LSP connects to a particular buffer.
|
||||
local on_attach = function(_, bufnr)
|
||||
|
@ -402,6 +424,7 @@ local on_attach = function(_, bufnr)
|
|||
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
|
||||
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
||||
nmap('ge', vim.diagnostic.open_float, '[G]oto Error')
|
||||
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
||||
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
||||
|
@ -466,13 +489,21 @@ mason_lspconfig.setup {
|
|||
|
||||
mason_lspconfig.setup_handlers {
|
||||
function(server_name)
|
||||
if 'clangd' == server_name then
|
||||
require('lspconfig')[server_name].setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = servers[server_name],
|
||||
cmd = {'clangd', '--background-index', '-header-insertion=never'}
|
||||
}
|
||||
else
|
||||
require('lspconfig')[server_name].setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = servers[server_name],
|
||||
filetypes = (servers[server_name] or {}).filetypes,
|
||||
}
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
-- [[ Configure nvim-cmp ]]
|
||||
|
@ -488,11 +519,11 @@ cmp.setup {
|
|||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
mapping = {
|
||||
['<C-d>'] = cmp.mapping.select_next_item(),
|
||||
['<C-s>'] = cmp.mapping.select_prev_item(),
|
||||
--['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
['<C-Space>'] = cmp.mapping.complete {},
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
|
@ -525,3 +556,12 @@ cmp.setup {
|
|||
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
--nvim-tree.actions.change_dir.enable = false
|
||||
|
||||
vim.keymap.set('i', '<S-Tab>', '<Tab>', { desc = 'Make Tabs' })
|
||||
vim.keymap.set('n', 'Q', '"_d', { desc = 'Make Tabs' })
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||
pattern = { "*" },
|
||||
command = [[%s/\s\+$//e]],
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue