This commit is contained in:
Luca 2022-11-22 13:25:44 +01:00
parent 8268fba83d
commit 7ed2a6e110
9565 changed files with 1315332 additions and 90 deletions

View file

@ -0,0 +1,44 @@
require("packer-config")
-- # File Explorer :
require("nvim-tree-config")
-- # Settings :
require("settings")
-- # Keymaps :
require("keymap-config")
-- # Autopairs :
require("autopairs-config")
-- # Tab bar :
require("tarbar-config")
-- # Indentation :
require("indentation-config")
-- # Startus Bar :
require("lualine-config")
-- # Treesitter :
require("treesitter-config")
-- # Telescope :
require("telescope-config")
-- # Toggleterm :
require("toggleterm-config")
-- # Startup :
require("startup-config")
-- # LSP :
require("lsp-config.language-servers")
require("lsp-config.lspsaga")
require("lsp-config.completion")
require("lsp-config.null-ls")
-- # Colorschames
--require("colorschames.onedark")
require("colorschames.catppuccin")

View file

@ -0,0 +1 @@
require("nvim-autopairs").setup()

View file

@ -0,0 +1,41 @@
require("catppuccin").setup({
flavour = "mocha", -- latte, frappe, macchiato, mocha
background = { -- :h background
light = "latte",
dark = "mocha",
},
transparent_background = false,
term_colors = false,
dim_inactive = {
enabled = false,
shade = "dark",
percentage = 0.15,
},
no_italic = false, -- Force no italic
no_bold = false, -- Force no bold
styles = {
comments = { "italic" },
conditionals = { "italic" },
loops = {},
functions = {},
keywords = {},
strings = {},
variables = {},
numbers = {},
booleans = {},
properties = {},
types = {},
operators = {},
},
color_overrides = {},
custom_highlights = {},
integrations = {
cmp = true,
gitsigns = true,
nvimtree = true,
telescope = true,
notify = false,
mini = false,
-- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations)
},
})

View file

@ -0,0 +1 @@

View file

@ -0,0 +1,4 @@
require("onedark").setup {
style = "warmer"
}
require("onedark").load()

View file

@ -0,0 +1,8 @@
require("indent_blankline").setup({
show_current_context = true,
show_current_context_start = true,
filetype_exclude = { "help", "txt", "norg", "md" },
buftype_exclude = { "terminal", "nofile" },
})
vim.g.indent_blankline_char = ""

View file

@ -0,0 +1,14 @@
local map = vim.api.nvim_set_keymap
local opts = { noremap = true, silent = true }
vim.g.mapleader = " " -- leader key
--> nvim tree mappings <--
map("n", "<leader>e", ":NvimTreeToggle<CR>", opts)
map("n", "<leader>gt", ":NvimTreeFocus<CR>", opts)
--> telescope mappings <--
map("n", "<leader>ff", ":Telescope find_files<cr>", opts)
map("n", "<leader>fg", ":Telescope live_grep<cr>", opts)
map("n", "<leader>fb", ":Telescope buffers<cr>", opts)

View file

@ -0,0 +1,59 @@
local luasnip = require("luasnip")
local cmp = require("cmp")
local lspkind = require("lspkind")
cmp.setup({
formatting = {
format = lspkind.cmp_format({
with_text = true, -- do not show text alongside icons
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
-- The function below will be called before any actual modifications from lspkind
-- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
before = function(entry, vim_item)
return vim_item
end,
}),
},
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = {
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
["<Tab>"] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end,
["<S-Tab>"] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end,
},
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "neorg" },
},
})

View file

