diff options
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/Nanderty/lazy.lua | 70 | ||||
| -rw-r--r-- | lua/Nanderty/remap.lua | 2 | ||||
| -rw-r--r-- | lua/keymaps.lua | 2 | ||||
| -rw-r--r-- | lua/options.lua (renamed from lua/Nanderty/general.lua) | 21 | ||||
| -rw-r--r-- | lua/plugins/cmp.lua | 80 | ||||
| -rw-r--r-- | lua/plugins/colorscheme.lua | 15 | ||||
| -rw-r--r-- | lua/plugins/general.lua | 39 | ||||
| -rw-r--r-- | lua/plugins/interface.lua | 44 | ||||
| -rw-r--r-- | lua/plugins/latex.lua | 6 | ||||
| -rw-r--r-- | lua/plugins/lsp.lua | 33 | ||||
| -rw-r--r-- | lua/plugins/mini.lua | 14 | ||||
| -rw-r--r-- | lua/plugins/telescope.lua | 46 | ||||
| -rw-r--r-- | lua/plugins/treesitter.lua | 26 | ||||
| -rw-r--r-- | lua/utilities/util.lua | 19 |
14 files changed, 338 insertions, 79 deletions
diff --git a/lua/Nanderty/lazy.lua b/lua/Nanderty/lazy.lua deleted file mode 100644 index 6315de3..0000000 --- a/lua/Nanderty/lazy.lua +++ /dev/null @@ -1,70 +0,0 @@ -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", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) -end -vim.opt.rtp:prepend(lazypath) - -vim.g.mapleader = " " - -require("lazy").setup({ - -{'lervag/vimtex', module=false}, - -{ 'echasnovski/mini.nvim', version = false }, - -'tpope/vim-fugitive', -'ludovicchabant/vim-gutentags', -'sbdchd/neoformat', -'neomake/neomake', - -{ - 'nvim-telescope/telescope.nvim', version = '0.1.1', - dependencies = { 'nvim-lua/plenary.nvim' } -}, - -'lewis6991/gitsigns.nvim', -'nvim-tree/nvim-tree.lua', - -{ - 'akinsho/bufferline.nvim', version = "v3.*", - dependencies = 'nvim-tree/nvim-web-devicons' -}, - -'nvim-lualine/lualine.nvim', -{ - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate' -}, -'lukas-reineke/indent-blankline.nvim', -'navarasu/onedark.nvim'; - -{ - 'VonHeikemen/lsp-zero.nvim', - branch = 'v1.x', - dependencies = { - -- LSP Support - {'neovim/nvim-lspconfig'}, -- Required - {'williamboman/mason.nvim'}, -- Optional - {'williamboman/mason-lspconfig.nvim'}, -- Optional - - -- Autocompletion - {'hrsh7th/nvim-cmp'}, -- Required - {'hrsh7th/cmp-nvim-lsp'}, -- Required - {'hrsh7th/cmp-buffer'}, -- Optional - {'hrsh7th/cmp-path'}, -- Optional - {'saadparwaiz1/cmp_luasnip'}, -- Optional - {'hrsh7th/cmp-nvim-lua'}, -- Optional - - -- Snippets - {'L3MON4D3/LuaSnip'}, -- Required - } -}, - -}) diff --git a/lua/Nanderty/remap.lua b/lua/Nanderty/remap.lua deleted file mode 100644 index b760350..0000000 --- a/lua/Nanderty/remap.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.g.mapleader = " " -vim.keymap.set("n", "<leader>pv", vim.cmd.Ex) diff --git a/lua/keymaps.lua b/lua/keymaps.lua new file mode 100644 index 0000000..6596a43 --- /dev/null +++ b/lua/keymaps.lua @@ -0,0 +1,2 @@ +vim.g.mapleader = " " + diff --git a/lua/Nanderty/general.lua b/lua/options.lua index 36f6519..53fd399 100644 --- a/lua/Nanderty/general.lua +++ b/lua/options.lua @@ -5,19 +5,26 @@ vim.opt.updatetime = 200 vim.opt.mouse = a vim.opt.signcolumn = 'yes' vim.opt.cursorline = true - +vim.opt.wrap = false +vim.opt.splitbelow = true +vim.opt.splitright = true vim.opt.undofile = true vim.opt.undodir = { vim.fn.stdpath('data')..'/undo' } vim.opt.undolevels = 1000 +vim.opt.showmode = false +vim.opt.smartindent = true +vim.opt.shiftwidth = 4 vim.opt.number = true vim.opt.scrolloff = 20 vim.opt.numberwidth = 5 - +vim.diagnostic.config({ + virtual_text = { + severity = vim.diagnostic.severity.ERROR, + }, + underline = { + severity = vim.diagnostic.severity.ERROR, + }, +}) vim.opt.termguicolors = true vim.opt.guifont = {'Hack NFM:h12'} - -require('onedark').setup { - style = 'warmer' -} -require('onedark').load() diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua new file mode 100644 index 0000000..6015356 --- /dev/null +++ b/lua/plugins/cmp.lua @@ -0,0 +1,80 @@ +return { + { + 'L3MON4D3/LuaSnip', + dependencies = { + 'iurimateus/luasnip-latex-snippets.nvim', + 'rafamadriz/friendly-snippets', + }, + config = function() + require('luasnip-latex-snippets').setup() + require("luasnip.loaders.from_lua").lazy_load() + require("luasnip.loaders.from_vscode").lazy_load() + end + }, + { + 'hrsh7th/nvim-cmp', + event = 'InsertEnter', + dependencies = { + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + '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' }, + }) + } + end, + }, +} diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..6dd51ca --- /dev/null +++ b/lua/plugins/colorscheme.lua @@ -0,0 +1,15 @@ +return { + + { + 'navarasu/onedark.nvim', + lazy = false, + priority = 1000, + config = function() + require('onedark').setup { + style = 'warmer' + } + require('onedark').load() + end, + }, + +} diff --git a/lua/plugins/general.lua b/lua/plugins/general.lua new file mode 100644 index 0000000..3eeb1c0 --- /dev/null +++ b/lua/plugins/general.lua @@ -0,0 +1,39 @@ +return { + { + 'sbdchd/neoformat', + keys = { + { '<leader>i', '<cmd>Neoformat<cr>', desc = 'format' }, + }, + }, + { + 'neomake/neomake', + event = { + 'BufReadPost', + 'BufNewFile' + }, + config = function() + vim.call('neomake#configure#automake', 'nrwi', '500') + end, + }, + { + 'tpope/vim-fugitive', + event = { + 'BufReadPost', + 'BufNewFile' + }, + }, + { + 'JoseConseco/telescope_sessions_picker.nvim', + keys = { + { '<leader>ps', '<cmd>Telescope sessions_picker<cr>', desc = 'session' }, + }, + dependencies = { + 'nvim-telescope/telescope.nvim', + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', + }, + config = function() + require('telescope').load_extension 'sessions_picker' + end, + }, +} diff --git a/lua/plugins/interface.lua b/lua/plugins/interface.lua new file mode 100644 index 0000000..4e898c5 --- /dev/null +++ b/lua/plugins/interface.lua @@ -0,0 +1,44 @@ +return { + { + 'akinsho/bufferline.nvim', + event = 'VeryLazy', + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + opts = { + options = { + diagnostics = "nvim_lsp", + always_show_bufferline = false, + }, + }, + config = function(_, opts) + require("bufferline").setup(opts) + end, + }, + { + 'nvim-lualine/lualine.nvim', + event = 'VeryLazy', + opts = { + options = { + theme = 'onedark' + }, + }, + }, + { + 'lukas-reineke/indent-blankline.nvim', + event = { + 'BufReadPost', + 'BufNewFile' + }, + }, + { + 'lewis6991/gitsigns.nvim', + event = { + 'BufReadPost', + 'BufNewFile' + }, + config = function() + require('gitsigns').setup() + end, + }, +} diff --git a/lua/plugins/latex.lua b/lua/plugins/latex.lua new file mode 100644 index 0000000..f3ad09c --- /dev/null +++ b/lua/plugins/latex.lua @@ -0,0 +1,6 @@ +return { + { + 'lervag/vimtex', + lazy = false, + }, +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..dd088e2 --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +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() + + require('mason-lspconfig').setup() + + 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, + }) + end, + }) + end, + }, +} diff --git a/lua/plugins/mini.lua b/lua/plugins/mini.lua new file mode 100644 index 0000000..18c4a23 --- /dev/null +++ b/lua/plugins/mini.lua @@ -0,0 +1,14 @@ +return { + { + 'echasnovski/mini.nvim', + event = 'VimEnter', + config = function() + require('mini.sessions').setup({ + force = {read = false, write = true, delete = true} + }) + require('mini.starter').setup({ + evaluate_single = true + }) + end, + }, +} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..c09c5a6 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,46 @@ +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>pg', '<cmd>Telescope live_grep<cr>', desc = 'grep files' }, + }, + dependencies = { 'nvim-lua/plenary.nvim' }, + opts = { + defaults = { + initial_mode = 'normal', + mappings = { + n = { + ['q'] = function(...) + return require('telescope.actions').close(...) + end, + } + } + }, + extensions = { + file_browser ={ + hijack_netrw = true, + }, + sessions_picker = { + sessions_dir = vim.fn.stdpath('data') ..'/session/', + } + }, + }, + }, + + { + 'nvim-telescope/telescope-file-browser.nvim', + keys = { + { '<leader>pv', '<cmd>Telescope file_browser path=%:p:h select_buffer=true<cr>', desc = 'file tree' }, + }, + dependencies = { + 'nvim-telescope/telescope.nvim', + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', + }, + config = function() + require('telescope').load_extension 'file_browser' + end, + }, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..6f2fa4e --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,26 @@ +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, + } +} diff --git a/lua/utilities/util.lua b/lua/utilities/util.lua new file mode 100644 index 0000000..ec6c400 --- /dev/null +++ b/lua/utilities/util.lua @@ -0,0 +1,19 @@ +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 |
