dotfiles

Personal dotfiles.
git clone git://vcs.sapka.me/dotfiles
Log | Files | Refs | Submodules

commit a38b3a664996f97761ccb20c38526dee29adf2ea
parent ed4f5783e939e2d227966fca1642dbf318fbde5a
Author: Michał M. Sapka <michal@sapka.me>
Date:   Thu,  4 Aug 2022 15:35:53 +0200

chore: massive refactor

Diffstat:
Mnvim/.config/nvim/init.lua | 322+------------------------------------------------------------------------------
Dnvim/.config/nvim/lua/plugin/packer_compiled.lua | 97-------------------------------------------------------------------------------
Anvim/.config/nvim/lua/user/cmp.lua | 126+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anvim/.config/nvim/lua/user/config.lua | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mnvim/.config/nvim/lua/user/lsp/configs.lua | 2+-
Mnvim/.config/nvim/lua/user/lsp/init.lua | 29++++++++++++++++++++++++++++-
Mnvim/.config/nvim/lua/user/neorg.lua | 20--------------------
Anvim/.config/nvim/lua/user/plugins.lua | 103+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dnvim/.config/nvim/plugin/packer_compiled.lua | 224-------------------------------------------------------------------------------
Dnvim/.config/nvim/plugins.lua | 53-----------------------------------------------------
10 files changed, 315 insertions(+), 715 deletions(-)

diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua @@ -1,330 +1,14 @@ -local set = vim.opt -- set options - -local cmd = vim.api.nvim_command --- General options -set.backup = false -set.swapfile = false - -set.relativenumber = true -set.number = true - -set.hlsearch = true -set.ignorecase = true - -set.syntax = "ON" -set.termguicolors = true - --- Tab stops because I am not an evel person -set.tabstop = 2 -set.softtabstop = 2 -set.shiftwidth = 2 -set.expandtab = true -set.smartindent = true - -set.scrolloff=8 - -set.colorcolumn="90" - --- Keymaps -opts = { noremap = true, silent = true } -vim.g.mapleader = " " - --- Create splits -vim.api.nvim_set_keymap("n", "ss", ":split:<Return><C-w>w", opts) -vim.api.nvim_set_keymap("n", "sv", ":vsplit<Return><C-w>w", opts) --- Move between split -vim.api.nvim_set_keymap("n", "sh", "<C-w>h", opts) -vim.api.nvim_set_keymap("n", "sk", "<C-w>k", opts) -vim.api.nvim_set_keymap("n", "sj", "<C-w>j", opts) -vim.api.nvim_set_keymap("n", "sl", "<C-w>l", opts) - -vim.api.nvim_set_keymap("n", "<C-p>", ":lua require('telescope.builtin').find_files()<CR>", opts) -vim.api.nvim_set_keymap("n", "<leader>fg", ":lua require('telescope.builtin').live_grep()<CR>", opts) -vim.api.nvim_set_keymap("n", "<leader>fb", ":lua require('telescope.builtin').buffers()<CR>", opts) - --- Mappings. --- See `:help vim.diagnostic.*` for documentation on any of the below functions -vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts) -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) -vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts) - --- Use an on_attach function to only map the following keys --- after the language server attaches to the current buffer -local on_attach = function(client, bufnr) - -- Enable completion triggered by <c-x><c-o> - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - - -- Mappings. - -- See `:help vim.lsp.*` for documentation on any of the below functions - local bufopts = { noremap=true, silent=true, buffer=bufnr } - vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) - vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) - vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts) - vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts) - vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts) - vim.keymap.set('n', '<space>wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, bufopts) - vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts) - vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts) - vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts) - vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) - vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts) -end - -local fn = vim.fn - --- Automatically install packer -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, - } - print "Installing packer close and reopen Neovim..." - vim.cmd [[packadd packer.nvim]] -end - --- Autocommand that reloads neovim whenever you save the plugins.lua file -vim.cmd [[ - augroup packer_user_config - autocmd! - autocmd BufWritePost plugins.lua source <afile> | PackerSync - augroup end -]] - --- Use a protected call so we don't error out on first use -local status_ok, packer = pcall(require, "packer") -if not status_ok then - return -end - --- Have packer use a popup window -packer.init { - display = { - open_fn = function() - return require("packer.util").float { border = "rounded" } - end, - }, -} - --- nvim-cmp -local cmp_status_ok, cmp = pcall(require, "cmp") -if not cmp_status_ok then - return -end - -local snip_status_ok, luasnip = pcall(require, "luasnip") -if not snip_status_ok then - return -end - -require("luasnip/loaders/from_vscode").lazy_load() - -local check_backspace = function() - local col = vim.fn.col "." - 1 - return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" -end - ---   פּ ﯟ   some other good icons -local kind_icons = { - Text = "", - Method = "m", - Function = "", - Constructor = "", - Field = "", - Variable = "", - Class = "", - Interface = "", - Module = "", - Property = "", - Unit = "", - Value = "", - Enum = "", - Keyword = "", - Snippet = "", - Color = "", - File = "", - Reference = "", - Folder = "", - EnumMember = "", - Constant = "", - Struct = "", - Event = "", - Operator = "", - TypeParameter = "", -} --- --- find more here: https://www.nerdfonts.com/cheat-sheet -cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) -- For `luasnip` users. - end, - }, - mapping = { - ["<C-k>"] = cmp.mapping.select_prev_item(), - ["<C-j>"] = cmp.mapping.select_next_item(), - ["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), - ["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), - ["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), - ["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping. - ["<C-e>"] = cmp.mapping { - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }, - -- Accept currently selected item. If none selected, `select` first item. - -- Set `select` to `false` to only confirm explicitly selected items. - ["<CR>"] = cmp.mapping.confirm { select = true }, - ["<Tab>"] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expandable() then - luasnip.expand() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif check_backspace() then - fallback() - 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", - }), - }, - formatting = { - fields = { "kind", "abbr", "menu" }, - format = function(entry, vim_item) - -- Kind icons - vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) --- vim_item.kind = string.format('%s', vim_item.kind) -- This concatonates the icons with the name of the item kind - vim_item.menu = ({ - luasnip = "[Snip]", - nvim_lsp = "[LSP]", - buffer = "[Buff]", - path = "[Path]", - })[entry.source.name] - return vim_item - end, - }, - sources = { - { name = 'nvim_lsp' }, - { name = "luasnip" }, - { name = "buffer" }, - { name = "path" }, - }, - confirm_opts = { - behavior = cmp.ConfirmBehavior.Replace, - select = false, - }, - experimental = { - ghost_text = false, - native_menu = false, - }, -} - - -require('telescope').load_extension('fzf') - - +require "user.config" require "user.lsp" require "user.treesitter" require "user.neorg" +require "user.cmp" +require "user.plugins" -- Style vim.cmd('colorscheme gruvbox') -vim.cmd('hi Normal guibg=NONE ctermbg=NONE') require('lualine').setup{ options = { theme = 'gruvbox' } } --- Install your plugins here -return packer.startup(function(use) - -- My plugins here - use "wbthomason/packer.nvim" -- Have packer manage itself - use "nvim-lua/popup.nvim" -- An implementation of the Popup API from vim in Neovim - use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins - use "Mofiqul/dracula.nvim" -- Dracula theme - use "morhetz/gruvbox" - use { - 'nvim-lualine/lualine.nvim', requires = { 'kyazdani42/nvim-web-devicons', opt = true } - } - use { - 'lewis6991/gitsigns.nvim', - config = function() - require('gitsigns').setup() end - } - use { - 'kyazdani42/nvim-tree.lua', - requires = { - 'kyazdani42/nvim-web-devicons', -- optional, for file icon - } - } - use { - 'nvim-telescope/telescope.nvim', - requires = { {'nvim-lua/plenary.nvim'} } - } - use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } - - - -- cmp - use "hrsh7th/nvim-cmp" - use "hrsh7th/cmp-buffer" - use "hrsh7th/cmp-path" - use "hrsh7th/cmp-cmdline" - use "saadparwaiz1/cmp_luasnip" - use "hrsh7th/cmp-nvim-lsp" - - --snippets - use "L3MON4D3/LuaSnip" - use "rafamadriz/friendly-snippets" - - use "neovim/nvim-lspconfig" -- enable LSP - use "williamboman/nvim-lsp-installer" -- simple to use language server installer - use "tamago324/nlsp-settings.nvim" -- language server settings defined in json for - use "jose-elias-alvarez/null-ls.nvim" -- for formatters and linters - - use "rhysd/vim-grammarous" - - --treesitter - use { - "nvim-treesitter/nvim-treesitter", - run = 'TSUpdate' - } - - -- neorg - use { - "nvim-neorg/neorg", - after = "nvim-treesitter", -- Ensures that neorg loads after nvim-treesitter - requires = { - "nvim-lua/plenary.nvim" - } - } - - -- Automatically set up your configuration after cloning packer.nvim - -- Put this at the end after all plugins - if PACKER_BOOTSTRAP then - require("packer").sync() - end -end) diff --git a/nvim/.config/nvim/lua/plugin/packer_compiled.lua b/nvim/.config/nvim/lua/plugin/packer_compiled.lua @@ -1,97 +0,0 @@ --- Automatically generated packer.nvim plugin loader code - -if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then - vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') - return -end - -vim.api.nvim_command('packadd packer.nvim') - -local no_errors, error_msg = pcall(function() - - local time - local profile_info - local should_profile = false - if should_profile then - local hrtime = vim.loop.hrtime - profile_info = {} - time = function(chunk, start) - if start then - profile_info[chunk] = hrtime() - else - profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 - end - end - else - time = function(chunk, start) end - end - -local function save_profiles(threshold) - local sorted_times = {} - for chunk_name, time_taken in pairs(profile_info) do - sorted_times[#sorted_times + 1] = {chunk_name, time_taken} - end - table.sort(sorted_times, function(a, b) return a[2] > b[2] end) - local results = {} - for i, elem in ipairs(sorted_times) do - if not threshold or threshold and elem[2] > threshold then - results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' - end - end - - _G._packer = _G._packer or {} - _G._packer.profile_output = results -end - -time([[Luarocks path setup]], true) -local package_path_str = "/Users/msapka/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/msapka/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/msapka/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/msapka/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" -local install_cpath_pattern = "/Users/msapka/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" -if not string.find(package.path, package_path_str, 1, true) then - package.path = package.path .. ';' .. package_path_str -end - -if not string.find(package.cpath, install_cpath_pattern, 1, true) then - package.cpath = package.cpath .. ';' .. install_cpath_pattern -end - -time([[Luarocks path setup]], false) -time([[try_loadstring definition]], true) -local function try_loadstring(s, component, name) - local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) - if not success then - vim.schedule(function() - vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) - end) - end - return result -end - -time([[try_loadstring definition]], false) -time([[Defining packer_plugins]], true) -_G.packer_plugins = { - ["packer.nvim"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/packer.nvim", - url = "https://github.com/wbthomason/packer.nvim" - }, - ["plenary.nvim"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/plenary.nvim", - url = "https://github.com/nvim-lua/plenary.nvim" - }, - ["popup.nvim"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/popup.nvim", - url = "https://github.com/nvim-lua/popup.nvim" - } -} - -time([[Defining packer_plugins]], false) -if should_profile then save_profiles() end - -end) - -if not no_errors then - error_msg = error_msg:gsub('"', '\\"') - vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') -end diff --git a/nvim/.config/nvim/lua/user/cmp.lua b/nvim/.config/nvim/lua/user/cmp.lua @@ -0,0 +1,126 @@ +local cmp_status_ok, cmp = pcall(require, "cmp") +if not cmp_status_ok then + return +end + +local snip_status_ok, luasnip = pcall(require, "luasnip") +if not snip_status_ok then + return +end + +require("luasnip/loaders/from_vscode").lazy_load() + +local check_backspace = function() + local col = vim.fn.col "." - 1 + return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" +end + +--   פּ ﯟ   some other good icons +local kind_icons = { + Text = "", + Method = "m", + Function = "", + Constructor = "", + Field = "", + Variable = "", + Class = "", + Interface = "", + Module = "", + Property = "", + Unit = "", + Value = "", + Enum = "", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "", + Event = "", + Operator = "", + TypeParameter = "", +} +-- +-- find more here: https://www.nerdfonts.com/cheat-sheet +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = { + ["<C-k>"] = cmp.mapping.select_prev_item(), + ["<C-j>"] = cmp.mapping.select_next_item(), + ["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), + ["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), + ["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), + ["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping. + ["<C-e>"] = cmp.mapping { + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }, + -- Accept currently selected item. If none selected, `select` first item. + -- Set `select` to `false` to only confirm explicitly selected items. + ["<CR>"] = cmp.mapping.confirm { select = true }, + ["<Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif check_backspace() then + fallback() + 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", + }), + }, + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(entry, vim_item) + -- Kind icons + vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) +-- vim_item.kind = string.format('%s', vim_item.kind) -- This concatonates the icons with the name of the item kind + vim_item.menu = ({ + luasnip = "[Snip]", + nvim_lsp = "[LSP]", + buffer = "[Buff]", + path = "[Path]", + })[entry.source.name] + return vim_item + end, + }, + sources = { + { name = 'nvim_lsp' }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "path" }, + }, + confirm_opts = { + behavior = cmp.ConfirmBehavior.Replace, + select = false, + }, + experimental = { + ghost_text = false, + native_menu = false, + }, +} diff --git a/nvim/.config/nvim/lua/user/config.lua b/nvim/.config/nvim/lua/user/config.lua @@ -0,0 +1,54 @@ +local set = vim.opt +local api = vim.api +local keymap = vim.keymap + +local cmd = vim.api.nvim_command +-- General options +set.backup = false +set.swapfile = false + +set.relativenumber = true +set.number = true + +set.hlsearch = true +set.ignorecase = true + +set.syntax = "ON" +set.termguicolors = true + +-- Tab stops because I am not an evel person +set.tabstop = 2 +set.softtabstop = 2 +set.shiftwidth = 2 +set.expandtab = true +set.smartindent = true + +set.scrolloff=8 + +set.colorcolumn="90" + +-- Keymaps +opts = { noremap = true, silent = true } +vim.g.mapleader = " " + +-- Create splits +api.nvim_set_keymap("n", "ss", ":split:<Return><C-w>w", opts) +api.nvim_set_keymap("n", "sv", ":vsplit<Return><C-w>w", opts) +-- Move between split +api.nvim_set_keymap("n", "sh", "<C-w>h", opts) +api.nvim_set_keymap("n", "sk", "<C-w>k", opts) +api.nvim_set_keymap("n", "sj", "<C-w>j", opts) +api.nvim_set_keymap("n", "sl", "<C-w>l", opts) + +api.nvim_set_keymap("n", "<C-p>", ":lua require('telescope.builtin').find_files()<CR>", opts) +api.nvim_set_keymap("n", "<leader>fg", ":lua require('telescope.builtin').live_grep()<CR>", opts) +api.nvim_set_keymap("n", "<leader>fb", ":lua require('telescope.builtin').buffers()<CR>", opts) + +-- Mappings. +-- See `:help vim.diagnostic.*` for documentation on any of the below functions +keymap.set('n', '<space>e', vim.diagnostic.open_float, opts) +keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) +keymap.set('n', ']d', vim.diagnostic.goto_next, opts) +keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts) + +vim.cmd('hi Normal guibg=NONE ctermbg=NONE') diff --git a/nvim/.config/nvim/lua/user/lsp/configs.lua b/nvim/.config/nvim/lua/user/lsp/configs.lua @@ -5,7 +5,7 @@ end local lspconfig = require("lspconfig") -local servers = { "jsonls", "sumneko_lua", "gopls", "solargraph", "jdtls" } +local servers = { "terraformls", "jsonls", "sumneko_lua", "gopls", "solargraph", "jdtls" } lsp_installer.setup { ensure_installed = servers diff --git a/nvim/.config/nvim/lua/user/lsp/init.lua b/nvim/.config/nvim/lua/user/lsp/init.lua @@ -3,6 +3,33 @@ if not status_ok then return end +-- Use an on_attach function to only map the following keys +-- after the language server attaches to the current buffer +local on_attach = function(client, bufnr) + -- Enable completion triggered by <c-x><c-o> + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + + -- Mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local bufopts = { noremap=true, silent=true, buffer=bufnr } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) + vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts) + vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts) + vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts) + vim.keymap.set('n', '<space>wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, bufopts) + vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts) + vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts) + vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) + vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts) +end + require "user.lsp.configs" -require("user.lsp.handlers").setup() +require "user.lsp.handlers".setup() require "user.lsp.null-ls" +require "luasnip/loaders/from_vscode".lazy_load() diff --git a/nvim/.config/nvim/lua/user/neorg.lua b/nvim/.config/nvim/lua/user/neorg.lua @@ -1,20 +0,0 @@ -local status_ok, configs = pcall(require, "neorg") -if not status_ok then - return -end - -configs.setup { - load = { - ["core.defaults"] = {}, - ["core.norg.dirman"] = { - config = { - workspaces = { - work = "~/notes/work", - home = "~/notes/home", - }, - autochdir = true, -- Automatically change the directory to the current workspace's root every time - index = "index.norg", -- The name of the main (root) .norg file - } - } - } -} diff --git a/nvim/.config/nvim/lua/user/plugins.lua b/nvim/.config/nvim/lua/user/plugins.lua @@ -0,0 +1,103 @@ +local fn = vim.fn + +-- Automatically install packer +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, + } + print "Installing packer close and reopen Neovim..." + vim.cmd [[packadd packer.nvim]] +end + +-- Autocommand that reloads neovim whenever you save the plugins.lua file +vim.cmd [[ + augroup packer_user_config + autocmd! + autocmd BufWritePost plugins.lua source <afile> | PackerSync + augroup end +]] + +-- Use a protected call so we don't error out on first use +local status_ok, packer = pcall(require, "packer") +if not status_ok then + return +end + +-- Have packer use a popup window +packer.init { + display = { + open_fn = function() + return require("packer.util").float { border = "rounded" } + end, + }, +} + +-- Install your plugins here +return packer.startup(function(use) + -- My plugins here + use "wbthomason/packer.nvim" -- Have packer manage itself + use "nvim-lua/popup.nvim" -- An implementation of the Popup API from vim in Neovim + use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins + + use "Mofiqul/dracula.nvim" -- Dracula theme + use "morhetz/gruvbox" + use { + 'nvim-lualine/lualine.nvim', requires = { 'kyazdani42/nvim-web-devicons', opt = true } + } + use { + 'lewis6991/gitsigns.nvim', + config = function() + require('gitsigns').setup() end + } + use { + 'kyazdani42/nvim-tree.lua', + requires = { + 'kyazdani42/nvim-web-devicons', -- optional, for file icon + } + } + use { + 'nvim-telescope/telescope.nvim', + requires = { {'nvim-lua/plenary.nvim'} } + } + use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } + + + -- cmp + use "hrsh7th/nvim-cmp" + use "hrsh7th/cmp-buffer" + use "hrsh7th/cmp-path" + use "hrsh7th/cmp-cmdline" + use "saadparwaiz1/cmp_luasnip" + use "hrsh7th/cmp-nvim-lsp" + + --snippets + use "L3MON4D3/LuaSnip" + use "rafamadriz/friendly-snippets" + + use "neovim/nvim-lspconfig" -- enable LSP + use "williamboman/nvim-lsp-installer" -- simple to use language server installer + use "tamago324/nlsp-settings.nvim" -- language server settings defined in json for + use "jose-elias-alvarez/null-ls.nvim" -- for formatters and linters + + use "rhysd/vim-grammarous" + + --treesitter + use { + "nvim-treesitter/nvim-treesitter", + run = 'TSUpdate' + } + + -- neorg + use "vimwiki/vimwiki" + -- Automatically set up your configuration after cloning packer.nvim + -- Put this at the end after all plugins + if PACKER_BOOTSTRAP then + require("packer").sync() + end +end) diff --git a/nvim/.config/nvim/plugin/packer_compiled.lua b/nvim/.config/nvim/plugin/packer_compiled.lua @@ -1,224 +0,0 @@ --- Automatically generated packer.nvim plugin loader code - -if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then - vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') - return -end - -vim.api.nvim_command('packadd packer.nvim') - -local no_errors, error_msg = pcall(function() - - local time - local profile_info - local should_profile = false - if should_profile then - local hrtime = vim.loop.hrtime - profile_info = {} - time = function(chunk, start) - if start then - profile_info[chunk] = hrtime() - else - profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 - end - end - else - time = function(chunk, start) end - end - -local function save_profiles(threshold) - local sorted_times = {} - for chunk_name, time_taken in pairs(profile_info) do - sorted_times[#sorted_times + 1] = {chunk_name, time_taken} - end - table.sort(sorted_times, function(a, b) return a[2] > b[2] end) - local results = {} - for i, elem in ipairs(sorted_times) do - if not threshold or threshold and elem[2] > threshold then - results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' - end - end - - _G._packer = _G._packer or {} - _G._packer.profile_output = results -end - -time([[Luarocks path setup]], true) -local package_path_str = "/Users/msapka/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/msapka/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/msapka/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/msapka/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" -local install_cpath_pattern = "/Users/msapka/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" -if not string.find(package.path, package_path_str, 1, true) then - package.path = package.path .. ';' .. package_path_str -end - -if not string.find(package.cpath, install_cpath_pattern, 1, true) then - package.cpath = package.cpath .. ';' .. install_cpath_pattern -end - -time([[Luarocks path setup]], false) -time([[try_loadstring definition]], true) -local function try_loadstring(s, component, name) - local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) - if not success then - vim.schedule(function() - vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) - end) - end - return result -end - -time([[try_loadstring definition]], false) -time([[Defining packer_plugins]], true) -_G.packer_plugins = { - LuaSnip = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/LuaSnip", - url = "https://github.com/L3MON4D3/LuaSnip" - }, - ["cmp-buffer"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/cmp-buffer", - url = "https://github.com/hrsh7th/cmp-buffer" - }, - ["cmp-cmdline"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/cmp-cmdline", - url = "https://github.com/hrsh7th/cmp-cmdline" - }, - ["cmp-nvim-lsp"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", - url = "https://github.com/hrsh7th/cmp-nvim-lsp" - }, - ["cmp-path"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/cmp-path", - url = "https://github.com/hrsh7th/cmp-path" - }, - cmp_luasnip = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/cmp_luasnip", - url = "https://github.com/saadparwaiz1/cmp_luasnip" - }, - ["dracula.nvim"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/dracula.nvim", - url = "https://github.com/Mofiqul/dracula.nvim" - }, - ["friendly-snippets"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/friendly-snippets", - url = "https://github.com/rafamadriz/friendly-snippets" - }, - ["gitsigns.nvim"] = { - config = { "\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0" }, - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/gitsigns.nvim", - url = "https://github.com/lewis6991/gitsigns.nvim" - }, - gruvbox = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/gruvbox", - url = "https://github.com/morhetz/gruvbox" - }, - ["lualine.nvim"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/lualine.nvim", - url = "https://github.com/nvim-lualine/lualine.nvim" - }, - neorg = { - load_after = {}, - loaded = true, - needs_bufread = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/opt/neorg", - url = "https://github.com/nvim-neorg/neorg" - }, - ["nlsp-settings.nvim"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/nlsp-settings.nvim", - url = "https://github.com/tamago324/nlsp-settings.nvim" - }, - ["null-ls.nvim"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/null-ls.nvim", - url = "https://github.com/jose-elias-alvarez/null-ls.nvim" - }, - ["nvim-cmp"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/nvim-cmp", - url = "https://github.com/hrsh7th/nvim-cmp" - }, - ["nvim-lsp-installer"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/nvim-lsp-installer", - url = "https://github.com/williamboman/nvim-lsp-installer" - }, - ["nvim-lspconfig"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", - url = "https://github.com/neovim/nvim-lspconfig" - }, - ["nvim-tree.lua"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", - url = "https://github.com/kyazdani42/nvim-tree.lua" - }, - ["nvim-treesitter"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/nvim-treesitter", - url = "https://github.com/nvim-treesitter/nvim-treesitter" - }, - ["nvim-web-devicons"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", - url = "https://github.com/kyazdani42/nvim-web-devicons" - }, - ["packer.nvim"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/packer.nvim", - url = "https://github.com/wbthomason/packer.nvim" - }, - ["plenary.nvim"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/plenary.nvim", - url = "https://github.com/nvim-lua/plenary.nvim" - }, - ["popup.nvim"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/popup.nvim", - url = "https://github.com/nvim-lua/popup.nvim" - }, - ["telescope-fzf-native.nvim"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/telescope-fzf-native.nvim", - url = "https://github.com/nvim-telescope/telescope-fzf-native.nvim" - }, - ["telescope.nvim"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/telescope.nvim", - url = "https://github.com/nvim-telescope/telescope.nvim" - }, - ["vim-grammarous"] = { - loaded = true, - path = "/Users/msapka/.local/share/nvim/site/pack/packer/start/vim-grammarous", - url = "https://github.com/rhysd/vim-grammarous" - } -} - -time([[Defining packer_plugins]], false) --- Config for: gitsigns.nvim -time([[Config for gitsigns.nvim]], true) -try_loadstring("\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0", "config", "gitsigns.nvim") -time([[Config for gitsigns.nvim]], false) --- Load plugins in order defined by `after` -time([[Sequenced loading]], true) -vim.cmd [[ packadd nvim-treesitter ]] -vim.cmd [[ packadd neorg ]] -time([[Sequenced loading]], false) -if should_profile then save_profiles() end - -end) - -if not no_errors then - error_msg = error_msg:gsub('"', '\\"') - vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') -end diff --git a/nvim/.config/nvim/plugins.lua b/nvim/.config/nvim/plugins.lua @@ -1,53 +0,0 @@ -local fn = vim.fn - --- Automatically install packer -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, - } - print "Installing packer close and reopen Neovim..." - vim.cmd [[packadd packer.nvim]] -end - --- Autocommand that reloads neovim whenever you save the plugins.lua file -vim.cmd [[ - augroup packer_user_config - autocmd! - autocmd BufWritePost plugins.lua source <afile> | PackerSync - augroup end -]] - --- Use a protected call so we don't error out on first use -local status_ok, packer = pcall(require, "packer") -if not status_ok then - return -end - --- Have packer use a popup window -packer.init { - display = { - open_fn = function() - return require("packer.util").float { border = "rounded" } - end, - }, -} - --- Install your plugins here -return packer.startup(function(use) - -- My plugins here - use "wbthomason/packer.nvim" -- Have packer manage itself - use "nvim-lua/popup.nvim" -- An implementation of the Popup API from vim in Neovim - use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins - - -- Automatically set up your configuration after cloning packer.nvim - -- Put this at the end after all plugins - if PACKER_BOOTSTRAP then - require("packer").sync() - end -end)