@ -0,0 +1,61 @@
local lsp_installer = require("nvim-lsp-installer")
local on_attach = function(client, bufnr)
local function buf_set_keymap(...)
vim.api.nvim_buf_set_keymap(bufnr, ...)
end
local function buf_set_option(...)
vim.api.nvim_buf_set_option(bufnr, ...)
end
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
local opts = { noremap = true, silent = true }
buf_set_keymap("n", "gd", ":lua vim.lsp.buf.definition()<CR>", opts) --> jumps to the definition of the symbol under the cursor
buf_set_keymap("n", "<leader>lh", ":lua vim.lsp.buf.hover()<CR>", opts) --> information about the symbol under the cursos in a floating window
buf_set_keymap("n", "gi", ":lua vim.lsp.buf.implementation()<CR>", opts) --> lists all the implementations for the symbol under the cursor in the quickfix window
buf_set_keymap("n", "<leader>rn", ":lua vim.lsp.util.rename()<CR>", opts) --> renaname old_fname to new_fname
buf_set_keymap("n", "<leader>ca", ":lua vim.lsp.buf.code_action()<CR>", opts) --> selects a code action available at the current cursor position
buf_set_keymap("n", "gr", ":lua vim.lsp.buf.references()<CR>", opts) --> lists all the references to the symbl under the cursor in the quickfix window
buf_set_keymap("n", "<leader>ld", ":lua vim.diagnostic.open_float()<CR>", opts)
buf_set_keymap("n", "[d", ":lua vim.diagnostic.goto_prev()<CR>", opts)
buf_set_keymap("n", "]d", ":lua vim.diagnostic.goto_next()<CR>", opts)
buf_set_keymap("n", "<leader>lq", ":lua vim.diagnostic.setloclist()<CR>", opts)
buf_set_keymap("n", "<leader>lf", ":lua vim.lsp.buf.formatting()<CR>", opts) --> formats the current buffer
end
local servers = {
"bashls",
"cssls",
"eslint",
--"ltex",
"sumneko_lua",
"tsserver",
--"pyright",
"jedi_language_server",
}
---@diagnostic disable-next-line: undefined-global
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
for _, name in pairs(servers) do
local server_is_found, server = lsp_installer.get_server(name)
if server_is_found then
if not server:is_installed() then
print("Installing " .. name)
server:install()
end
end
end
lsp_installer.on_server_ready(function(server)
-- Specify the default options which we'll use to setup all servers
local default_opts = {
on_attach = on_attach,
capabilities = capabilities,
}
server:setup(default_opts)
end)

View file

@ -0,0 +1,42 @@
require'lspsaga'.setup {
debug = false,
use_saga_diagnostic_sign = true,
-- diagnostic sign
error_sign = "",
warn_sign = "",
hint_sign = "",
infor_sign = "",
diagnostic_header_icon = "",
-- code action title icon
code_action_icon = "",
code_action_prompt = {
enable = true,
sign = true,
sign_priority = 40,
virtual_text = true,
},
finder_definition_icon = "",
finder_reference_icon = "",
max_preview_lines = 10,
finder_action_keys = {
open = "o",
vsplit = "s",
split = "i",
quit = "q",
scroll_down = "<C-f>",
scroll_up = "<C-b>",
},
code_action_keys = {
quit = "q",
exec = "<CR>",
},
rename_action_keys = {
quit = "<C-c>",
exec = "<CR>",
},
definition_preview_icon = "",
border_style = "single",
rename_prompt_prefix = "",
server_filetype_map = {},
diagnostic_prefix_format = "%d. ",
}

View file

@ -0,0 +1,22 @@
local null_ls = require("null-ls")
local formatting = null_ls.builtins.formatting
local sources = {
formatting.eslint,
formatting.autopep8,
formatting.stylua,
formatting.clang_format,
-- formatting.prettier,
-- formatting.latexindent,
}
null_ls.setup({
sources = sources,
on_attach = function(client)
if client.resolved_capabilities.document_formatting then
vim.cmd("autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting()")
end
end,
})

View file

@ -0,0 +1,8 @@
require ("lualine").setup({
options = {
icons_enabled = true,
theme = "auto",
section_separators = { left = "", right = ""},
component_separators = ""
}
})

View file

@ -0,0 +1,17 @@
require("nvim-tree").setup({
sort_by = "case_sensitive",
view = {
adaptive_size = true,
mappings = {
list = {
{ key = "u", action = "dir_up" },
},
},
},
renderer = {
group_empty = true,
},
filters = {
dotfiles = true,
},
})

View file

