Merge branch 'master' into sync

This commit is contained in:
Andres 2023-06-14 00:11:21 +02:00
commit 5abfb95a13
13 changed files with 241 additions and 106 deletions

View File

@ -1,28 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
<!-- Any bug report not following this template will be immediately closed. Thanks -->
## Describe the bug
<!-- A clear and concise description of what the bug is. -->
## To Reproduce
<!-- Steps to reproduce the behavior. -->
1. ...
## Desktop
<!-- please complete the following information. -->
- OS:
- Terminal:
## Neovim Version
<!-- Output of running `:version` from inside of neovim. -->
```
```

View File

@ -1,19 +0,0 @@
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,24 +0,0 @@
================================================================================
INTRODUCTION *kickstart.nvim*
Kickstart.nvim is a project to help you get started on your neovim journey.
*kickstart-is-not*
It is not:
- Complete framework for every plugin under the sun
- Place to add every plugin that could ever be useful
*kickstart-is*
It is:
- Somewhere that has a good start for the most common "IDE" type features:
- autocompletion
- goto-definition
- find references
- fuzzy finding
- and hinting at what more can be done :)
- A place to _kickstart_ your journey.
- You should fork this project and use/modify it so that it matches your
style and preferences. If you don't want to do that, there are probably
other projects that would fit much better for you (and that's great!)!
vim:tw=78:ts=8:ft=help:norl:

View File

@ -1,3 +0,0 @@
kickstart-is kickstart.txt /*kickstart-is*
kickstart-is-not kickstart.txt /*kickstart-is-not*
kickstart.nvim kickstart.txt /*kickstart.nvim*

160
init.lua
View File

@ -1,5 +1,4 @@
--[[
=====================================================================
==================== READ THIS BEFORE CONTINUING ====================
=====================================================================
@ -84,13 +83,18 @@ require('lazy').setup({
-- Useful status updates for LSP
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
{ 'j-hui/fidget.nvim', opts = {} },
-- tag to legacy to avoid message startup
{ 'j-hui/fidget.nvim', opts = {}, tag = 'legacy' },
-- Additional lua configuration, makes nvim stuff amazing!
'folke/neodev.nvim',
},
},
{
'simrat39/rust-tools.nvim',
},
{
-- Autocompletion
'hrsh7th/nvim-cmp',
@ -108,7 +112,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',
@ -122,21 +126,22 @@ require('lazy').setup({
changedelete = { text = '~' },
},
on_attach = function(bufnr)
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk,
{ buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
end,
},
},
{
-- Theme inspired by Atom
'navarasu/onedark.nvim',
priority = 1000,
config = function()
vim.cmd.colorscheme 'onedark'
end,
},
-- {
-- -- Theme inspired by Atom
-- 'navarasu/onedark.nvim',
-- priority = 1000,
-- config = function()
-- vim.cmd.colorscheme 'onedark'
-- end,
-- },
{
-- Set lualine as statusline
@ -145,7 +150,7 @@ require('lazy').setup({
opts = {
options = {
icons_enabled = false,
theme = 'onedark',
theme = 'auto',
component_separators = '|',
section_separators = '',
},
@ -158,13 +163,13 @@ require('lazy').setup({
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt`
opts = {
char = '',
char = '',
show_trailing_blankline_indent = false,
},
},
-- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} },
{ 'numToStr/Comment.nvim', opts = {} },
-- Fuzzy Finder (files, lsp, etc)
{ 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } },
@ -189,13 +194,15 @@ require('lazy').setup({
'nvim-treesitter/nvim-treesitter-textobjects',
},
build = ':TSUpdate',
config = function()
pcall(require('nvim-treesitter.install').update { with_sync = true })
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.
-- require 'kickstart.plugins.autoformat',
-- require 'kickstart.plugins.debug',
require 'kickstart.plugins.autoformat',
require 'kickstart.plugins.debug',
-- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
@ -212,9 +219,38 @@ require('lazy').setup({
-- Set highlight on search
vim.o.hlsearch = false
vim.opt.incsearch = true;
-- Make line numbers default
vim.wo.number = true
-- Set relative numbers
vim.wo.relativenumber = true
-- Move highlited line with alt
vim.keymap.set("v", "<A-j>", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "<A-k>", ":m '<-2<CR>gv=gv")
vim.keymap.set("n", "<A-j>", ":m .+1<CR>==")
vim.keymap.set("n", "<A-k>", ":m .-2<CR>==")
-- Greatest remap ever
-- vim.keymap.set("x", "<A-p>", "\"_dP")
-- /hen searching keep cursor in the middle
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")
-- About quick fixes
-- vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
-- vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
-- vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
-- set tab configuration
local set = vim.opt -- set options
set.tabstop = 4
set.softtabstop = 4
set.shiftwidth = 4
set.wrap = true;
set.scrolloff = 8
-- Enable mouse mode
vim.o.mouse = 'a'
@ -248,7 +284,9 @@ vim.o.completeopt = 'menuone,noselect'
vim.o.termguicolors = true
-- [[ Basic Keymaps ]]
-- Save with Control + s
vim.keymap.set('n', '<C-s>', ':w<CR>', { silent = true })
vim.keymap.set('n', '<C-b>', ':Neotree toggle<CR>', { desc = 'Toggle Tree', silent = true })
-- Keymaps for better default experience
-- See `:help vim.keymap.set()`
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
@ -306,7 +344,7 @@ vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { de
-- See `:help nvim-treesitter`
require('nvim-treesitter.configs').setup {
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' },
ensure_installed = { 'lua', 'python', 'rust', 'html', 'css', 'javascript', 'help', 'vim' },
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
auto_install = false,
@ -392,7 +430,8 @@ local on_attach = function(_, bufnr)
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>ca', ':CodeActionMenu<CR>', '[C]ode [A]ction')
-- nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
@ -430,7 +469,6 @@ local servers = {
-- pyright = {},
-- rust_analyzer = {},
-- tsserver = {},
lua_ls = {
Lua = {
workspace = { checkThirdParty = false },
@ -446,6 +484,9 @@ require('neodev').setup()
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
-- Setup mason so it can manage external tooling
require('mason').setup()
-- Ensure the servers above are installed
local mason_lspconfig = require 'mason-lspconfig'
@ -511,5 +552,80 @@ cmp.setup {
},
}
-- If the colorscheme is Habamax, fix parenthesis colors
-- vim.cmd('colorscheme habamax')
-- Fix the matching parenthesis color
-- vim.api.nvim_command('hi MatchParen ctermbg=gray guibg=lightblue')
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et
local extension_path = vim.env.HOME .. '/.local/share/nvim/mason/packages/codelldb/extension/'
local codelldb_path = extension_path .. 'adapter/codelldb'
local liblldb_path = extension_path .. 'lldb/lib/liblldb'
-- The liblldb extension is .so for linux and .dylib for macOS
liblldb_path = liblldb_path .. ".so"
local rt = require("rust-tools")
rt.setup({
dap = {
adapter = require('rust-tools.dap').get_codelldb_adapter(
codelldb_path, liblldb_path)
},
server = {
on_attach = function(_, bufnr)
local nmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
end
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
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')
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
-- 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')
-- Hover actions
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
-- Code action groups
vim.keymap.set("n", "<Leader>ca", rt.code_action_group.code_action_group,
{ desc = '[C]ode [A]ctions', buffer = bufnr })
end,
},
tools = {
hover_actions = {
auto_focus = true,
},
inlay_hints = {
-- automatically set inlay hints (type hints)
-- default: true
auto = true,
-- Only show inlay hints for the current line
only_current_line = true,
-- whether to show parameter hints with the inlay hints or not
-- default: true
show_parameter_hints = false,
},
},
})

1
lua/custom/init.lua Normal file
View File

@ -0,0 +1 @@

View File

@ -0,0 +1,9 @@
-- File: lua/custom/plugins/autopairs.lua
return {
"windwp/nvim-autopairs",
config = function()
require("nvim-autopairs").setup {}
end,
}

View File

@ -0,0 +1,4 @@
return {
'weilbith/nvim-code-action-menu',
}

View File

@ -0,0 +1,45 @@
return {
"catppuccin/nvim",
name = "catppuccin",
config = function()
require("catppuccin").setup {
flavour = "mocha", -- latte, frappe, macchiato, mocha
term_colors = true,
transparent_background = false,
no_italic = false,
no_bold = false,
styles = {
comments = {},
conditionals = {},
loops = {},
functions = {},
keywords = {},
strings = {},
variables = {},
numbers = {},
booleans = {},
properties = {},
types = {},
},
color_overrides = {
mocha = {
base = "#000000",
mantle = "#000000",
crust = "#000000",
},
},
highlight_overrides = {
mocha = function(C)
return {
TabLineSel = { bg = C.pink },
CmpBorder = { fg = C.surface2 },
Pmenu = { bg = C.none },
TelescopeBorder = { link = "FloatBorder" },
}
end,
},
}
vim.cmd.colorscheme "catppuccin"
end,
}

View File

@ -0,0 +1,3 @@
return {
'github/copilot.vim',
}

View File

@ -0,0 +1,19 @@
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 {
window = {
width = 24,
}
}
end,
}

View File

@ -0,0 +1,5 @@
-- using packer.nvim
return {
'nmac427/guess-indent.nvim',
config = function() require('guess-indent').setup {} end,
}

View File

@ -19,7 +19,7 @@ return {
'jay-babu/mason-nvim-dap.nvim',
-- Add your own debuggers here
'leoluz/nvim-dap-go',
-- 'leoluz/nvim-dap-go',
},
config = function()
local dap = require 'dap'
@ -38,19 +38,22 @@ return {
-- online, please don't ask me how to install them :)
ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want
'delve',
-- 'delve',
-- 'codelldb'
},
}
-- Basic debugging keymaps, feel free to change to your liking!
vim.keymap.set('n', '<F5>', dap.continue)
vim.keymap.set('n', '<F1>', dap.step_into)
vim.keymap.set('n', '<F2>', dap.step_over)
vim.keymap.set('n', '<F3>', dap.step_out)
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint)
vim.keymap.set('n', '<F5>', dap.continue, { desc = "Start debugger" })
vim.keymap.set('n', '<F1>', dap.step_into, { desc = "Step into" })
vim.keymap.set('n', '<F2>', dap.step_over, { desc = "Step over" })
vim.keymap.set('n', '<F3>', dap.step_out, { desc = "Step out" })
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint, { desc = "Toggle breakpoint" })
vim.keymap.set('n', '<leader>B', function()
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end)
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end
,
{ desc = "Breakpoint condition" })
-- Dap UI setup
-- For more information, see |:help nvim-dap-ui|
@ -80,7 +83,11 @@ return {
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
dap.listeners.before.event_exited['dapui_config'] = dapui.close
-- local mason_registry = require("mason-registry")
--
-- local codelldb = mason_registry.get_package('codelldb')
-- local extension_path = codelldb:get_install_path() .. "/extension/"
-- Install golang specific config
require('dap-go').setup()
-- require('dap-go').setup()
end,
}