start restructering of lazy

This commit is contained in:
Oliver Hartmann 2022-12-28 13:52:17 +01:00
parent 5dd99d7085
commit fd16ef223a
11 changed files with 352 additions and 631 deletions

View File

@ -1,7 +1,7 @@
vim.g.mapleader = ','
if not vim.g.vscode then
require('my_lazy')
require('config.lazy')
require('my_keymappings')
require('my_options')
require('my_autocommands')
require('config.options')
end

14
lua/config/lazy.lua Normal file
View File

@ -0,0 +1,14 @@
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
'git',
'clone',
'--filter=blob:none',
'--single-branch',
'https://github.com/folke/lazy.nvim.git',
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
require('lazy').setup('plugins', {})

View File

@ -1,3 +1,4 @@
vim.cmd('filetype plugin indent on')
vim.cmd('language en_US.utf-8')
@ -59,4 +60,3 @@ opt.shortmess:append('sI')
opt.foldlevel = 20
opt.foldmethod = 'expr'
opt.foldexpr = 'nvim_treesitter#foldexpr()'

View File

@ -1,282 +0,0 @@
vim.cmd([[
augroup packer_user_config
autocmd!
autocmd BufWritePost my_plugins.lua source <afile> | PackerCompile
augroup end
]])
local fn = vim.fn
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
packer_bootstrap = fn.system({
'git',
'clone',
'--depth',
'1',
'https://github.com/wbthomason/packer.nvim',
install_path,
})
end
vim.api.nvim_command('packadd packer.nvim')
local function get_setup(name)
return string.format('require("setup/%s")', name)
end
local packerUtil = require('packer.util')
require('packer').init({
snapshot_path = packerUtil.join_paths(vim.fn.stdpath('config'), 'snapshots'),
display = {
open_fn = require('packer.util').float,
},
})
return require('packer').startup(function()
-- Packer can manage itself as an optional plugin
use({ 'wbthomason/packer.nvim' })
use({
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate',
config = get_setup('treesitter'),
})
use({
'nvim-telescope/telescope.nvim',
requires = {
{ 'nvim-lua/popup.nvim' },
{ 'nvim-lua/plenary.nvim' },
{ 'kyazdani42/nvim-web-devicons' },
{ 'nvim-telescope/telescope-fzf-native.nvim',
run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -G Ninja && cmake --build build --config Release && cmake --install build --prefix build' },
},
config = get_setup('telescope'),
})
use({
'sainnhe/gruvbox-material',
disable = true,
config = get_setup('my_gruvbox-material')
})
use({
'luisiacc/gruvbox-baby',
disable = true,
config = get_setup('my_gruvbox-baby')
})
use({
'ellisonleao/gruvbox.nvim',
disable = true,
config = get_setup('gruvbox'),
})
use({
'eddyekofo94/gruvbox-flat.nvim',
disable = false,
config = get_setup('my_gruvbox_flat')
})
use({
'lukas-reineke/indent-blankline.nvim',
requires = {
'nvim-treesitter/nvim-treesitter',
},
config = get_setup('indent_blankline'),
})
use({ 'nvim-lua/plenary.nvim' })
use({
'lewis6991/gitsigns.nvim',
config = get_setup('gitsigns'),
})
use({
'kyazdani42/nvim-tree.lua',
requires = 'kyazdani42/nvim-web-devicons',
config = get_setup('nvim-tree'),
disable = true,
})
use({
'numToStr/Comment.nvim',
config = get_setup('comment'),
})
use({
'hrsh7th/nvim-cmp',
requires = {
{ 'hrsh7th/cmp-buffer', after = 'nvim-cmp' },
{ 'hrsh7th/cmp-nvim-lsp', after = 'nvim-cmp' },
{ 'L3MON4D3/LuaSnip', after = 'nvim-cmp' },
{ 'saadparwaiz1/cmp_luasnip', after = 'nvim-cmp' },
{ 'hrsh7th/cmp-nvim-lua', after = 'nvim-cmp' },
{ 'octaltree/cmp-look', after = 'nvim-cmp' },
{ 'hrsh7th/cmp-path', after = 'nvim-cmp' },
{ 'hrsh7th/cmp-calc', after = 'nvim-cmp' },
{ 'f3fora/cmp-spell', after = 'nvim-cmp' },
{ 'hrsh7th/cmp-emoji', after = 'nvim-cmp' },
{ 'hrsh7th/cmp-cmdline', after = 'nvim-cmp' },
{ 'dmitmel/cmp-cmdline-history', after = 'nvim-cmp' },
{ 'ray-x/cmp-treesitter', after = 'nvim-cmp' },
{ 'hrsh7th/cmp-nvim-lsp-signature-help', after = 'nvim-cmp' },
{ 'p00f/clangd_extensions.nvim' },
},
config = get_setup('my_cmp'),
module = { "nvim-cmp", "cmp" },
event = "InsertEnter *",
})
use({
'L3MON4D3/LuaSnip',
config = get_setup('luasnip'),
module = { "luasnip", "LuaSnip" }
})
use({ 'rafamadriz/friendly-snippets' })
use({ 'onsails/lspkind-nvim' })
use({
'hoob3rt/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true },
config = get_setup('lualine'),
})
use({
'ahmedkhalf/project.nvim',
config = get_setup('project'),
})
use({ 'p00f/nvim-ts-rainbow',
requires = 'nvim-treesitter/nvim-treesitter',
})
use({
'windwp/nvim-autopairs',
config = get_setup('nvim-autopairs'),
})
use({ 'ray-x/lsp_signature.nvim' })
use({
'neovim/nvim-lspconfig',
requires = {
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
'p00f/clangd_extensions.nvim',
},
config = get_setup('my_lspconfig'),
module_pattern = { "lspconfig.*" },
event = { "InsertEnter", "CursorMoved" },
})
use({
'jose-elias-alvarez/null-ls.nvim',
requires = { 'nvim-lua/plenary.nvim' },
})
use({
'danymat/neogen',
requires = 'nvim-treesitter/nvim-treesitter',
config = get_setup('neogen'),
opt = true,
module = 'neogen'
})
use({ 'stevearc/dressing.nvim' })
use({
'nvim-neo-tree/neo-tree.nvim',
requires = {
'nvim-lua/plenary.nvim',
'kyazdani42/nvim-web-devicons',
{ 'MunifTanjim/nui.nvim', module = 'nui' },
},
config = get_setup('neo-tree'),
opt = true,
keys = {
{ 'n', '\\' }
}
})
use({
'akinsho/toggleterm.nvim',
config = get_setup('toggleterm'),
})
use({
'mrjones2014/legendary.nvim',
config = get_setup('my_legendary')
})
use({
'gbprod/yanky.nvim',
config = get_setup('yanky'),
keys = {
{ 'n', '<c-n>' },
{ 'n', '<c-o>' }
},
requires = {
'nvim-telescope/telescope.nvim'
}
})
use {
'ldelossa/litee.nvim',
disable = true,
requires = {
'ldelossa/litee-calltree.nvim',
'ldelossa/litee-symboltree.nvim',
'ldelossa/gh.nvim'
},
config = get_setup('my_litee')
}
use {
'stevearc/aerial.nvim',
requires = {
'nvim-telescope/telescope.nvim'
},
config = get_setup('aerial'),
opt = true,
module = 'aerial',
keys = {
{ 'n', '<leader>s' }
}
}
use {
'ggandor/leap.nvim',
requires = { 'tpope/vim-repeat' },
config = get_setup('my_leap')
}
use {
'mfussenegger/nvim-dap',
requires = {
'mfussenegger/nvim-dap-python',
{
'theHamsta/nvim-dap-virtual-text',
module = 'nvim-dap-virtual-text'
},
{
'nvim-telescope/telescope-dap.nvim',
module = 'telescope._extensions.dap',
requires = 'telescope.nvim',
},
{
'rcarriga/nvim-dap-ui',
module = 'dapui'
},
{
'rcarriga/cmp-dap',
module = 'cmp_dap'
},
},
keys = {
{ 'n', '<F5>' },
{ 'n', '<F6>' },
{ 'n', '<F7>' },
{ 'n', '<F8>' },
{ 'n', '<F9>' },
{ 'n', '<F10>' },
{ 'n', '<F11>' },
{ 'n', '<S-F11>' }
},
-- module = 'dap',
config = function()
require('setup/my_dap')
end,
opt = true,
}
use {
'sindrets/diffview.nvim',
requires = 'nvim-lua/plenary.nvim',
config = get_setup('my_diffview'),
opt = true,
cmd = 'DiffviewOpen',
module = { 'diffview', 'diffview.actions' }
}
use {
'stevearc/overseer.nvim',
config = get_setup('my_overseer'),
opt = true,
keys = {
{ 'n', '<F4>' }
},
module = 'overseer'
}
if packer_bootstrap then
require('packer').sync()
end
end)

View File

@ -1,18 +1,4 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
local plugins = {
return {
{
'mrjones2014/legendary.nvim',
config = function()
@ -35,40 +21,11 @@ local plugins = {
},
keys = { '<leader>p', '<leader>i' }
},
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
config = function()
require('setup/treesitter')
end
},
{
'p00f/nvim-ts-rainbow',
dependencies = 'nvim-treesitter/nvim-treesitter',
event = 'VeryLazy'
},
{
'nvim-telescope/telescope.nvim',
dependencies = {
'nvim-lua/plenary.nvim',
'kyazdani42/nvim-web-devicons',
{
'nvim-telescope/telescope-fzf-native.nvim',
'nvim-telescope/telescope-ui-select.nvim',
build = {
'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -G Ninja', -- On windows add -DCMAKE_C_FLAGS="-target x86_64-w64-mingw32"
'cmake --build build --config Release',
'cmake --install build --prefix build'
},
config = function()
require('telescope').load_extension('fzf')
end
},
},
config = function()
require('setup/telescope')
end
},
{
'ahmedkhalf/project.nvim',
config = function()
@ -252,5 +209,3 @@ local plugins = {
},
}
}
local opts = {}
require("lazy").setup(plugins, opts)

62
lua/plugins/neotree.lua Normal file
View File

@ -0,0 +1,62 @@
return {
'nvim-neo-tree/neo-tree.nvim',
cmd = 'Neotree',
keys = {
{ '\\', '<cmd>Neotree reveal<cr>', desc = 'NeoTree' },
},
dependencies = {
'nvim-lua/plenary.nvim',
-- 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
'kyazdani42/nvim-web-devicons',
'MunifTanjim/nui.nvim',
},
config = {
window = { -- see https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/popup for
-- possible options. These can also be functions that return these options.
position = 'float', -- left, right, float, current
width = 40, -- applies to left and right positions
popup = { -- settings that apply to float position only
size = {
height = '80%',
width = '50%',
},
position = '50%', -- 50% means center it
-- you can also specify border here, if you want a different setting from
-- the global popup_border_style.
},
enable_git_status = false,
-- Mappings for tree window. See `:h nep-tree-mappings` for a list of built-in commands.
-- You can also create your own commands by providing a function instead of a string.
mappings = {
['<space>'] = 'toggle_node',
['<2-LeftMouse>'] = 'open',
['<cr>'] = 'open',
['s'] = 'open_split',
['v'] = 'open_vsplit',
['C'] = 'close_node',
['z'] = 'close_all_nodes',
['R'] = 'refresh',
['a'] = 'add',
['A'] = 'add_directory',
['d'] = 'delete',
['r'] = 'rename',
['y'] = 'copy_to_clipboard',
['x'] = 'cut_to_clipboard',
['p'] = 'paste_from_clipboard',
['c'] = 'copy', -- takes text input for destination
['m'] = 'move', -- takes text input for destination
['q'] = 'close_window',
},
},
filesystem = {
filtered_items = {
hide_dotfiles = false,
hide_gitignored = false,
},
},
source_selector = {
winbar = true,
statusline = false
}
}
}

161
lua/plugins/telescope.lua Normal file
View File

@ -0,0 +1,161 @@
return {
'nvim-telescope/telescope.nvim',
dependencies = {
'nvim-lua/plenary.nvim',
'kyazdani42/nvim-web-devicons',
{
'nvim-telescope/telescope-fzf-native.nvim',
'nvim-telescope/telescope-ui-select.nvim',
build = {
'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -G Ninja', -- On windows add -DCMAKE_C_FLAGS="-target x86_64-w64-mingw32"
'cmake --build build --config Release',
'cmake --install build --prefix build'
},
config = function()
end
},
},
cmd = { "Telescope" },
keys = {
{
'<leader>f',
function()
require("telescope.builtin").find_files({ no_ignore = true })
end,
desc = 'Find file',
},
{
'<leader>g',
function()
Project_files()
end,
desc = 'Find git files',
},
{
'<leader>o',
function()
require("telescope.builtin").oldfiles()
end,
desc = 'Find old files',
},
{
'<leader>h',
function()
require("telescope.builtin").command_history()
end,
desc = 'Open command history',
},
{
'<leader>b',
function()
require("telescope.builtin").buffers()
end,
desc = 'Select buffer',
},
{
'<leader>q',
function()
require("telescope.builtin").quickfix()
end,
desc = 'Quickfix list with telescope',
},
{
'<leader>l',
function()
require("telescope.builtin").live_grep()
end,
desc = 'Search in project',
},
{
'<leader>j',
function()
require("telescope.builtin").jumplist()
end,
desc = 'Open jumplist',
},
{
'<c-f>',
function()
require("telescope.builtin").current_buffer_fuzzy_find()
end,
desc = 'Find in buffer',
},
{
'<leader>d',
function()
require("telescope.builtin").grep_string()
end,
desc = 'Find in workspace',
}
},
config = function()
local actions = require('telescope.actions')
local mappingTab = {
i = {
['<cr>'] = actions.select_tab,
['<C-b>'] = actions.select_default,
},
}
require('telescope').setup({
defaults = {
mappings = {
i = {
['<cr>'] = actions.select_default + actions.center,
['<C-l>'] = actions.send_selected_to_loclist,
['<C-q>'] = actions.smart_send_to_qflist,
},
},
},
pickers = {
-- Your special builtin config goes in here
buffers = {
sort_lastused = true,
theme = 'ivy',
mappings = {
i = {
['<c-w>'] = actions.delete_buffer,
['<cr>'] = actions.select_default,
},
n = {
['<c-w>'] = actions.delete_buffer,
},
},
},
find_files = {
theme = 'ivy',
previewer = false,
},
oldfiles = {
theme = 'ivy',
},
git_files = {
theme = 'ivy',
previewer = false,
},
lsp_references = {
show_line = false;
include_declaration = false,
},
lsp_dynamic_workspace_symbols = {},
},
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown {
}
}
}
})
require("telescope").load_extension("ui-select")
Project_files = function()
local opts = {} -- define here if you want to define something
local ok = pcall(require "telescope.builtin".git_files, opts)
if not ok then require "telescope.builtin".find_files(opts) end
end
require('telescope').load_extension('fzf')
end
}