@ -0,0 +1,57 @@
return require("packer").startup(function()
use("wbthomason/packer.nvim") --> packer plugin manager
-- # File Explorer :
use("nvim-tree/nvim-tree.lua")
-- # Devicons :
use("nvim-tree/nvim-web-devicons")
-- # Tabs :
use("romgrk/barbar.nvim")
-- # Autopairs :
use("windwp/nvim-autopairs")
-- # Indent guides :
use("lukas-reineke/indent-blankline.nvim")
-- # Status Bar :
use("nvim-lualine/lualine.nvim")
-- # Treesitter :
use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }) --> treesitter
use("nvim-treesitter/nvim-treesitter-textobjects") --> textobjects
use("nvim-treesitter/nvim-treesitter-refactor")
use("p00f/nvim-ts-rainbow")
use("nvim-treesitter/playground")
use("JoosepAlviste/nvim-ts-context-commentstring")
-- # Telescope :
use("nvim-lua/plenary.nvim")
use("nvim-telescope/telescope.nvim")
-- # Toggleterm :
use("akinsho/toggleterm.nvim")
-- # LSP :
use("neovim/nvim-lspconfig") --> Collection of configurations for built-in LSP client
use("williamboman/nvim-lsp-installer") --> Companion plugin for lsp-config, allows us to seamlesly install language servers
use("jose-elias-alvarez/null-ls.nvim") --> inject lsp diagnistocs, formattings, code actions, and more ...
use("tami5/lspsaga.nvim") --> icons for LSP diagnostics
use("onsails/lspkind-nvim") --> vscode-like pictograms for neovim lsp completion items
use("hrsh7th/nvim-cmp") --> Autocompletion plugin
use("hrsh7th/cmp-nvim-lsp") --> LSP source for nvim-cmp
use("saadparwaiz1/cmp_luasnip") --> Snippets source for nvim-cmp
use("L3MON4D3/LuaSnip") --> Snippets plugin
-- # Startup :
use("startup-nvim/startup.nvim")
-- # Colorscemes :
--use "EdenEast/nightfox.nvim"
use("navarasu/onedark.nvim")
use { "catppuccin/nvim", as = "catppuccin" }
end)

View file

@ -0,0 +1,35 @@
local set = vim.opt
set.expandtab = true
set.smarttab = true
set.shiftwidth = 4
set.tabstop = 4
set.hlsearch = true
set.incsearch = true
set.ignorecase = true
set.smartcase = true
set.termguicolors = true
set.showmode = false
set.splitbelow = true
set.splitright = true
set.wrap = false
set.breakindent = true
set.scrolloff = 5
set.fileencoding = "utf-8"
set.conceallevel = 2
--set.relativenumber = true
set.number = true
set.cursorline = true
set.wildmenu = true
set.completeopt = "menuone,noselect"
set.hidden = true
set.mouse = "a"
set.fillchars = "eob: "
vim.cmd("colorscheme onedark")
--vim.cmd("colorscheme catppuccin")

View file

@ -0,0 +1,83 @@
local settings = {
-- every line should be same width without escaped \
header = {
type = "text",
oldfiles_directory = false,
align = "center",
fold_section = false,
title = "Header",
margin = 5,
content = {
"▓█████▄ ▓█████ ▄▄▄ ▓█████▄ ███▄ █ ██▒ █▓ ██▓ ███▄ ▄███▓ ",
"▒██▀ ██▌▓█ ▀▒████▄ ▒██▀ ██▌ ██ ▀█ █▓██░ █▒▓██▒▓██▒▀█▀ ██▒ ",
"░██ █▌▒███ ▒██ ▀█▄ ░██ █▌▓██ ▀█ ██▒▓██ █▒░▒██▒▓██ ▓██░ ",
"░▓█▄ ▌▒▓█ ▄░██▄▄▄▄██ ░▓█▄ ▌▓██▒ ▐▌██▒ ▒██ █░░░██░▒██ ▒██ ",
"░▒████▓ ░▒████▒▓█ ▓██▒░▒████▓ ▒██░ ▓██░ ▒▀█░ ░██░▒██▒ ░██▒ ",
" ▒▒▓ ▒ ░░ ▒░ ░▒▒ ▓▒█░ ▒▒▓ ▒ ░ ▒░ ▒ ▒ ░ ▐░ ░▓ ░ ▒░ ░ ░ ",
" ░ ▒ ▒ ░ ░ ░ ▒ ▒▒ ░ ░ ▒ ▒ ░ ░░ ░ ▒░ ░ ░░ ▒ ░░ ░ ░ ",
" ░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░░ ▒ ░░ ░ ",
" ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ",
" ░ ░ ░ ",
},
highlight = "Statement",
default_color = "#B71F34",
oldfiles_amount = 0,
},
-- name which will be displayed and command
body = {
type = "mapping",
oldfiles_directory = false,
align = "center",
fold_section = false,
title = "Basic Commands",
margin = 5,
content = {
{ " Find File", "Telescope find_files", "<leader>ff" },
{ " Find Word", "Telescope live_grep", "<leader>lg" },
{ " Recent Files", "Telescope oldfiles", "<leader>of" },
{ " File Browser", "Telescope file_browser", "<leader>fb" },
{ " Colorschemes", "Telescope colorscheme", "<leader>cs" },
{ " New File", "lua require'startup'.new_file()", "<leader>nf" },
},
highlight = "String",
default_color = "#8CA1A5",
oldfiles_amount = 0,
},
clock = {
type = "text",
content = function()
local clock = "" .. os.date("%H:%M")
local date = "" .. os.date("%d-%m-%y")
return { clock, date }
end,
oldfiles_directory = false,
align = "center",
fold_section = false,
title = "",
margin = 5,
highlight = "TSString",
default_color = "#C678DD",
oldfiles_amount = 10,
},
options = {
mapping_keys = true,
cursor_column = 0.5,
empty_lines_between_mappings = true,
disable_statuslines = true,
paddings = { 1, 3, 3, 0 },
},
mappings = {
execute_command = "<CR>",
open_file = "o",
open_file_split = "<c-o>",
open_section = "<TAB>",
open_help = "?",
},
colors = {
background = "#1A2026",
folded_section = "#36424F",
},
parts = { "header", "body", "clock" },
}
return settings

