From fd16ef223a829449802c7b00755f01502d383f9c Mon Sep 17 00:00:00 2001 From: Oliver Hartmann Date: Wed, 28 Dec 2022 13:52:17 +0100 Subject: [PATCH] start restructering of lazy --- init.lua | 4 +- lua/config/lazy.lua | 14 + lua/{my_options.lua => config/options.lua} | 124 ++++----- lua/my_plugins.lua | 282 --------------------- lua/{my_lazy.lua => plugins/init.lua} | 47 +--- lua/plugins/neotree.lua | 62 +++++ lua/plugins/telescope.lua | 161 ++++++++++++ lua/plugins/treesitter.lua | 50 ++++ lua/setup/neo-tree.lua | 56 ---- lua/setup/telescope.lua | 135 ---------- lua/setup/treesitter.lua | 48 ---- 11 files changed, 352 insertions(+), 631 deletions(-) create mode 100644 lua/config/lazy.lua rename lua/{my_options.lua => config/options.lua} (97%) delete mode 100644 lua/my_plugins.lua rename lua/{my_lazy.lua => plugins/init.lua} (75%) create mode 100644 lua/plugins/neotree.lua create mode 100644 lua/plugins/telescope.lua create mode 100644 lua/plugins/treesitter.lua delete mode 100644 lua/setup/neo-tree.lua delete mode 100644 lua/setup/telescope.lua delete mode 100644 lua/setup/treesitter.lua diff --git a/init.lua b/init.lua index 2bf6d5a..93e408b 100644 --- a/init.lua +++ b/init.lua @@ -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 diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..0d36981 --- /dev/null +++ b/lua/config/lazy.lua @@ -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', {}) diff --git a/lua/my_options.lua b/lua/config/options.lua similarity index 97% rename from lua/my_options.lua rename to lua/config/options.lua index dc33c6b..ec3c295 100644 --- a/lua/my_options.lua +++ b/lua/config/options.lua @@ -1,62 +1,62 @@ -vim.cmd('filetype plugin indent on') -vim.cmd('language en_US.utf-8') - -local opt = vim.opt -local indent = 2 -opt.termguicolors = true -- Enable colors in terminal -opt.hlsearch = true --Set highlight on search -opt.number = true --Make line numbers default -opt.relativenumber = false --Make relative number default -opt.mouse = 'a' --Enable mouse mode -opt.breakindent = true --Enable break indent -opt.undofile = true --Save undo history -opt.ignorecase = true --Case insensitive searching unless /C or capital in search -opt.smartcase = true -- Smart case -opt.updatetime = 300 --Decrease update time -opt.signcolumn = 'yes' -- Always show sign column -opt.clipboard = 'unnamed,unnamedplus' -- Access system clipboard -opt.timeoutlen = 300 -- Time in milliseconds to wait for a mapped sequence to complete. -opt.ttimeoutlen = 10 -opt.showmode = false -- Do not need to show the mode. We use the statusline instead. -opt.scrolloff = 999 -- Lines of context -opt.joinspaces = false -- No double spaces with join after a dot -opt.showmatch = true -- Show matching braces -opt.wrap = true -- When on, lines longer than the width of the window will wrap and displaying continues on the next line -opt.list = true -opt.hidden= true -opt.scrolloff= 4 -opt.shiftround= true -opt.relativenumber= false -opt.splitbelow= true -opt.splitright= true -opt.wildmode= 'longest:full,full' -opt.splitbelow= true -opt.splitright= true -opt.shiftwidth = indent -opt.tabstop = indent -if vim.loop.os_uname().sysname == 'Linux' then - opt.guifont= 'JetBrainsMono Nerd Font Mono:h7' -else - opt.guifont= 'JetBrainsMonoNL NF:h9' -- https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/JetBrainsMono/NoLigatures/Regular/complete/JetBrains%20Mono%20NL%20Regular%20Nerd%20Font%20Complete%20Mono%20Windows%20Compatible.ttf -end -opt.swapfile= false -opt.backup= false -opt.spelllang= 'en,de' -opt.completeopt= 'menu,menuone,noselect' -opt.expandtab= true -opt.smartindent= true -opt.title = true -opt.titlestring = '%{getcwd()} - %t' - --- go to previous/next line with h,l,left arrow and right arrow --- when cursor reaches end/beginning of line --- opt.whichwrap:append('<>[]hl') - --- disable nvim intro -opt.shortmess:append('sI') - --- Treesitter based folding -opt.foldlevel = 20 -opt.foldmethod = 'expr' -opt.foldexpr = 'nvim_treesitter#foldexpr()' - + +vim.cmd('filetype plugin indent on') +vim.cmd('language en_US.utf-8') + +local opt = vim.opt +local indent = 2 +opt.termguicolors = true -- Enable colors in terminal +opt.hlsearch = true --Set highlight on search +opt.number = true --Make line numbers default +opt.relativenumber = false --Make relative number default +opt.mouse = 'a' --Enable mouse mode +opt.breakindent = true --Enable break indent +opt.undofile = true --Save undo history +opt.ignorecase = true --Case insensitive searching unless /C or capital in search +opt.smartcase = true -- Smart case +opt.updatetime = 300 --Decrease update time +opt.signcolumn = 'yes' -- Always show sign column +opt.clipboard = 'unnamed,unnamedplus' -- Access system clipboard +opt.timeoutlen = 300 -- Time in milliseconds to wait for a mapped sequence to complete. +opt.ttimeoutlen = 10 +opt.showmode = false -- Do not need to show the mode. We use the statusline instead. +opt.scrolloff = 999 -- Lines of context +opt.joinspaces = false -- No double spaces with join after a dot +opt.showmatch = true -- Show matching braces +opt.wrap = true -- When on, lines longer than the width of the window will wrap and displaying continues on the next line +opt.list = true +opt.hidden= true +opt.scrolloff= 4 +opt.shiftround= true +opt.relativenumber= false +opt.splitbelow= true +opt.splitright= true +opt.wildmode= 'longest:full,full' +opt.splitbelow= true +opt.splitright= true +opt.shiftwidth = indent +opt.tabstop = indent +if vim.loop.os_uname().sysname == 'Linux' then + opt.guifont= 'JetBrainsMono Nerd Font Mono:h7' +else + opt.guifont= 'JetBrainsMonoNL NF:h9' -- https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/JetBrainsMono/NoLigatures/Regular/complete/JetBrains%20Mono%20NL%20Regular%20Nerd%20Font%20Complete%20Mono%20Windows%20Compatible.ttf +end +opt.swapfile= false +opt.backup= false +opt.spelllang= 'en,de' +opt.completeopt= 'menu,menuone,noselect' +opt.expandtab= true +opt.smartindent= true +opt.title = true +opt.titlestring = '%{getcwd()} - %t' + +-- go to previous/next line with h,l,left arrow and right arrow +-- when cursor reaches end/beginning of line +-- opt.whichwrap:append('<>[]hl') + +-- disable nvim intro +opt.shortmess:append('sI') + +-- Treesitter based folding +opt.foldlevel = 20 +opt.foldmethod = 'expr' +opt.foldexpr = 'nvim_treesitter#foldexpr()' diff --git a/lua/my_plugins.lua b/lua/my_plugins.lua deleted file mode 100644 index 9a62fc3..0000000 --- a/lua/my_plugins.lua +++ /dev/null @@ -1,282 +0,0 @@ -vim.cmd([[ - augroup packer_user_config - autocmd! - autocmd BufWritePost my_plugins.lua source | 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', '' }, - { 'n', '' } - }, - 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', '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', '' }, - { 'n', '' }, - { 'n', '' }, - { 'n', '' }, - { 'n', '' }, - { 'n', '' }, - { 'n', '' }, - { 'n', '' } - }, - -- 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', '' } - }, - module = 'overseer' - } - if packer_bootstrap then - require('packer').sync() - end -end) diff --git a/lua/my_lazy.lua b/lua/plugins/init.lua similarity index 75% rename from lua/my_lazy.lua rename to lua/plugins/init.lua index fba444b..10e92d4 100644 --- a/lua/my_lazy.lua +++ b/lua/plugins/init.lua @@ -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 = { 'p', '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) diff --git a/lua/plugins/neotree.lua b/lua/plugins/neotree.lua new file mode 100644 index 0000000..d0580c8 --- /dev/null +++ b/lua/plugins/neotree.lua @@ -0,0 +1,62 @@ +return { + 'nvim-neo-tree/neo-tree.nvim', + cmd = 'Neotree', + keys = { + { '\\', 'Neotree reveal', 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 = { + [''] = 'toggle_node', + ['<2-LeftMouse>'] = 'open', + [''] = '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 + } + } +} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..4f40d42 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -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 = { + { + 'f', + function() + require("telescope.builtin").find_files({ no_ignore = true }) + end, + desc = 'Find file', + }, + { + 'g', + function() + Project_files() + end, + desc = 'Find git files', + }, + { + 'o', + function() + require("telescope.builtin").oldfiles() + end, + desc = 'Find old files', + }, + { + 'h', + function() + require("telescope.builtin").command_history() + end, + desc = 'Open command history', + }, + { + 'b', + function() + require("telescope.builtin").buffers() + end, + desc = 'Select buffer', + }, + { + 'q', + function() + require("telescope.builtin").quickfix() + end, + desc = 'Quickfix list with telescope', + }, + { + 'l', + function() + require("telescope.builtin").live_grep() + end, + desc = 'Search in project', + }, + { + 'j', + function() + require("telescope.builtin").jumplist() + end, + desc = 'Open jumplist', + }, + { + '', + function() + require("telescope.builtin").current_buffer_fuzzy_find() + end, + desc = 'Find in buffer', + }, + { + 'd', + function() + require("telescope.builtin").grep_string() + end, + desc = 'Find in workspace', + } + }, + config = function() + local actions = require('telescope.actions') + + local mappingTab = { + i = { + [''] = actions.select_tab, + [''] = actions.select_default, + }, + } + + require('telescope').setup({ + defaults = { + mappings = { + i = { + [''] = actions.select_default + actions.center, + [''] = actions.send_selected_to_loclist, + [''] = actions.smart_send_to_qflist, + }, + }, + }, + pickers = { + -- Your special builtin config goes in here + buffers = { + sort_lastused = true, + theme = 'ivy', + mappings = { + i = { + [''] = actions.delete_buffer, + [''] = actions.select_default, + }, + n = { + [''] = 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 +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..3b916e4 --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -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 = { + ["df"] = "@function.outer", + ["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 +} + diff --git a/lua/setup/neo-tree.lua b/lua/setup/neo-tree.lua deleted file mode 100644 index 309ed03..0000000 --- a/lua/setup/neo-tree.lua +++ /dev/null @@ -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 = { - [''] = 'toggle_node', - ['<2-LeftMouse>'] = 'open', - [''] = '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', '\\', 'Neotree reveal') diff --git a/lua/setup/telescope.lua b/lua/setup/telescope.lua deleted file mode 100644 index 29bcf65..0000000 --- a/lua/setup/telescope.lua +++ /dev/null @@ -1,135 +0,0 @@ -local actions = require('telescope.actions') - -local mappingTab = { - i = { - [''] = actions.select_tab, - [''] = actions.select_default, - }, -} - -require('telescope').setup({ - defaults = { - mappings = { - i = { - [''] = actions.select_default + actions.center, - [''] = actions.send_selected_to_loclist, - [''] = actions.smart_send_to_qflist, - }, - }, - }, - pickers = { - -- Your special builtin config goes in here - buffers = { - sort_lastused = true, - theme = 'ivy', - mappings = { - i = { - [''] = actions.delete_buffer, - [''] = actions.select_default, - }, - n = { - [''] = 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( - { - { - 'f', - ':lua require("telescope.builtin").find_files({no_ignore=true})', - description = 'Find file', - }, - { - 'g', - ':lua Project_files()', - description = 'Find git files', - }, - { - 'o', - ':Telescope oldfiles', - description = 'Find old files', - }, - { - 'h', - ':Telescope command_history', - description = 'Open command history', - }, - { - 'b', - ':Telescope buffers', - description = 'Select buffer', - }, - { - 'q', - ':Telescope quickfix', - description = 'Quickfix list with telescope', - }, - { - 'l', - ':Telescope live_grep', - description = 'Search in project', - }, - { - '', - ':Telescope neoclip', - description = 'Open clipboard history', - }, - { - 'j', - ':Telescope jumplist', - description = 'Open jumplist', - }, - { - '', - ':Telescope current_buffer_fuzzy_find', - description = 'Find in buffer', - }, - { - 'd', - ':Telescope grep_string', - 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', - } -) diff --git a/lua/setup/treesitter.lua b/lua/setup/treesitter.lua deleted file mode 100644 index 771d4ea..0000000 --- a/lua/setup/treesitter.lua +++ /dev/null @@ -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 = { - ["df"] = "@function.outer", - ["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.