View File

@ -0,0 +1,50 @@
return {
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
config = function()
require('nvim-treesitter.configs').setup({
ensure_installed = 'all',
highlight = {
enable = true
},
rainbow = {
enable = true,
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
max_file_lines = nil, -- Do not enable for files with more than n lines, int
-- colors = {}, -- table of hex strings
-- termcolors = {} -- table of colour name strings
},
indent = {
enable = false -- maybe buggy
},
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 = {
enable = true,
border = 'none',
peek_definition_code = {
["<leader>df"] = "@function.outer",
["<leader>dF"] = "@class.outer",
},
},
},
})
local parser = require('nvim-treesitter.parsers').filetype_to_parsername
parser.groovy = 'java' -- the someft filetype will use the python parser and queries.
require("nvim-treesitter.install").prefer_git = true
end
}

View File

@ -1,56 +0,0 @@
-- If you want icons for diagnostic errors, you'll need to define them somewhere:
vim.fn.sign_define('DiagnosticSignError', { text = '', texthl = 'DiagnosticSignError' })
vim.fn.sign_define('DiagnosticSignWarn', { text = '', texthl = 'DiagnosticSignWarn' })
vim.fn.sign_define('DiagnosticSignInfo', { text = '', texthl = 'DiagnosticSignInfo' })
vim.fn.sign_define('DiagnosticSignHint', { text = '', texthl = 'DiagnosticSignHint' })
require('neo-tree').setup({
window = { -- see https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/popup for
-- possible options. These can also be functions that return these options.
position = 'float', -- left, right, float, current
width = 40, -- applies to left and right positions
popup = { -- settings that apply to float position only
size = {
height = '80%',
width = '50%',
},
position = '50%', -- 50% means center it
-- you can also specify border here, if you want a different setting from
-- the global popup_border_style.
},
enable_git_status = false,
-- Mappings for tree window. See `:h nep-tree-mappings` for a list of built-in commands.
-- You can also create your own commands by providing a function instead of a string.
mappings = {
['<space>'] = 'toggle_node',
['<2-LeftMouse>'] = 'open',
['<cr>'] = 'open',
['s'] = 'open_split',
['v'] = 'open_vsplit',
['C'] = 'close_node',
['z'] = 'close_all_nodes',
['R'] = 'refresh',
['a'] = 'add',
['A'] = 'add_directory',
['d'] = 'delete',
['r'] = 'rename',
['y'] = 'copy_to_clipboard',
['x'] = 'cut_to_clipboard',
['p'] = 'paste_from_clipboard',
['c'] = 'copy', -- takes text input for destination
['m'] = 'move', -- takes text input for destination
['q'] = 'close_window',
},
},
filesystem = {
filtered_items = {
hide_dotfiles = false,
hide_gitignored = false,
},
},
source_selector = {
winbar = true,
statusline = false
}
})
vim.keymap.set('n', '\\', '<cmd>Neotree reveal<cr>')

