1
0
Fork 0

more nvim work

This commit is contained in:
Luca Bilke 2022-10-13 14:25:04 +02:00
parent f51d7b2104
commit 2b3c3fc4ae
31 changed files with 585 additions and 452 deletions

2
.config/nvim/TODO Normal file
View File

@ -0,0 +1,2 @@
TODO: Carry over some of the old plugins
TODO: Set up whichkey

View File

@ -1,10 +1,11 @@
require 'user.plugins'
require 'user.keybinds'
require 'user.keymaps'
require 'user.options'
require 'user.autocmds'
require 'user.theme'
require 'user.cmp'
require 'user.plugins.telescope'
require 'user.plugins.whichkey'
require 'user.plugins.gitsigns'
require 'user.plugins.treesitter'
require 'user.plugins.autopairs'
@ -18,5 +19,4 @@ require 'user.plugins.impatient'
require 'user.plugins.illuminate'
require 'user.plugins.indentline'
require 'user.plugins.alpha'
require 'user.lsp'
require 'user.dap'
require 'user.adapters'

View File

@ -0,0 +1,115 @@
return {
{ -- Handles the automatic line numeration changes
{ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" },
{
pattern = "*",
command="if &nu && mode() != \"i\" | set rnu | endif"
}
},
{ -- Handles the automatic line numeration changes
{ "BufLeave", "FocusLost", "InsertEnter", "WinLeave" },
{
pattern = "*",
command="if &nu | set nornu | endif"
}
},
{
"FileType",
{
pattern = "zsh",
callback = function()
require("nvim-treesitter.highlight").attach(0, "bash")
end
}
},
{
"BufWritePost",
{
pattern = { "bm-files", "bm-dirs" },
command = "!shortcuts"
}
},
{
{ "BufRead", "BufNewFile" },
{
pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" },
command = "set filetype=xdefaults"
}
},
{
"BufWritePost",
{
pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" },
command = "!xrdb %"
}
},
{
"BufWritePost",
{
pattern = "~/.local/src/dwmblocks/config.h",
command = "!cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid -f dwmblocks }"
}
},
{
"BufWritePost",
{
pattern = "*.java",
callback = function()
vim.lsp.codelens.refresh()
end
}
},
{
{ "BufDelete", "VimLeave" },
{
pattern = "*.tex",
command = "!texclear \"%:p\""
}
},
{ -- Use 'q' to quit from common plugins
'FileType',
{
pattern = { "qf", "help", "man", "lspinfo", "spectre_panel", "lir" },
callback = function()
vim.cmd [[
nnoremap <silent> <buffer> q :close<CR>
set nobuflisted
]]
end
}
},
{
'Filetype',
{
pattern = { "gitcommit", "markdown" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
}
},
{ -- Automatically apply changes to plugins.lua
'BufWritePost',
{
group = 'packer_user_config',
pattern = { "plugins.lua", "pluginlist.lua" },
command = "source <afile> | PackerCompile"
}
},
{ -- Fix auto comment
'BufWinEnter',
{
callback = function()
vim.cmd("set formatoptions-=cro")
end
}
},
{ -- Highlight yanked text
'TextYankPost',
{
callback = function()
vim.highlight.on_yank({ higroup = "Visual", timeout = 200 })
end
}
}
}

View File

@ -40,8 +40,8 @@ return {
LineModified = "",
LineRemoved = "",
FileDeleted = "",
FileIgnored = "",
FileRenamed = "",
FileIgnored = "",
FileRenamed = "",
FileStaged = "S",
FileUnmerged = "",
FileUnstaged = "",
@ -49,7 +49,7 @@ return {
Diff = "",
Repo = "",
Octoface = "",
Branch = "",
Branch = "",
},
ui = {
ArrowCircleDown = "",
@ -142,6 +142,7 @@ return {
Debug = "",
Trace = "",
},
progress = { "", "", "", "", "", "", "", "", "", "", "", "", "" },
misc = {
Robot = "",
Squirrel = "",

View File

@ -0,0 +1,166 @@
local kbopts = { silent = true, noremap = true }
return {
kb = {
['n'] = { -- normal mode
-- Better window navigation
{"<C-h>", "<C-w>h", kbopts},
{"<C-j>", "<C-w>j", kbopts},
{"<C-k>", "<C-w>k", kbopts},
{"<C-l>", "<C-w>l", kbopts},
-- Resize with arrows
{"<C-Up>", ":resize -2<CR>", kbopts},
{"<C-Down>", ":resize +2<CR>", kbopts},
{"<C-Left>", ":vertical resize -2<CR>", kbopts},
{"<C-Right>", ":vertical resize +2<CR>", kbopts},
-- Navigate buffers
{"<S-l>", ":bnext<CR>", kbopts},
{"<S-h>", ":bprevious<CR>", kbopts},
-- LSP
{"gD", "<cmd>lua vim.lsp.buf.declaration()", kbopts},
{"gd", "<cmd>lua vim.lsp.buf.definition()", kbopts},
{"K", "<cmd>lua vim.lsp.buf.hover()", kbopts},
{"gI", "<cmd>lua vim.lsp.buf.implementation()", kbopts},
{"gr", "<cmd>lua vim.lsp.buf.references()", kbopts},
{"gl", "<cmd>lua vim.diagnostic.open_float()", kbopts},
-- Illuminate
{'<a-n>', "<cmd>lua require('illuminate').next_reference{wrap=true}", kbopts},
{'<a-p>', "<cmd>lua require('illuminate').next_reference{reverse=true,wrap=true}", kbopts},
},
['i'] = { -- insert mode
-- Delete last word with ctrl + del
{"<C-BS>", "<C-W>", kbopts},
},
['v'] = { -- visual mode
-- Better paste
{"p", '"_dP', kbopts},
-- Stay in indent mode
{"<", "<gv", kbopts},
{">", ">gv", kbopts},
},
['x'] = { -- visual block mode
},
['t'] = { -- terminal mode
},
['c'] = { -- command mode
}
},
wk = {
vopts = {
mode = "n",
prefix = "<leader>",
buffer = nil,
silent = true,
noremap = true, -- use `noremap` when creating keymaps
nowait = true, -- use `nowait` when creating keymaps
},
nopts = {
mode = "n",
prefix = "<leader>",
buffer = nil,
silent = true,
noremap = true,
nowait = true,
},
vmaps = {
["/"] = { "<Plug>(comment_toggle_linewise_visual)", "Comment toggle linewise (visual)" },
},
nmaps = {
[";"] = { "<cmd>Alpha<CR>", "Dashboard" },
["/"] = { "<Plug>(comment_toggle_linewise_current)", "Comment toggle current line" },
["w"] = { "<cmd>w!<CR>", "Save" },
["c"] = { require("user.funcs").buf_kill, "Close" },
-- TODO: filepicker ["f"] = {},
["h"] = { "<cmd>nohlsearch<CR>", "Clear Highlights" },
["e"] = { "<cmd>NvimTreeToggle<CR>", "Toggle Filetree" },
b = {
name = "Buffers",
j = { "<cmd>BufferLinePick<cr>", "Jump" },
f = { "<cmd>Telescope buffers<cr>", "Find" },
b = { "<cmd>BufferLineCyclePrev<cr>", "Previous" },
n = { "<cmd>BufferLineCycleNext<cr>", "Next" },
e = { "<cmd>BufferLinePickClose<cr>", "Pick which buffer to close" },
h = { "<cmd>BufferLineCloseLeft<cr>", "Close all to the left" },
l = { "<cmd>BufferLineCloseRight<cr>", "Close all to the right" },
D = { "<cmd>BufferLineSortByDirectory<cr>", "Sort by directory" },
L = { "<cmd>BufferLineSortByExtension<cr>", "Sort by language" },
},
p = {
name = "Packer",
c = { "<cmd>PackerCompile<cr>", "Compile" },
i = { "<cmd>PackerInstall<cr>", "Install" },
s = { "<cmd>PackerSync<cr>", "Sync" },
S = { "<cmd>PackerStatus<cr>", "Status" },
u = { "<cmd>PackerUpdate<cr>", "Update" },
},
g = {
name = "Git",
j = { require("gitsigns").next_hunk, "Next Hunk" },
k = { require("gitsigns").prev_hunk, "Prev Hunk" },
l = { require("gitsigns").blame_line, "Blame" },
p = { require("gitsigns").preview_hunk, "Preview Hunk" },
r = { require("gitsigns").reset_hunk, "Reset Hunk" },
R = { require("gitsigns").reset_buffer, "Reset Buffer" },
s = { require("gitsigns").stage_hunk, "Stage Hunk" },
u = { require("gitsigns").undo_stage_hunk, "Undo Stage Hunk" },
o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
C = { "<cmd>Telescope git_bcommits<cr>", "Checkout commit(for current file)" },
d = { "<cmd>Gitsigns diffthis HEAD<cr>", "Git Diff" },
g = { _LAZYGIT_TOGGLE, "Toggle Lazygit"}
},
l = {
name = "LSP",
a = { vim.lsp.buf.code_action, "Code Action" },
d = { "<cmd>Telescope diagnostics bufnr=0 theme=get_ivy<cr>", "Buffer Diagnostics" },
w = { "<cmd>Telescope diagnostics<cr>", "Diagnostics" },
f = { vim.lsp.buf.format{ async = true }, "Format" },
i = { "<cmd>LspInfo<cr>", "Info" },
I = { "<cmd>Mason<cr>", "Mason Info" },
j = { vim.diagnostic.goto_next, "Next Diagnostic" },
k = { vim.diagnostic.goto_prev, "Prev Diagnostic" },
l = { vim.lsp.codelens.run, "CodeLens Action" },
q = { vim.diagnostic.setloclist, "Quickfix" },
r = { vim.lsp.buf.rename, "Rename" },
s = { "<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols" },
S = { "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>", "Workspace Symbols" },
e = { "<cmd>Telescope quickfix<cr>", "Telescope Quickfix" },
},
d = {
name = "DAP",
b = { require('dap').toggle_breakpoint, "Toggle Breakpoint"},
c = { require('dap').continue, "Continue"},
i = { require('dap').step_into, "Step Into"},
o = { require('dap').step_over, "Step Over"},
O = { require('dap').step_out, "Step Out"},
r = { require('dap').repl.toggle, "Toggle REPL"},
l = { require('dap').run_last, "Run Last"},
u = { require('dapui').toggle, "Toggle DAP UI"},
t = { require('dap').terminate, "Stop Debugger"},
},
u = {
name = "Utility",
c = { "<cmd>w!<CR><cmd>!compiler \"%:p\"<CR>", "Compile" },
},
s = {
name = "Search",
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
f = { "<cmd>Telescope find_files<cr>", "Find File" },
h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
H = { "<cmd>Telescope highlights<cr>", "Find highlight groups" },
M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
R = { "<cmd>Telescope registers<cr>", "Registers" },
t = { "<cmd>Telescope live_grep<cr>", "Text" },
k = { "<cmd>Telescope keymaps<cr>", "Keymaps" },
C = { "<cmd>Telescope commands<cr>", "Commands" },
},
T = {
name = "Treesitter",
i = { "<cmd>TSConfigInfo<cr>", "Info" },
},
}
}
}

View File

@ -0,0 +1,49 @@
return {
-- General Functionality
'wbthomason/packer.nvim',
'nvim-lua/plenary.nvim',
'windwp/nvim-autopairs',
'numToStr/Comment.nvim',
'JoosepAlviste/nvim-ts-context-commentstring',
'kyazdani42/nvim-web-devicons',
'kyazdani42/nvim-tree.lua',
'akinsho/bufferline.nvim',
'moll/vim-bbye',
'nvim-lualine/lualine.nvim',
'akinsho/toggleterm.nvim',
'ahmedkhalf/project.nvim',
'lewis6991/impatient.nvim',
'lukas-reineke/indent-blankline.nvim',
'goolord/alpha-nvim',
'RRethy/vim-illuminate',
'nvim-telescope/telescope.nvim',
'nvim-treesitter/nvim-treesitter',
'lewis6991/gitsigns.nvim',
'folke/lua-dev.nvim',
'tpope/vim-surround',
'tpope/vim-repeat',
'norcalli/nvim-colorizer.lua',
'vimwiki/vimwiki',
'folke/which-key.nvim',
'felipec/vim-sanegx',
'sindrets/diffview.nvim',
-- Color Schemes,
'folke/tokyonight.nvim',
-- Completion,
'hrsh7th/nvim-cmp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'saadparwaiz1/cmp_luasnip',
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-nvim-lua',
-- Snippets,
'L3MON4D3/LuaSnip',
'rafamadriz/friendly-snippets',
-- LSP/DAP,
'williamboman/mason.nvim',
'jose-elias-alvarez/null-ls.nvim',
'neovim/nvim-lspconfig',
'williamboman/mason-lspconfig.nvim',
'mfussenegger/nvim-dap',
'rcarriga/nvim-dap-ui',
}

View File

@ -1,3 +1,5 @@
local icons = require('iconlist')
local dap_status_ok, dap = pcall(require, "dap")
if not dap_status_ok then
return
@ -8,17 +10,19 @@ if not dap_ui_status_ok then
return
end
local dap_install_status_ok, dap_install = pcall(require, "dap-install")
if not dap_install_status_ok then
return
end
-- Debugger installation is now handled by mason
dap_install.setup {}
-- local dap_install_status_ok, dap_install = pcall(require, "dap-install")
-- if not dap_install_status_ok then
-- return
-- end
--
-- dap_install.setup {}
--
-- dap_install.config("python", {})
-- -- add other configs here
dap_install.config("python", {})
-- add other configs here
require('dapui').setup{
dapui.setup {
layouts = {
{
elements = {
@ -41,7 +45,7 @@ require('dapui').setup{
},
}
vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticSignError", linehl = "", numhl = "" })
vim.fn.sign_define("DapBreakpoint", { text = icons.ui.Bug, texthl = "DiagnosticSignError", linehl = "", numhl = "" })
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()

View File

@ -0,0 +1,68 @@
local M = {}
local icons = require('iconlist')
local status_cmp_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
if not status_cmp_ok then
return
end
M.capabilities = vim.lsp.protocol.make_client_capabilities()
M.capabilities.textDocument.completion.completionItem.snippetSupport = true
M.capabilities = cmp_nvim_lsp.update_capabilities(M.capabilities)
M.setup = function()
local signs = {
{ name = "DiagnosticSignError", text = icons.diagnostics.BoldError },
{ name = "DiagnosticSignWarn", text = icons.diagnostics.BoldWarning },
{ name = "DiagnosticSignHint", text = icons.diagnostics.BoldHint },
{ name = "DiagnosticSignInfo", text = icons.diagnostics.BoldInformation },
}
for _, sign in ipairs(signs) do
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
end
local config = {
virtual_text = false, -- disable virtual text
signs = {
active = signs, -- show signs
},
update_in_insert = true,
underline = true,
severity_sort = true,
float = {
focusable = true,
style = "minimal",
border = "rounded",
source = "always",
header = "",
prefix = "",
},
}
vim.diagnostic.config(config)
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "rounded",
})
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = "rounded",
})
end
M.on_attach = function(client, bufnr)
if client.name == "sumneko_lua" then
client.server_capabilities.documentFormattingProvider = false
end
local status_ok, illuminate = pcall(require, "illuminate")
if not status_ok then
return
end
illuminate.on_attach(client)
end
return M

View File

@ -0,0 +1,9 @@
local status_ok, _ = pcall(require, "lspconfig")
if not status_ok then
return
end
require "user.adapters.mason"
require("user.adapters.handlers").setup()
require "user.adapters.null-ls"
require "user.adapters.dap"

View File

@ -1,12 +1,18 @@
local servers = require('user.lsp.servers')
local servers = {
"sumneko_lua",
"bashls",
"clangd",
}
local icons = require('iconlist')
local settings = {
ui = {
border = "none",
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "",
package_installed = icons.ui.Check,
package_pending = icons.ui.BoldArrowRight,
package_uninstalled = icons.ui.BoldClose,
},
},
log_level = vim.log.levels.INFO,
@ -28,13 +34,13 @@ local opts = {}
for _, server in pairs(servers) do
opts = {
on_attach = require("user.lsp.handlers").on_attach,
capabilities = require("user.lsp.handlers").capabilities,
on_attach = require("user.adapters.handlers").on_attach,
capabilities = require("user.adapters.handlers").capabilities,
}
server = vim.split(server, "@")[1]
local require_ok, conf_opts = pcall(require, "user.lsp.settings." .. server)
local require_ok, conf_opts = pcall(require, "user.adapters.settings." .. server)
if require_ok then
opts = vim.tbl_deep_extend("force", conf_opts, opts)
end

View File

@ -1,118 +1,4 @@
autocmds = {
{ -- Handles the automatic line numeration changes
{ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" },
{
pattern = "*",
command="if &nu && mode() != \"i\" | set rnu | endif"
}
},
{ -- Handles the automatic line numeration changes
{ "BufLeave", "FocusLost", "InsertEnter", "WinLeave" },
{
pattern = "*",
command="if &nu | set nornu | endif"
}
},
{
"FileType",
{
pattern = "zsh",
callback = function()
require("nvim-treesitter.highlight").attach(0, "bash")
end
}
},
{
"BufWritePost",
{
pattern = { "bm-files", "bm-dirs" },
command = "!shortcuts"
}
},
{
{ "BufRead", "BufNewFile" },
{
pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" },
command = "set filetype=xdefaults"
}
},
{
"BufWritePost",
{
pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" },
command = "!xrdb %"
}
},
{
"BufWritePost",
{
pattern = "~/.local/src/dwmblocks/config.h",
command = "!cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid -f dwmblocks }"
}
},
{
"BufWritePost",
{
pattern = "*.java",
callback = function()
vim.lsp.codelens.refresh()
end
}
},
{
{ "BufDelete", "VimLeave" },
{
pattern = "*.tex",
command = "!texclear \"%:p\""
}
},
{ -- Use 'q' to quit from common plugins
'FileType',
{
pattern = { "qf", "help", "man", "lspinfo", "spectre_panel", "lir" },
callback = function()
vim.cmd [[
nnoremap <silent> <buffer> q :close<CR>
set nobuflisted
]]
end
}
},
{
'Filetype',
{
pattern = { "gitcommit", "markdown" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
}
},
{ -- Automatically apply changes to plugins.lua
'BufWritePost',
{
group = 'packer_user_config',
pattern = "plugins.lua",
command = "source <afile> | PackerCompile"
}
},
{ -- Fix auto comment
'BufWinEnter',
{
callback = function()
vim.cmd("set formatoptions-=cro")
end
}
},
{ -- Highlight yanked text
'TextYankPost',
{
callback = function()
vim.highlight.on_yank({ higroup = "Visual", timeout = 200 })
end
}
}
}
autocmds = require('autocmdlist')
vim.api.nvim_create_augroup('packer_user_config', {clear = true})

View File

@ -15,7 +15,7 @@ local check_backspace = function()
return col == 0 or vim.fn.getline("."):sub(col, col):match("%s")
end
local kind_icons = require('icons').kind
local kind_icons = require('iconlist').kind
cmp.setup({
snippet = {
expand = function(args)

View File

@ -1,10 +1,5 @@
local M = {}
-- Common kill function for bdelete and bwipeout
-- credits: based on bbye and nvim-bufdel, stolen from LunarVim
---@param kill_command? string defaults to "bd"
---@param bufnr? number defaults to the current buffer
---@param force? boolean defaults to false
-- Modified version of a function stolen from LunarVim
function M.buf_kill(kill_command, bufnr, force)
kill_command = kill_command or "bd"
@ -65,6 +60,8 @@ function M.buf_kill(kill_command, bufnr, force)
end
end
end
else
vim.cmd("quit")
end
-- Check if buffer still exists, to ensure the target buffer wasn't killed

View File

@ -1,77 +0,0 @@
local opts = { silent = true, noremap=true }
vim.g.mapleader = "space"
maps = {
n = { -- normal mode
-- Better window navigation
{"<C-h>", "<C-w>h", opts},
{"<C-j>", "<C-w>j", opts},
{"<C-k>", "<C-w>k", opts},
{"<C-l>", "<C-w>l", opts},
-- Resize with arrows
{"<C-Up>", ":resize -2<CR>", opts},
{"<C-Down>", ":resize +2<CR>", opts},
{"<C-Left>", ":vertical resize -2<CR>", opts},
{"<C-Right>", ":vertical resize +2<CR>", opts},
-- Navigate buffers
{"<S-l>", ":bnext<CR>", opts},
{"<S-h>", ":bprevious<CR>", opts},
-- Clear highlights
{"<leader>h", "<cmd>nohlsearch<CR>", opts},
-- Close buffers
{"<S-q>", "<cmd>Bdelete!<CR>", opts},
-- NvimTree
{"<leader>e", ":NvimTreeToggle<CR>", opts},
-- Telescope
{"<leader>ff", ":Telescope find_files<CR>", opts},
{"<leader>ft", ":Telescope live_grep<CR>", opts},
{"<leader>fp", ":Telescope projects<CR>", opts},
{"<leader>fb", ":Telescope buffers<CR>", opts},
-- Git
{"<leader>gg", "<cmd>lua _LAZYGIT_TOGGLE()<CR>", opts},
-- Comment
{"<leader>/", "<cmd>lua require('Comment.api').toggle_current_linewise()<CR>", opts},
-- DAP
{"<leader>db", "<cmd>lua require'dap'.toggle_breakpoint()<cr>", opts},
{"<leader>dc", "<cmd>lua require'dap'.continue()<cr>", opts},
{"<leader>di", "<cmd>lua require'dap'.step_into()<cr>", opts},
{"<leader>do", "<cmd>lua require'dap'.step_over()<cr>", opts},
{"<leader>dO", "<cmd>lua require'dap'.step_out()<cr>", opts},
{"<leader>dr", "<cmd>lua require'dap'.repl.toggle()<cr>", opts},
{"<leader>dl", "<cmd>lua require'dap'.run_last()<cr>", opts},
{"<leader>du", "<cmd>lua require'dapui'.toggle()<cr>", opts},
{"<leader>dt", "<cmd>lua require'dap'.terminate()<cr>", opts},
-- Illuminate
{'<a-n>', '<cmd>lua require"illuminate".next_reference{wrap=true}<cr>', opts},
{'<a-p>', '<cmd>lua require"illuminate".next_reference{reverse=true,wrap=true}<cr>', opts},
},
i = { -- insert mode
},
v = { -- visual mode
-- Better paste
{"p", '"_dP'},
-- Stay in indent mode
{"<", "<gv"},
{">", ">gv"},
},
x = { -- visual block mode
-- Comment
{"<leader>/", '<ESC><CMD>lua require("Comment.api").toggle_linewise_op(vim.fn.visualmode())<CR>', opts},
},
t = { -- terminal mode
},
c = { -- command mode
}
}
for mode, binds in ipairs(maps) do
for _, bind in ipairs(binds) do
local key = bind[1]
local cmd = bind[2]
if entry[3] then
local opt = entry[3]
end
vim.api.nvim_set_keymap(mode, key, cmd, opt)
end
end

View File

@ -0,0 +1,11 @@
maps = require('keymaplist').kb
vim.keymap.set("", "<Space>", "<Nop>", { silent = true, noremap = true })
vim.g.mapleader = " "
for mode, binds in pairs(maps) do
for _, bind in pairs(binds) do
local key = bind[1]
local cmd = bind[2]
local opt = bind[3]
vim.api.nvim_set_keymap(mode, key, cmd, opt)
end
end

View File

@ -1,91 +0,0 @@
local M = {}
local status_cmp_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
if not status_cmp_ok then
return
end
M.capabilities = vim.lsp.protocol.make_client_capabilities()
M.capabilities.textDocument.completion.completionItem.snippetSupport = true
M.capabilities = cmp_nvim_lsp.update_capabilities(M.capabilities)
M.setup = function()
local signs = {
{ name = "DiagnosticSignError", text = "" },
{ name = "DiagnosticSignWarn", text = "" },
{ name = "DiagnosticSignHint", text = "" },
{ name = "DiagnosticSignInfo", text = "" },
}
for _, sign in ipairs(signs) do
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
end
local config = {
virtual_text = false, -- disable virtual text
signs = {
active = signs, -- show signs
},
update_in_insert = true,
underline = true,
severity_sort = true,
float = {
focusable = true,
style = "minimal",
border = "rounded",
source = "always",
header = "",
prefix = "",
},
}
vim.diagnostic.config(config)
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "rounded",
})
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = "rounded",
})
end
local function lsp_keymaps(bufnr)
local opts = { noremap = true, silent = true }
local keymap = vim.api.nvim_buf_set_keymap
keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
keymap(bufnr, "n", "gI", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
keymap(bufnr, "n", "gl", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
keymap(bufnr, "n", "<leader>lf", "<cmd>lua vim.lsp.buf.format{ async = true }<cr>", opts)
keymap(bufnr, "n", "<leader>li", "<cmd>LspInfo<cr>", opts)
keymap(bufnr, "n", "<leader>lI", "<cmd>LspInstallInfo<cr>", opts)
keymap(bufnr, "n", "<leader>la", "<cmd>lua vim.lsp.buf.code_action()<cr>", opts)
keymap(bufnr, "n", "<leader>lj", "<cmd>lua vim.diagnostic.goto_next({buffer=0})<cr>", opts)
keymap(bufnr, "n", "<leader>lk", "<cmd>lua vim.diagnostic.goto_prev({buffer=0})<cr>", opts)
keymap(bufnr, "n", "<leader>lr", "<cmd>lua vim.lsp.buf.rename()<cr>", opts)
keymap(bufnr, "n", "<leader>ls", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
keymap(bufnr, "n", "<leader>lq", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
end
M.on_attach = function(client, bufnr)
if client.name == "tsserver" then
client.server_capabilities.documentFormattingProvider = false
end
if client.name == "sumneko_lua" then
client.server_capabilities.documentFormattingProvider = false
end
lsp_keymaps(bufnr)
local status_ok, illuminate = pcall(require, "illuminate")
if not status_ok then
return
end
illuminate.on_attach(client)
end
return M

View File

@ -1,8 +0,0 @@
local status_ok, _ = pcall(require, "lspconfig")
if not status_ok then
return
end
require "user.lsp.mason"
require("user.lsp.handlers").setup()
require "user.lsp.null-ls"

View File

@ -1,11 +0,0 @@
return {
"sumneko_lua",
"cssls",
"html",
"pyright",
"bashls",
"jsonls",
"yamlls",
"clangd",
"ansiblels",
}

View File

@ -10,6 +10,7 @@ local ensure_packer = function()
end
local packer_bootstrap = ensure_packer()
local pluginlist = require "pluginlist"
local status_ok, packer = pcall(require, "packer")
if not status_ok then
@ -25,56 +26,10 @@ packer.init {
}
return packer.startup(function(use)
-- General Functionality
use 'wbthomason/packer.nvim'
use 'nvim-lua/plenary.nvim'
use 'windwp/nvim-autopairs'
use 'numToStr/Comment.nvim'
use 'JoosepAlviste/nvim-ts-context-commentstring'
use 'kyazdani42/nvim-web-devicons'
use 'kyazdani42/nvim-tree.lua'
use 'akinsho/bufferline.nvim'
use 'moll/vim-bbye'
use 'nvim-lualine/lualine.nvim'
use 'akinsho/toggleterm.nvim'
use 'ahmedkhalf/project.nvim'
use 'lewis6991/impatient.nvim'
use 'lukas-reineke/indent-blankline.nvim'
use 'goolord/alpha-nvim'
use 'RRethy/vim-illuminate'
use 'nvim-telescope/telescope.nvim'
use 'nvim-treesitter/nvim-treesitter'
use 'lewis6991/gitsigns.nvim'
use 'folke/lua-dev.nvim'
use 'tpope/vim-surround'
use 'tpope/vim-repeat'
use 'norcalli/nvim-colorizer.lua'
use 'vimwiki/vimwiki'
use 'folke/which-key.nvim'
use 'felipec/vim-sanegx'
use 'sindrets/diffview.nvim'
-- Color Schemes
use 'folke/tokyonight.nvim'
-- Completion
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-path'
use 'saadparwaiz1/cmp_luasnip'
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-nvim-lua'
-- Snippets
use 'L3MON4D3/LuaSnip'
use 'rafamadriz/friendly-snippets'
-- LSP/DAP
use 'williamboman/mason.nvim'
use 'jose-elias-alvarez/null-ls.nvim'
use 'neovim/nvim-lspconfig'
use 'williamboman/mason-lspconfig.nvim'
use 'mfussenegger/nvim-dap'
use 'rcarriga/nvim-dap-ui'
use 'ravenxrz/DAPInstall.nvim'
if packer_bootstrap then
require('packer').sync()
end
for _, entry in ipairs(pluginlist) do
use(entry)
end
if packer_bootstrap then
require('packer').sync()
end
end)

View File

@ -4,7 +4,7 @@ if not status_ok then
end
local dashboard = require 'alpha.themes.dashboard'
local icons = require 'icons'
local icons = require 'iconlist'
local banner = {
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣶⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀⠀⠀",

View File

@ -5,24 +5,24 @@ if not status_ok then
end
npairs.setup({
check_ts = true, -- treesitter integration
disable_filetype = { "TelescopePrompt" },
ts_config = {
lua = { "string", "source" },
javascript = { "string", "template_string" },
java = false,
},
check_ts = true, -- treesitter integration
disable_filetype = { "TelescopePrompt" },
ts_config = {
lua = { "string", "source" },
javascript = { "string", "template_string" },
java = false,
},
fast_wrap = {
map = "<M-e>",
chars = { "{", "[", "(", '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
offset = 0, -- Offset from pattern match
end_key = "$",
keys = "qwertyuiopzxcvbnmasdfghjkl",
check_comma = true,
highlight = "PmenuSel",
highlight_grey = "LineNr",
},
map = "<M-e>",
chars = { "{", "[", "(", '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
offset = 0, -- Offset from pattern match
end_key = "$",
keys = "qwertyuiopzxcvbnmasdfghjkl",
check_comma = true,
highlight = "PmenuSel",
highlight_grey = "LineNr",
},
})
local cmp_autopairs = require("nvim-autopairs.completion.cmp")

View File

@ -7,7 +7,7 @@ local function is_ft(b, ft)
return vim.bo[b].filetype == ft
end
local icons = require 'icons'
local icons = require 'iconlist'
local config = {
highlights = {

View File

@ -4,6 +4,7 @@ if not status_ok then
end
local colors = require("tokyonight.colors").setup({ transform = true })
local icons = require('iconlist')
local conditions = {
buffer_not_empty = function()
@ -113,7 +114,7 @@ ins_left {
ins_left {
'diagnostics',
sources = { 'nvim_diagnostic' },
symbols = { error = ' ', warn = ' ', info = '' },
symbols = { error = icons.diagnostics.BoldError .. ' ', warn = icons.diagnostics.BoldWarning .. ' ', info = icons.diagnostics.BoldInformation },
diagnostics_color = {
color_error = { fg = colors.red },
color_warn = { fg = colors.yellow },
@ -137,7 +138,7 @@ ins_left {
function()
local current_line = vim.fn.line "."
local total_lines = vim.fn.line "$"
local chars = { "", "", "", "", "", "", "", "", "", "", "", "", "" }
local chars = icons.progress
local line_ratio = current_line / total_lines
local index = math.ceil(line_ratio * #chars)
return chars[index]
@ -165,13 +166,13 @@ ins_right {
ins_right {
'branch',
icon = '',
icon = icons.git.Branch,
color = { fg = colors.violet, gui = 'bold' },
}
ins_right {
'diff',
symbols = { added = '', modified = ' ', removed = '' },
symbols = { added = '', modified = '', removed = '' },
diff_color = {
added = { fg = colors.green },
modified = { fg = colors.orange },

View File

@ -9,7 +9,7 @@ if not config_status_ok then
end
local tree_cb = nvim_tree_config.nvim_tree_callback
local icons = require 'icons'
local icons = require 'iconlist'
nvim_tree.setup {
update_focused_file = {

View File

@ -1,19 +1,19 @@
local status_ok, project = pcall(require, "project_nvim")
if not status_ok then
return
return
end
project.setup({
-- detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project
detection_methods = { "pattern" },
-- detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project
detection_methods = { "pattern" },
-- patterns used to detect root dir, when **"pattern"** is in detection_methods
patterns = { ".git", "Makefile", "package.json" },
-- patterns used to detect root dir, when **"pattern"** is in detection_methods
patterns = { ".git", "Makefile", "package.json" },
})
local tele_status_ok, telescope = pcall(require, "telescope")
if not tele_status_ok then
return
return
end
telescope.load_extension('projects')

View File

@ -4,7 +4,7 @@ if not status_ok then
end
local actions = require "telescope.actions"
local icons = require "icons"
local icons = require "iconlist"
telescope.setup {
defaults = {

View File

@ -1,23 +1,23 @@
local status_ok, toggleterm = pcall(require, "toggleterm")
if not status_ok then
return
return
end
toggleterm.setup({
size = 20,
open_mapping = [[<c-\>]],
hide_numbers = true,
shade_terminals = true,
shading_factor = 2,
start_in_insert = true,
insert_mappings = true,
persist_size = true,
direction = "float",
close_on_exit = true,
shell = vim.o.shell,
float_opts = {
border = "curved",
},
size = 20,
open_mapping = [[<c-\>]],
hide_numbers = true,
shade_terminals = true,
shading_factor = 2,
start_in_insert = true,
insert_mappings = true,
persist_size = true,
direction = "float",
close_on_exit = true,
shell = vim.o.shell,
float_opts = {
border = "curved",
},
})
function _G.set_terminal_keymaps()
@ -35,5 +35,5 @@ local Terminal = require("toggleterm.terminal").Terminal
local lazygit = Terminal:new({ cmd = "lazygit", hidden = true })
function _LAZYGIT_TOGGLE()
lazygit:toggle()
lazygit:toggle()
end

View File

@ -1,31 +1,30 @@
local status_ok, treesitter = pcall(require, "nvim-treesitter")
if not status_ok then
return
return
end
local status_ok, configs = pcall(require, "nvim-treesitter.configs")
if not status_ok then
return
return
end
configs.setup({
ensure_installed = { "lua", "markdown", "markdown_inline", "bash", "python" }, -- put the language you want in this array
-- ensure_installed = "all", -- one of "all" or a list of languages
ignore_install = { "" }, -- List of parsers to ignore installing
sync_install = false, -- install languages synchronously (only applied to `ensure_installed`)
ignore_install = { "" }, -- List of parsers to ignore installing
sync_install = false, -- install languages synchronously (only applied to `ensure_installed`)
highlight = {
enable = true, -- false will disable the whole extension
disable = { "css" }, -- list of language that will be disabled
},
autopairs = {
enable = true,
},
indent = { enable = true, disable = { "python", "css" } },
context_commentstring = {
enable = true,
enable_autocmd = false,
},
enable = true, -- false will disable the whole extension
disable = { "css" }, -- list of language that will be disabled
},
autopairs = {
enable = true,
},
indent = { enable = true, disable = { "python", "css" } },
context_commentstring = {
enable = true,
enable_autocmd = false,
},
})

View File

@ -0,0 +1,56 @@
local status_ok, whichkey = pcall(require, "which-key")
if not status_ok then
return
end
local icons = require('iconlist')
local maps = require('keymaplist').wk
whichkey.setup {
marks = false,
registers = false,
presets = {
operators = false,
motions = false,
text_objects = false,
windows = false,
nav = false,
z = false,
g = false,
},
spelling = {
enabled = false,
suggestions = 20,
},
icons = {
breadcrumb = icons.ui.DoubleChevronRight,
separator = icons.ui.BoldArrowRight,
group = icons.ui.Plus,
},
popup_mappings = {
scroll_down = "<c-d>",
scroll_up = "<c-u>",
},
window = {
border = "single",
position = "bottom",
margin = { 1, 0, 1, 0 },
padding = { 2, 2, 2, 2 },
winblend = 0,
},
layout = {
height = { min = 4, max = 25 },
width = { min = 20, max = 50 },
spacing = 3,
align = "left",
},
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " },
triggers = "auto",
triggers_blacklist = {
i = { "j", "k" },
v = { "j", "k" },
},
}
whichkey.register(maps.nmaps, maps.nopts)
whichkey.register(maps.vmaps, maps.vopts)

View File

@ -79,11 +79,6 @@ _G.packer_plugins = {
path = "/home/luca/.local/share/nvim/site/pack/packer/start/Comment.nvim",
url = "https://github.com/numToStr/Comment.nvim"
},
["DAPInstall.nvim"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/DAPInstall.nvim",
url = "https://github.com/ravenxrz/DAPInstall.nvim"
},
LuaSnip = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/LuaSnip",