View file

@ -0,0 +1 @@
require("startup").setup(require("startup-config.dashborad"))

View file

@ -0,0 +1,9 @@
vim.g.bufferline = {
animation = true,
tabpages = true,
clickable = true,
icon_close_tab = "",
icon_separator_active = "",
icon_separator_inactive = "",
}

View file

@ -0,0 +1,5 @@
require("telescope").setup({
defaults = {
file_ignore_patterns = { "node_modules" },
},
})

View file

@ -0,0 +1,11 @@
require("toggleterm").setup({
open_mapping = [[<F4>]],
size = 10,
shade_terminals = true,
--direction = "vertical",
direction = "horizontal",
-- float_opts = {
-- border = "double",
-- },
close_on_exit = true,
})

View file

@ -0,0 +1,131 @@
local parser_configs = require("nvim-treesitter.parsers").get_parser_configs()
parser_configs.norg = {
install_info = {
url = "https://github.com/nvim-neorg/tree-sitter-norg",
files = { "src/parser.c", "src/scanner.cc" },
branch = "main",
},
}
parser_configs.norg_meta = {
install_info = {
url = "https://github.com/nvim-neorg/tree-sitter-norg-meta",
files = { "src/parser.c" },
branch = "main",
},
}
parser_configs.norg_table = {
install_info = {
url = "https://github.com/nvim-neorg/tree-sitter-norg-table",
files = { "src/parser.c" },
branch = "main",
},
}
require("nvim-treesitter.configs").setup({
--> parsers <--
ensure_installed = {
"c",
"css",
"bash",
"fish",
"javascript",
"lua",
"typescript",
"python",
"rust",
},
sync_install = false,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
indent = {
enable = true,
},
--> textobjects selection <--
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
--> LSP interop <--
lsp_interop = {
enable = true,
border = "none",
peek_definition_code = {
["<leader>df"] = "@function.outer",
["<leader>dF"] = "@class.outer",
},
},
},
--> moving between textobjext <--
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]]"] = "@function.outer",
["]m"] = "@class.outer",
},
goto_next_end = {
["]["] = "@function.outer",
["]M"] = "@class.outer",
},
goto_previous_start = {
["[["] = "@function.outer",
["[m"] = "@class.outer",
},
goto_previous_end = {
["[]"] = "@function.outer",
["[M"] = "@class.outer",
},
},
--> treesitter playground <--
playground = {
enable = true,
disable = {},
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
persist_queries = false, -- Whether the query persists across vim sessions
keybindings = {
toggle_query_editor = "o",
toggle_hl_groups = "i",
toggle_injected_languages = "t",
toggle_anonymous_nodes = "a",
toggle_language_display = "I",
focus_language = "f",
unfocus_language = "F",
update = "R",
goto_node = "<cr>",
show_help = "?",
},
},
--> refactor module
refactor = {
smart_rename = {
enable = true,
keymaps = {
smart_rename = "grr",
},
},
},
--> rainbow tags
rainbow = {
enable = false,
extended_mode = true,
max_file_lines = nil,
},
context_commentstring = {
enable = false,
enable_autocmd = false,
},
})