View File

@ -1,135 +0,0 @@
local actions = require('telescope.actions')
local mappingTab = {
i = {
['<cr>'] = actions.select_tab,
['<C-b>'] = actions.select_default,
},
}
require('telescope').setup({
defaults = {
mappings = {
i = {
['<cr>'] = actions.select_default + actions.center,
['<C-l>'] = actions.send_selected_to_loclist,
['<C-q>'] = actions.smart_send_to_qflist,
},
},
},
pickers = {
-- Your special builtin config goes in here
buffers = {
sort_lastused = true,
theme = 'ivy',
mappings = {
i = {
['<c-w>'] = actions.delete_buffer,
['<cr>'] = actions.select_default,
},
n = {
['<c-w>'] = actions.delete_buffer,
},
},
},
find_files = {
theme = 'ivy',
previewer = false,
},
oldfiles = {
theme = 'ivy',
},
git_files = {
theme = 'ivy',
previewer = false,
},
lsp_references = {
show_line = false;
include_declaration = false,
},
lsp_dynamic_workspace_symbols = {},
},
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown {
}
}
}
})
require("telescope").load_extension("ui-select")
Project_files = function()
local opts = {} -- define here if you want to define something
local ok = pcall(require "telescope.builtin".git_files, opts)
if not ok then require "telescope.builtin".find_files(opts) end
end
require('legendary').keymaps(
{
{
'<leader>f',
':lua require("telescope.builtin").find_files({no_ignore=true})<CR>',
description = 'Find file',
},
{
'<leader>g',
':lua Project_files()<CR>',
description = 'Find git files',
},
{
'<leader>o',
':Telescope oldfiles<CR>',
description = 'Find old files',
},
{
'<leader>h',
':Telescope command_history<CR>',
description = 'Open command history',
},
{
'<leader>b',
':Telescope buffers<CR>',
description = 'Select buffer',
},
{
'<leader>q',
':Telescope quickfix<CR>',
description = 'Quickfix list with telescope',
},
{
'<leader>l',
':Telescope live_grep<CR>',
description = 'Search in project',
},
{
'<C-y>',
':Telescope neoclip<CR>',
description = 'Open clipboard history',
},
{
'<leader>j',
':Telescope jumplist<CR>',
description = 'Open jumplist',
},
{
'<c-f>',
':Telescope current_buffer_fuzzy_find<CR>',
description = 'Find in buffer',
},
{
'<leader>d',
':Telescope grep_string<CR>',
description = 'Find in workspace',
}
}
)
require('legendary').func(
{
function()
require('telescope.builtin').live_grep({ prompt_title = 'find string in open buffers...', grep_open_files = true })
end,
description = 'Search in open files',
}
)

View File

@ -1,48 +0,0 @@
local parser = require('nvim-treesitter.parsers').filetype_to_parsername
parser.groovy = 'java' -- the someft filetype will use the python parser and queries.
require('nvim-treesitter.configs').setup({
ensure_installed = all,
highlight = {
enable = true
},
rainbow = {
enable = true,
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
max_file_lines = nil, -- Do not enable for files with more than n lines, int
-- colors = {}, -- table of hex strings
-- termcolors = {} -- table of colour name strings
},
indent = {
enable = false -- maybe buggy
},
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 = {
enable = true,
border = 'none',
peek_definition_code = {
["<leader>df"] = "@function.outer",
["<leader>dF"] = "@class.outer",
},
},
},
})
require("nvim-treesitter.install").prefer_git = true
-- local groovy_parser = require('nvim-treesitter.parsers').groovy
-- groovy_parser.groovy = 'java' -- the someft filetype will use the python parser and queries.