2022-08-18 04:13:50 +02:00
--[[
&&&
&##& █ █ █ █ █ ╗ █ █ ╗ █ █ █ █ █ █ █ ╗ █ █ █ ╗ █ █ █ ╗ █ █ ╗
&##& █ █ ╔ ═ ═ █ █ ╗ █ █ ║ █ █ ╔ ═ ═ ═ ═ ╝ █ █ █ █ ╗ █ █ █ █ ║ █ █ ║
BB & █ █ █ █ █ █ █ ║ █ █ ║ █ █ █ █ █ ╗ █ █ ╔ █ █ █ █ ╔ █ █ ║ █ █ ║
& GB & █ █ ╔ ═ ═ █ █ ║ █ █ ║ █ █ ╔ ═ ═ ╝ █ █ ║ ╚ █ █ ╔ ╝ █ █ ║ █ █ ║
& GB & BGBBBBBBBB ###& █ █ ║ █ █ ║ █ █ █ █ █ █ █ ╗ █ █ █ █ █ █ █ ╗ █ █ ║ ╚ ═ ╝ █ █ ║ █ █ ║
GG & GGGGGGGGGGGGGB #& ╚ ═ ╝ ╚ ═ ╝ ╚ ═ ═ ═ ═ ═ ═ ╝ ╚ ═ ═ ═ ═ ═ ═ ╝ ╚ ═ ╝ ╚ ═ ╝ ╚ ═ ╝
# P # &&# BGGGGGGGGGGG # nvim plugins
BP & & GGGGGGGGGB #
2023-04-15 21:02:08 +02:00
&# BGPP & &# BGGGGGGGB # * tldr : managed with lazy.nvim
2022-08-18 04:13:50 +02:00
&# BGGGGGPP & &&# BGGGGGGB ##& - lsp : integrated + nvim - lspconfig
&# GPPPGGGGGBPB &&## BGGGGGBB #&& - completion : nvim - cmp + LuaSnip
# PPPPPPPGGPG BP & &&## BBGGGGGGBB #&& - syntax : nvim - treesitter
PPPPPPPPPPPPGBPG &&& &&&&&&### BBBGGGGGGGBB ##&& - pickers : telescope.nvim
2023-04-15 21:02:08 +02:00
& BGPPPPPPPPPPPPPPGGGGGGGGGGGGGGGGGGGBBB ##&&& - files : neo - tree.nvim
2022-08-18 04:13:50 +02:00
&&## BBBBGGGGGGGPGBBBBBB ####&&&& - git : vim - fugitive + gitsigns.nvim
&# B #& - extra : hexmode , vim - combo ,
2023-04-15 21:02:08 +02:00
&& ###& rust - tools , nvim - colorizer ,
& G # &&#&&& nvim - jdtls , vim - surround ,
&&& undotree ,
2022-08-18 04:13:50 +02:00
] ] --
2023-04-15 21:02:08 +02:00
local function set_lsp_binds ( _ , bufnr )
require ( ' keybinds ' ) : set_lsp_keys ( { buffer = bufnr } )
end
return {
' alemidev/peak.nvim ' , -- color scheme
2022-08-18 04:13:50 +02:00
2023-04-15 21:02:08 +02:00
' rickhowe/diffchar.vim ' , -- word-level diffs
' fidian/hexmode ' , -- convert buffers into hex view with xxd
' alemidev/vim-combo ' , -- track code combos
2022-10-02 00:57:30 +02:00
2023-04-15 21:02:08 +02:00
' tpope/vim-fugitive ' , -- better git commands
' tpope/vim-surround ' , -- text object motions for surrounding
2022-08-18 04:13:50 +02:00
2023-04-15 21:02:08 +02:00
' mbbill/undotree ' , -- tree undo history visualizer
2022-08-18 04:13:50 +02:00
2023-04-15 21:02:08 +02:00
" stevearc/dressing.nvim " , -- better vim.fn.input() and vim.fn.select()
2022-09-01 01:17:12 +02:00
2023-04-15 21:02:08 +02:00
{
' norcalli/nvim-colorizer.lua ' , -- show hex color codes
config = function ( ) require ( ' colorizer ' ) . setup ( ) end
} ,
2022-08-18 04:13:50 +02:00
2023-04-15 21:02:08 +02:00
{
" ellisonleao/glow.nvim " , -- markdown previewer with glow
config = function ( ) require ( " glow " ) . setup ( ) end
} ,
2022-08-18 04:13:50 +02:00
2023-04-15 21:02:08 +02:00
{
' lewis6991/gitsigns.nvim ' , -- show diff signs in gutter
config = function ( )
require ( ' gitsigns ' ) . setup { -- configure symbols and colors
signs = {
add = { hl = ' GitSignsChange ' , text = ' ╎ ' } ,
change = { hl = ' GitSignsChange ' , text = ' │ ' } ,
delete = { hl = ' GitSignsDelete ' , text = ' _ ' } ,
topdelete = { hl = ' GitSignsDelete ' , text = ' ‾ ' } ,
changedelete = { hl = ' GitSignsDelete ' , text = ' ~ ' } ,
untracked = { hl = ' GitSignsUntracked ' , text = ' ╎ ' } ,
} ,
}
end
} ,
2022-08-18 16:12:37 +02:00
2023-04-15 21:02:08 +02:00
{
' nvim-treesitter/nvim-treesitter ' ,
build = ' :TSUpdate ' , -- if parsers break upon install, check under scoop/apps/neovim/{version}/lib/nvim/parser
config = function ( )
require ( ' nvim-treesitter.configs ' ) . setup ( {
highlight = { enable = true } ,
incremental_selection = { enable = true } ,
textobjects = { enable = true }
} )
vim.opt . foldmethod = " expr "
vim.opt . foldexpr = " nvim_treesitter#foldexpr() "
end
} ,
{
" nvim-neo-tree/neo-tree.nvim " ,
branch = " v2.x " ,
dependencies = {
" nvim-lua/plenary.nvim " ,
" nvim-tree/nvim-web-devicons " , -- not strictly required, but recommended
" MunifTanjim/nui.nvim " ,
" alemidev/neo-tree-symbolmap.git " ,
" mrbjarksen/neo-tree-diagnostics.nvim " ,
} ,
config = function ( )
vim.g . neo_tree_remove_legacy_commands = 1
require ( ' neo-tree ' ) . setup ( {
sources = {
" filesystem " ,
" buffers " ,
" git_status " ,
" symbolmap " ,
" diagnostics " ,
} ,
2023-04-15 22:15:54 +02:00
window = {
width = 30 ,
}
2023-04-15 21:02:08 +02:00
} )
end
} ,
{
' nvim-telescope/telescope.nvim ' , -- fuzzy finder, GUI component
dependencies = {
{ ' nvim-lua/plenary.nvim ' } , -- some utilities made for telescope
{ ' nvim-telescope/telescope-fzf-native.nvim ' , build = ' make ' } , -- fzf algorithm implemented in C for faster searches
} ,
config = function ( )
local telescope = require ( ' telescope ' )
telescope.load_extension ( ' fzf ' )
telescope.setup ( {
defaults = {
path_display = { " truncate " } ,
layout_config = {
horizontal = {
preview_width = 0.65 ,
results_width = 0.35 ,
} ,
vertical = {
mirror = false ,
} ,
cursor = {
preview_width = 0.6 ,
results_width = 0.4 ,
}
} ,
}
} )
require ( ' keybinds ' ) : set_telescope_keys ( { } )
-- for some reason, telescope breaks folds!
-- this should fix (took it off an issue on github)
vim.api . nvim_create_autocmd ( ' BufRead ' , {
callback = function ( )
vim.api . nvim_create_autocmd ( ' BufWinEnter ' , {
once = true ,
command = ' normal! zx '
} )
end
} )
end
} ,
' mfussenegger/nvim-jdtls ' , -- extra LSP stuff for java
{
' simrat39/rust-tools.nvim ' , -- extra LSP defaults for rust
dependencies = {
' hrsh7th/nvim-cmp ' , -- referenced here to guarantee load order
} ,
config = function ( )
local capabilities = require ( ' cmp_nvim_lsp ' ) . default_capabilities ( vim.lsp . protocol.make_client_capabilities ( ) )
local rust_tools = require ( " rust-tools " )
rust_tools.setup ( {
tools = {
inlay_hints = { auto = true , highlight = " InlayHint " } ,
hover_actions = { border = " none " } ,
} ,
server = {
capabilities = capabilities ,
on_attach = set_lsp_binds ,
} ,
dap = { adapter = require ( ' dap ' ) . adapters.lldb } ,
} )
rust_tools.inlay_hints . enable ( )
end
} ,
{
' neovim/nvim-lspconfig ' , -- import LSP configurations
dependencies = {
' hrsh7th/nvim-cmp ' , -- referenced here to guarantee load order
' folke/neodev.nvim ' , -- configure lua lsp with neovim runtime
} ,
config = function ( )
2023-04-15 22:15:54 +02:00
require ( " neodev " ) . setup ( { } )
2023-04-15 21:02:08 +02:00
local capabilities = require ( ' cmp_nvim_lsp ' ) . default_capabilities ( vim.lsp . protocol.make_client_capabilities ( ) )
local lspconfig = require ( " lspconfig " )
lspconfig.bashls . setup ( { capabilities = capabilities , on_attach = set_lsp_binds } )
lspconfig.pylsp . setup ( { capabilites = capabilities , on_attach = set_lsp_binds , settings = { pylsp = { plugins = { pycodestyle = { enabled = false } } } } } )
lspconfig.clangd . setup ( { capabilities = capabilities , on_attach = set_lsp_binds } )
lspconfig.ltex . setup ( { capabilities = capabilities , on_attach = set_lsp_binds } )
-- lspconfig.kotlin_language_server.setup({capabilities=capabilities, on_attach=set_lsp_binds})
lspconfig.lua_ls . setup ( { capabilites = capabilities , on_attach = set_lsp_binds , settings = { Lua = { telemetry = { enable = false } } } } ) -- default-on telemetry is never ok ...
end
} ,
{
2022-08-18 16:12:37 +02:00
' mfussenegger/nvim-dap ' , -- debugger adapter protocol
2023-04-15 21:02:08 +02:00
dependencies = {
2022-08-18 16:12:37 +02:00
' rcarriga/nvim-dap-ui ' , --batteries-included debugger ui
} ,
config = function ( )
local dap = require ( ' dap ' )
dap.adapters . python = {
type = ' executable ' ,
command = ( vim.fn . environ ( ) [ " VIRTUAL_ENV " ] or " " ) .. " /bin/python " ,
args = { ' -m ' , ' debugpy.adapter ' } ,
}
dap.configurations . python = {
{
name = " Launch file " ,
type = " python " ,
request = " launch " ,
program = vim.fn . expand ( ' % ' ) ,
cwd = ' ${workspaceFolder} ' ,
} ,
}
dap.adapters . lldb = {
type = ' executable ' ,
command = ' /usr/bin/lldb-vscode ' , -- adjust as needed, must be absolute path
name = ' lldb '
}
dap.configurations . cpp = {
2023-01-23 22:01:35 +01:00
{
name = ' Launch ' ,
type = ' lldb ' ,
request = ' launch ' ,
program = function ( )
vim.fn . input ( " run: " , vim.fn . getcwd ( ) .. " / " , " command " )
end ,
cwd = ' ${workspaceFolder} ' ,
} ,
}
dap.configurations . c = dap.configurations . cpp
dap.configurations . rust = {
2022-08-18 16:12:37 +02:00
{
name = ' Launch ' ,
type = ' lldb ' ,
request = ' launch ' ,
program = function ( )
local program = " "
2023-01-23 22:01:35 +01:00
for i in string.gmatch ( vim.fn . getcwd ( ) , " ([^/]+) " ) do -- TODO jank! assumes folder is called just like executable
2022-08-18 16:12:37 +02:00
program = i
end
return vim.fn . getcwd ( ) .. " /target/debug/ " .. program -- TODO can I put startup file somewhere?
end ,
cwd = ' ${workspaceFolder} ' ,
2023-01-23 22:01:35 +01:00
args = function ( )
local args = { }
for str in string.gmatch ( vim.fn . input ( " args: " ) , " ([^,]+) " ) do
table.insert ( args , str )
end
return args
end ,
2022-08-18 16:12:37 +02:00
} ,
}
require ( ' keybinds ' ) : set_dap_keys ( { } )
require ( ' dapui ' ) . setup ( )
end ,
2023-04-15 21:02:08 +02:00
} ,
2022-08-18 16:12:37 +02:00
2023-04-15 21:02:08 +02:00
{
2022-08-18 16:12:37 +02:00
' hrsh7th/nvim-cmp ' , -- completion engine core
2023-04-15 21:02:08 +02:00
dependencies = {
2022-08-18 16:12:37 +02:00
' hrsh7th/cmp-nvim-lsp ' , -- complete with LSP
' hrsh7th/cmp-nvim-lsp-signature-help ' , -- complete function signatures
' hrsh7th/cmp-nvim-lsp-document-symbol ' , -- complete document symbols
' hrsh7th/cmp-path ' , -- complete paths
' hrsh7th/cmp-buffer ' , -- complete based on buffer
' rcarriga/cmp-dap ' , -- complete in debugger
' saadparwaiz1/cmp_luasnip ' , -- complete with snippets
2022-08-19 05:25:23 +02:00
' onsails/lspkind.nvim ' , -- fancy icons and formatting
2023-04-15 21:02:08 +02:00
' L3MON4D3/LuaSnip ' , -- snippet engine
2022-08-18 16:12:37 +02:00
} ,
2023-04-15 21:02:08 +02:00
config = function ( )
local cmp = require ( ' cmp ' )
cmp.setup ( {
formatting = {
format = function ( entry , vim_item )
local kind = require ( " lspkind " ) . cmp_format ( { mode = " symbol " } ) ( entry , vim_item )
kind.kind = " " .. kind.kind .. " "
return kind
end ,
2022-08-18 04:13:50 +02:00
} ,
2023-04-15 21:02:08 +02:00
snippet = {
expand = function ( args ) require ( ' luasnip ' ) . lsp_expand ( args.body ) end ,
} ,
mapping = cmp.mapping . preset.insert ( {
[ ' <Tab> ' ] = cmp.mapping . confirm ( { select = true } ) ,
[ ' <C-Space> ' ] = cmp.mapping . complete ( ) ,
} ) ,
sources = cmp.config . sources ( {
{ name = ' nvim_lsp_signature_help ' , max_item_count = 1 } ,
{ name = ' nvim_lsp ' } ,
{ name = ' path ' , max_item_count = 3 } ,
{ name = ' luasnip ' } ,
{ name = ' buffer ' , keyword_length = 3 , max_item_count = 3 } ,
} ) ,
2023-01-10 16:54:43 +01:00
} )
2023-04-15 21:02:08 +02:00
cmp.setup . filetype ( { " dap-repl " , " dapui_watches " } , {
formatting = {
format = function ( entry , vim_item )
local kind = require ( " lspkind " ) . cmp_format ( { mode = " symbol " } ) ( entry , vim_item )
kind.kind = " " .. kind.kind .. " "
return kind
end ,
} ,
mapping = cmp.mapping . preset.insert ( { [ ' <Tab> ' ] = cmp.mapping . confirm ( { select = true } ) } ) ,
sources = {
{ name = ' dap ' } ,
} ,
2022-08-18 04:13:50 +02:00
} )
2023-04-15 21:02:08 +02:00
-- cmp.setup.cmdline('/', {
-- formatting = {
-- format = function(entry, vim_item)
-- local kind = require("lspkind").cmp_format({ mode = "symbol" })(entry, vim_item)
-- kind.kind = " " .. kind.kind .. " "
-- return kind
-- end,
-- },
-- mapping = cmp.mapping.preset.cmdline(),
-- sources = cmp.config.sources({
-- { name = 'nvim_lsp_document_symbol' },
-- { name = 'buffer', keyword_length = 3 },
-- })
-- })
2022-08-18 04:13:50 +02:00
end
2023-04-15 21:02:08 +02:00
} ,
}