diff options
| author | Nanderty <psopka@sopka.ch> | 2023-03-21 19:22:45 +0100 |
|---|---|---|
| committer | Nanderty <psopka@sopka.ch> | 2023-03-21 19:22:45 +0100 |
| commit | 425f6135ec366b9c38b00c8936ad728dbf377714 (patch) | |
| tree | be0d634a80ddac7c1deb569a492ca3e8b63a6765 | |
| parent | 0cbfb1248476aa278c1567deeb4021e68703d7e2 (diff) | |
| download | neovim-config-425f6135ec366b9c38b00c8936ad728dbf377714.tar.gz neovim-config-425f6135ec366b9c38b00c8936ad728dbf377714.tar.bz2 neovim-config-425f6135ec366b9c38b00c8936ad728dbf377714.zip | |
lazy all
| -rw-r--r-- | lua/+ | 87 | ||||
| -rw-r--r-- | lua/icons.lua | 39 | ||||
| -rw-r--r-- | lua/plugins/cmp.lua | 30 | ||||
| -rw-r--r-- | lua/plugins/colorscheme.lua | 10 | ||||
| -rw-r--r-- | lua/plugins/general.lua | 10 | ||||
| -rw-r--r-- | lua/plugins/interface.lua | 83 | ||||
| -rw-r--r-- | lua/plugins/lsp.lua | 54 | ||||
| -rw-r--r-- | lua/plugins/telescope.lua | 32 | ||||
| -rw-r--r-- | lua/plugins/treesitter.lua | 51 | ||||
| -rw-r--r-- | lua/utilities/util.lua | 19 |
10 files changed, 282 insertions, 133 deletions
@@ -0,0 +1,87 @@ +return { + { + 'L3MON4D3/LuaSnip', + dependencies = { + 'iurimateus/luasnip-latex-snippets.nvim', + 'rafamadriz/friendly-snippets', + }, + config = function() + require('luasnip-latex-snippets').setup() + require('luasnip.loaders.from_vscode').lazy_load() + end + }, + { + 'hrsh7th/nvim-cmp', + event = 'InsertEnter', + dependencies = { + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-calc', + 'saadparwaiz1/cmp_luasnip', + }, + + opts = function() + local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') == nil + end + + local luasnip = require('luasnip') + local cmp = require('cmp') + + luasnip.config.set_config({ + history = true, + enable_autosnippets = true, + }) + + return { + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + + ['<Space>'] = cmp.mapping.confirm({ select = false }), + + ['<Tab>'] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { 'i', 's' }), + + ['<S-Tab>'] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'buffer' }, + { name = 'path' }, + { name = 'calc' }, + }), + formatting = { + format = function(_, item) + item.kind = (require('icons').kinds[item.kind] or ' ')..item.kind + return item + end + } + } + end, + }, f +} diff --git a/lua/icons.lua b/lua/icons.lua new file mode 100644 index 0000000..b53532d --- /dev/null +++ b/lua/icons.lua @@ -0,0 +1,39 @@ +return { + kinds = { + Array = ' ', + Boolean = ' ', + Class = ' ', + Color = ' ', + Constant = ' ', + Constructor = ' ', + Copilot = ' ', + Enum = ' ', + EnumMember = ' ', + Event = ' ', + Field = ' ', + File = ' ', + Folder = ' ', + Function = ' ', + Interface = ' ', + Key = ' ', + Keyword = ' ', + Method = ' ', + Module = ' ', + Namespace = ' ', + Null = ' ', + Number = ' ', + Object = ' ', + Operator = ' ', + Package = ' ', + Property = ' ', + Reference = ' ', + Snippet = ' ', + String = ' ', + Struct = ' ', + Text = ' ', + TypeParameter = ' ', + Unit = ' ', + Value = ' ', + Variable = ' ', + }, +} diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index 48df829..5830b7b 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -5,9 +5,13 @@ return { 'iurimateus/luasnip-latex-snippets.nvim', 'rafamadriz/friendly-snippets', }, + opts = { + history = true, + delete_check_events = "TextChanged", + }, config = function() require('luasnip-latex-snippets').setup() - require("luasnip.loaders.from_vscode").lazy_load() + require('luasnip.loaders.from_vscode').lazy_load() end }, { @@ -19,23 +23,23 @@ return { 'hrsh7th/cmp-path', 'hrsh7th/cmp-calc', 'saadparwaiz1/cmp_luasnip', + 'L3MON4D3/LuaSnip', }, opts = function() local has_words_before = function() unpack = unpack or table.unpack local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') == nil end - local luasnip = require("luasnip") + local luasnip = require('luasnip') local cmp = require('cmp') luasnip.config.set_config({ history = true, enable_autosnippets = true, }) - return { snippet = { expand = function(args) @@ -43,10 +47,8 @@ return { end, }, mapping = cmp.mapping.preset.insert({ - ['<Space>'] = cmp.mapping.confirm({ select = false }), - - ["<Tab>"] = cmp.mapping(function(fallback) + ['<Tab>'] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() elseif luasnip.expand_or_jumpable() then @@ -56,9 +58,9 @@ return { else fallback() end - end, { "i", "s" }), + end, { 'i', 's' }), - ["<S-Tab>"] = cmp.mapping(function(fallback) + ['<S-Tab>'] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() elseif luasnip.jumpable(-1) then @@ -66,7 +68,7 @@ return { else fallback() end - end, { "i", "s" }), + end, { 'i', 's' }), }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, @@ -74,7 +76,13 @@ return { { name = 'buffer' }, { name = 'path' }, { name = 'calc' }, - }) + }), + formatting = { + format = function(_, item) + item.kind = (require('icons').kinds[item.kind] or ' ')..item.kind + return item + end + } } end, }, diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua index 51ff0f7..173c23b 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -1,15 +1,19 @@ return { - { 'loctvl842/monokai-pro.nvim', lazy = false, priority = 1000, config = function() require("monokai-pro").setup({ - background_clear = {} + background_clear = {}, + override = function(c) + return { + TelescopePreviewDate = { fg = c.base.red , bg = transparent_bg }, + TelescopePreviewDirectory = { fg = c.base.white , bg = transparent_bg }, + } + end }) vim.cmd([[colorscheme monokai-pro]]) end, }, - } diff --git a/lua/plugins/general.lua b/lua/plugins/general.lua index 44556fb..d78275e 100644 --- a/lua/plugins/general.lua +++ b/lua/plugins/general.lua @@ -29,4 +29,14 @@ return { 'BufNewFile' }, }, + { + 'max397574/better-escape.nvim', + lazy = false, + config = function() + require('better_escape').setup { + mapping = { 'jk' }, + timeout = 0.2 * vim.o.timeoutlen, + } + end, + }, } diff --git a/lua/plugins/interface.lua b/lua/plugins/interface.lua index 6497d0a..f3d6e03 100644 --- a/lua/plugins/interface.lua +++ b/lua/plugins/interface.lua @@ -1,44 +1,51 @@ return { - { - 'akinsho/bufferline.nvim', - event = 'VeryLazy', - dependencies = { - 'nvim-tree/nvim-web-devicons', + { + 'akinsho/bufferline.nvim', + event = { + 'BufReadPost', + 'BufNewFile' + }, + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + opts = { + options = { + diagnostics = "nvim_lsp", + always_show_bufferline = false, + }, + }, + config = function(_, opts) + require("bufferline").setup(opts) + end, }, - opts = { - options = { - diagnostics = "nvim_lsp", - always_show_bufferline = false, - }, + { + 'nvim-lualine/lualine.nvim', + event = 'VeryLazy', + opts = { + options = { + theme = 'auto' + }, + }, }, - config = function(_, opts) - require("bufferline").setup(opts) - end, - }, - { - 'nvim-lualine/lualine.nvim', - event = 'VeryLazy', - opts = { - options = { - theme = 'auto' - }, + { + 'lukas-reineke/indent-blankline.nvim', + event = { + 'BufReadPost', + 'BufNewFile' + }, + opts = { + show_current_context = true, + show_current_context_start = true, + }, }, - }, - { - 'lukas-reineke/indent-blankline.nvim', - event = { - 'BufReadPost', - 'BufNewFile' + { + 'lewis6991/gitsigns.nvim', + event = { + 'BufReadPost', + 'BufNewFile' + }, + config = function() + require('gitsigns').setup() + end, }, - }, - { - 'lewis6991/gitsigns.nvim', - event = { - 'BufReadPost', - 'BufNewFile' - }, - config = function() - require('gitsigns').setup() - end, - }, } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index dd088e2..4a504ec 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,33 +1,33 @@ return { - { - 'neovim/nvim-lspconfig', - event = { - 'BufReadPre', - 'BufNewFile' - }, - dependencies = { - 'williamboman/mason.nvim', - 'williamboman/mason-lspconfig.nvim', - 'hrsh7th/cmp-nvim-lsp', - }, - config = function() - require('mason').setup() + { + 'neovim/nvim-lspconfig', + event = { + 'BufReadPost', + 'BufNewFile' + }, + dependencies = { + 'williamboman/mason.nvim', + 'williamboman/mason-lspconfig.nvim', + 'hrsh7th/cmp-nvim-lsp', + }, + config = function() + require('mason').setup() - require('mason-lspconfig').setup() + require('mason-lspconfig').setup() - local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities() - local lsp_attach = function(client, bufnr) - end + local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities() + local lsp_attach = function(client, bufnr) + end - local lspconfig = require('lspconfig') - require('mason-lspconfig').setup_handlers({ - function(server_name) - lspconfig[server_name].setup({ - on_attach = lsp_attach, - capabilities = lsp_capabilities, - }) + local lspconfig = require('lspconfig') + require('mason-lspconfig').setup_handlers({ + function(server_name) + lspconfig[server_name].setup({ + on_attach = lsp_attach, + capabilities = lsp_capabilities, + }) + end, + }) end, - }) - end, - }, + }, } diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 6407bc3..949c617 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -3,13 +3,17 @@ return { 'nvim-telescope/telescope.nvim', keys = { { '<leader>pf', '<cmd>Telescope find_files<cr>', desc = 'find files' }, - { '<leader>pd', '<cmd>Telescope oldfiles<cr>', desc = 'oldfiles' }, + { '<leader>pd', '<cmd>Telescope oldfiles<cr>', desc = 'find oldfiles' }, { '<leader>pg', '<cmd>Telescope live_grep<cr>', desc = 'grep files' }, + { '<leader>pb', '<cmd>Telescope buffers<cr>', desc = 'find buffers' }, + }, + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', + 'nvim-telescope/telescope-fzf-native.nvim', }, - dependencies = { 'nvim-lua/plenary.nvim' }, opts = { defaults = { - initial_mode = 'normal', mappings = { n = { ['q'] = function(...) @@ -19,7 +23,7 @@ return { }, layout_config = { horizontal = { - prompt_position = "top", + prompt_position = 'top', preview_width = 0.55, results_width = 0.8, }, @@ -30,19 +34,15 @@ return { height = 0.80, preview_cutoff = 120, }, - borderchars = { "█", " ", "▀", "█", "█", " ", " ", "▀" }, + borderchars = { '█', ' ', '▀', '█', '█', ' ', ' ', '▀' }, }, extensions = { - file_browser ={ - hijack_netrw = true, - }, sessions_picker = { sessions_dir = vim.fn.stdpath('data') ..'/session/', } }, }, }, - { 'nvim-telescope/telescope-file-browser.nvim', keys = { @@ -50,8 +50,6 @@ return { }, dependencies = { 'nvim-telescope/telescope.nvim', - 'nvim-lua/plenary.nvim', - 'nvim-tree/nvim-web-devicons', }, config = function() require('telescope').load_extension 'file_browser' @@ -62,8 +60,20 @@ return { keys = { { '<leader>ps', '<cmd>Telescope telemini<cr>', desc = 'sessions' } }, + dependencies = { + 'nvim-telescope/telescope.nvim', + }, config = function() require('telescope').load_extension 'telemini' end, }, + { + 'nvim-telescope/telescope-fzf-native.nvim', + build = 'make', + config = function() + require('telescope').load_extension 'fzf' + end, + }, + { 'nvim-tree/nvim-web-devicons',}, + { 'nvim-lua/plenary.nvim',}, } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 6f2fa4e..4e488ad 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,26 +1,29 @@ return { - { - 'nvim-treesitter/nvim-treesitter', - build = ":TSUpdate", - event = { "BufReadPost", "BufNewFile" }, - opts = { - auto_install = true, - ignore_install = { 'latex' }, - highlight = { enable = true }, - indent = { enable = true, disable = { "python" } }, - ensure_installed = { - 'javascript', - 'python', - 'cpp', - 'c', - 'lua', - 'php', - 'html', - 'css', - }, - }, - config = function(_, opts) - require("nvim-treesitter.configs").setup(opts) - end, - } + { + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + event = { + 'BufReadPost', + 'BufNewFile' + }, + opts = { + auto_install = true, + ignore_install = { 'latex' }, + highlight = { enable = true }, + indent = { enable = true, disable = { 'python' } }, + ensure_installed = { + 'javascript', + 'python', + 'cpp', + 'c', + 'lua', + 'php', + 'html', + 'css', + }, + }, + config = function(_, opts) + require('nvim-treesitter.configs').setup(opts) + end, + } } diff --git a/lua/utilities/util.lua b/lua/utilities/util.lua deleted file mode 100644 index ec6c400..0000000 --- a/lua/utilities/util.lua +++ /dev/null @@ -1,19 +0,0 @@ -local M = {} - -function M.telescope(builtin, opts) - local params = { builtin = builtin, opts = opts } - return function() - builtin = params.builtin - opts = params.opts - opts = vim.tbl_deep_extend("force", { cwd = M.get_root() }, opts or {}) - if builtin == "files" then - if vim.loop.fs_stat((opts.cwd or vim.loop.cwd()) .. "/.git") then - opts.show_untracked = true - builtin = "git_files" - else - builtin = "find_files" - end - end - require("telescope.builtin")[builtin](opts) - end -end |
