update
This commit is contained in:
parent
72364ad9ac
commit
d38bafbaba
104
init.lua
104
init.lua
@ -4,7 +4,7 @@
|
||||
==================== READ THIS BEFORE CONTINUING ====================
|
||||
=====================================================================
|
||||
|
||||
Kickstart.nvim is *not* a distribution.
|
||||
Kickctart.nvim is *not* a distribution.
|
||||
|
||||
Kickstart.nvim is a template for your own configuration.
|
||||
The goal is that you can read every line of code, top-to-bottom, and understand
|
||||
@ -35,7 +35,6 @@ I hope you enjoy your Neovim journey,
|
||||
|
||||
P.S. You can delete this when you're done too. It's your config now :)
|
||||
--]]
|
||||
|
||||
-- Set <space> as the leader key
|
||||
-- See `:help mapleader`
|
||||
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
||||
@ -87,7 +86,7 @@ require('lazy').setup({
|
||||
{ 'j-hui/fidget.nvim', opts = {} },
|
||||
|
||||
-- Additional lua configuration, makes nvim stuff amazing!
|
||||
'folke/neodev.nvim',
|
||||
'folkenvim_set_keymap/neodev.nvim',
|
||||
},
|
||||
},
|
||||
|
||||
@ -97,7 +96,7 @@ require('lazy').setup({
|
||||
},
|
||||
|
||||
-- Useful plugin to show you pending keybinds.
|
||||
{ 'folke/which-key.nvim', opts = {} },
|
||||
{ 'folke/which-key.nvim', opts = {} },
|
||||
{ -- Adds git releated signs to the gutter, as well as utilities for managing changes
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
@ -114,10 +113,6 @@ require('lazy').setup({
|
||||
|
||||
{ -- Theme inspired by Atom
|
||||
'navarasu/onedark.nvim',
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.cmd.colorscheme 'onedark'
|
||||
end,
|
||||
},
|
||||
|
||||
{ -- Set lualine as statusline
|
||||
@ -144,7 +139,7 @@ require('lazy').setup({
|
||||
},
|
||||
|
||||
-- "gc" to comment visual regions/lines
|
||||
{ 'numToStr/Comment.nvim', opts = {} },
|
||||
{ 'numToStr/Comment.nvim', opts = {} },
|
||||
|
||||
-- Fuzzy Finder (files, lsp, etc)
|
||||
{ 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim' } },
|
||||
@ -172,6 +167,7 @@ require('lazy').setup({
|
||||
end,
|
||||
},
|
||||
|
||||
|
||||
-- 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.
|
||||
@ -200,6 +196,8 @@ vim.wo.number = true
|
||||
|
||||
-- Enable mouse mode
|
||||
vim.o.mouse = 'a'
|
||||
-- enable relativew numbers
|
||||
vim.o.relativenumber = true
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
-- Remove this option if you want your OS clipboard to remain independent.
|
||||
@ -240,8 +238,72 @@ vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
||||
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
|
||||
-- go from insert to normal with "jj"
|
||||
vim.api.nvim_set_keymap('i', 'jj', '<Esc>', { noremap = true })
|
||||
|
||||
-- save the file with space w
|
||||
vim.api.nvim_set_keymap('n', '<leader>w', ':Format<CR> :w<CR>', { noremap = true, silent = true, desc = "save" })
|
||||
|
||||
-- open file tree view
|
||||
vim.api.nvim_set_keymap('n', '<leader>ee', ':NeoTreeFocusToggle<CR>',
|
||||
{ noremap = true, silent = true, desc = "Open file tree view" })
|
||||
|
||||
-- open float file tree view
|
||||
vim.api.nvim_set_keymap('n', '<leader>ef', ':NeoTreeFloatToggle<CR>',
|
||||
{ noremap = true, silent = true, desc = "Open float file tree view" })
|
||||
|
||||
-- Mappa Ctrl+l per spostarsi a destra nel buffer corrente
|
||||
vim.api.nvim_set_keymap('n', '<C-l>', '<C-w>l', { noremap = true, silent = true })
|
||||
|
||||
-- Mappa Ctrl+h per spostarsi a sinistra nel buffer corrente
|
||||
vim.api.nvim_set_keymap('n', '<C-h>', '<C-w>h', { noremap = true, silent = true })
|
||||
|
||||
-- Mappa Ctrl+j per spostarsi in basso nel buffer corrente
|
||||
vim.api.nvim_set_keymap('n', '<C-j>', '<C-w>j', { noremap = true, silent = true })
|
||||
|
||||
-- mappatura per spostarsi a sinistra tra le finestre
|
||||
vim.api.nvim_set_keymap('n', '<S-h>', ':BufferPrevious<CR>', { noremap = true, silent = true })
|
||||
|
||||
-- mappatura per spostarsi a destra tra le finestre
|
||||
vim.api.nvim_set_keymap('n', '<S-l>', ':BufferNext<CR>', { noremap = true, silent = true })
|
||||
|
||||
-- close the current buffer
|
||||
vim.api.nvim_set_keymap('n', '<leader>c', ':bd<CR>', { noremap = true, silent = true })
|
||||
|
||||
-- Mapping copilot to <C-j>
|
||||
vim.g.copilot_no_tab_map = true
|
||||
vim.api.nvim_set_keymap("i", "<C-J>", 'copilot#Accept("<CR>")', { silent = true, expr = true })
|
||||
|
||||
vim.api.nvim_set_keymap('n', ':', '<cmd>FineCmdline<CR>', { noremap = true })
|
||||
|
||||
vim.o.swapfile = false
|
||||
|
||||
-- custom requirements
|
||||
config = function()
|
||||
require("config.auto-session").setup {}
|
||||
require("session-lens").setup {}
|
||||
end
|
||||
|
||||
-- neovide settings
|
||||
if vim.g.neovide then
|
||||
-- vim.g.neovide_cursor_animation_length = 0
|
||||
vim.g.neovide_cursor_trail_size = 0.8
|
||||
vim.g.neovide_cursor_animate_in_insert_mode = true
|
||||
vim.g.neovide_scale_factor = 1.3
|
||||
vim.g.neovide_fullscreen = true
|
||||
vim.api.nvim_set_keymap("n", "<C-+>", ":lua vim.g.neovide_scale_factor = vim.g.neovide_scale_factor + 0.1<CR>",
|
||||
{ silent = true })
|
||||
vim.api.nvim_set_keymap("n", "<C-->", ":lua vim.g.neovide_scale_factor = vim.g.neovide_scale_factor - 0.1<CR>",
|
||||
{ silent = true })
|
||||
vim.api.nvim_set_keymap("n", "<C-0>", ":lua vim.g.neovide_scale_factor = 1.3<CR>", { silent = true })
|
||||
vim.g.neovide_floating_blur_amount_x = 2.0
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- [[ Highlight on yank ]]
|
||||
-- See `:help vim.highlight.on_yank()`
|
||||
--
|
||||
-- See `:help kim.highlight.on_yank()`
|
||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
callback = function()
|
||||
@ -250,7 +312,6 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
group = highlight_group,
|
||||
pattern = '*',
|
||||
})
|
||||
|
||||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
require('telescope').setup {
|
||||
@ -283,6 +344,7 @@ vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc
|
||||
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
vim.keymap.set("n", "<leader>sk", require('telescope.builtin').keymaps, { desc = "Search Keymaps" })
|
||||
|
||||
-- [[ Configure Treesitter ]]
|
||||
-- See `:help nvim-treesitter`
|
||||
@ -353,7 +415,7 @@ require('nvim-treesitter.configs').setup {
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
|
||||
vim.keymap.set('n', '<leader>ld', vim.diagnostic.open_float, { desc = '[LSP] [D]iagnostics' })
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist)
|
||||
|
||||
-- LSP settings.
|
||||
@ -373,15 +435,14 @@ local on_attach = function(_, bufnr)
|
||||
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
||||
end
|
||||
|
||||
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
nmap('<leader>lr', vim.lsp.buf.rename, '[L]sp [r]ename')
|
||||
nmap('<leader>la', vim.lsp.buf.code_action(), '[L]sp [A]ction')
|
||||
|
||||
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
||||
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')
|
||||
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
|
||||
-- See `:help K` for why this keymap
|
||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||
@ -389,11 +450,6 @@ local on_attach = function(_, bufnr)
|
||||
|
||||
-- Lesser used LSP functionality
|
||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
||||
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
||||
nmap('<leader>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, '[W]orkspace [L]ist Folders')
|
||||
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||
@ -461,7 +517,7 @@ cmp.setup {
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs( -4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete {},
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
@ -480,8 +536,8 @@ cmp.setup {
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
elseif luasnip.jumpable( -1) then
|
||||
luasnip.jump( -1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
@ -495,3 +551,5 @@ cmp.setup {
|
||||
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
4
lua/custom/plugins/auto-session.lua
Normal file
4
lua/custom/plugins/auto-session.lua
Normal file
@ -0,0 +1,4 @@
|
||||
return {
|
||||
"rmagatti/session-lens",
|
||||
dependencies = { "rmagatti/auto-session", "nvim-telescope/telescope.nvim" },
|
||||
}
|
8
lua/custom/plugins/autopairs.lua
Normal file
8
lua/custom/plugins/autopairs.lua
Normal file
@ -0,0 +1,8 @@
|
||||
-- File: lua/custom/plugins/autopairs.lua
|
||||
|
||||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup {}
|
||||
end,
|
||||
}
|
4
lua/custom/plugins/barbar.lua
Normal file
4
lua/custom/plugins/barbar.lua
Normal file
@ -0,0 +1,4 @@
|
||||
return {
|
||||
'romgrk/barbar.nvim',
|
||||
dependencies = 'nvim-tree/nvim-web-devicons',
|
||||
}
|
6
lua/custom/plugins/cmdline.lua
Normal file
6
lua/custom/plugins/cmdline.lua
Normal file
@ -0,0 +1,6 @@
|
||||
return {
|
||||
'VonHeikemen/fine-cmdline.nvim',
|
||||
dependencies = {
|
||||
{ 'MunifTanjim/nui.nvim' }
|
||||
}
|
||||
}
|
3
lua/custom/plugins/copilot.lua
Normal file
3
lua/custom/plugins/copilot.lua
Normal file
@ -0,0 +1,3 @@
|
||||
return {
|
||||
"github/copilot.vim"
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
-- You can add your own plugins here or in other files in this directory!
|
||||
-- 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
|
||||
return {}
|
||||
return {
|
||||
}
|
||||
|
3
lua/custom/plugins/lazygit.lua
Normal file
3
lua/custom/plugins/lazygit.lua
Normal file
@ -0,0 +1,3 @@
|
||||
return {
|
||||
'kdheepak/lazygit.nvim'
|
||||
}
|
6
lua/custom/plugins/leap.lua
Normal file
6
lua/custom/plugins/leap.lua
Normal file
@ -0,0 +1,6 @@
|
||||
return {
|
||||
"ggandor/leap.nvim",
|
||||
config = function()
|
||||
require('leap').add_default_mappings()
|
||||
end
|
||||
}
|
29
lua/custom/plugins/neotree.lua
Normal file
29
lua/custom/plugins/neotree.lua
Normal file
@ -0,0 +1,29 @@
|
||||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
version = "*",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
config = function()
|
||||
-- Unless you are still migrating, remove the deprecated commands from v1.x
|
||||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||
|
||||
require('neo-tree').setup {
|
||||
close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab
|
||||
popup_border_style = "rounded",
|
||||
enable_git_status = true,
|
||||
enable_diagnostics = true,
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
18
lua/custom/plugins/themes.lua
Normal file
18
lua/custom/plugins/themes.lua
Normal file
@ -0,0 +1,18 @@
|
||||
return {
|
||||
|
||||
{
|
||||
|
||||
'folke/tokyonight.nvim',
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.cmd.colorscheme 'tokyonight-night'
|
||||
end,
|
||||
|
||||
},
|
||||
|
||||
{ -- Theme inspired by Atom
|
||||
'navarasu/onedark.nvim',
|
||||
},
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user