diff options
-rw-r--r-- | lua/bootstrap.lua | 27 | ||||
-rw-r--r-- | lua/config/impatient.lua | 7 | ||||
-rw-r--r-- | lua/config/init.lua | 22 | ||||
-rw-r--r-- | lua/config/lsp/settings/jsonls.lua | 25 | ||||
-rw-r--r-- | lua/config/nvim-tree.lua | 136 | ||||
-rw-r--r-- | lua/config/orgmode.lua | 21 | ||||
-rw-r--r-- | lua/config/packer.lua | 23 | ||||
-rw-r--r-- | lua/config/project.lua | 50 | ||||
-rw-r--r-- | lua/install.lua | 19 | ||||
-rw-r--r-- | lua/plugins.lua | 68 |
10 files changed, 398 insertions, 0 deletions
diff --git a/lua/bootstrap.lua b/lua/bootstrap.lua new file mode 100644 index 0000000..7341865 --- /dev/null +++ b/lua/bootstrap.lua @@ -0,0 +1,27 @@ +-- Bootstrap nvim with essential plugins. +local fn = vim.fn +local fmt = string.format +local execute = vim.api.nvim_command + +local function ensure(user, repository) + local packer_path = fn.stdpath "data" .. "/site/pack" + local ensure_path = fmt("%s/packer/start/%s", packer_path, repository) + if fn.empty(fn.glob(ensure_path)) > 0 then + PACKER_BOOTSTRAP = execute( + fmt( + "!git clone --depth 1 https://github.com/%s/%s %s", + user, + repository, + ensure_path + ) + ) + execute(fmt("packadd %s", repository)) + end +end + +-- Bootstrap install essential modules if not present +ensure("wbthomason", "packer.nvim") +ensure("lewis6991", "impatient.nvim") + +-- Enable faster loading with impatient +require "config.impatient" diff --git a/lua/config/impatient.lua b/lua/config/impatient.lua new file mode 100644 index 0000000..431d785 --- /dev/null +++ b/lua/config/impatient.lua @@ -0,0 +1,7 @@ +-- Speeds up loading of lua modules. +local status_ok, impatient = pcall(require, "impatient") +if not status_ok then + return +end + +impatient.enable_profile() diff --git a/lua/config/init.lua b/lua/config/init.lua new file mode 100644 index 0000000..0349929 --- /dev/null +++ b/lua/config/init.lua @@ -0,0 +1,22 @@ +-- Loads all plugin configs. + +require "config.alpha" +require "config.autocommands" +require "config.autopairs" +require "config.bufferline" +require "config.cmp" +require "config.colorizer" +require "config.colorscheme" +require "config.comment" +require "config.gitsigns" +require "config.hop" +require "config.lualine" +require "config.lsp" +require "config.nvim-tree" +require "config.orgmode" +require "config.project" +require "config.spectre" +require "config.telescope" +require "config.treesitter" +require "config.whichkey" +require "config.zen" diff --git a/lua/config/lsp/settings/jsonls.lua b/lua/config/lsp/settings/jsonls.lua new file mode 100644 index 0000000..6372822 --- /dev/null +++ b/lua/config/lsp/settings/jsonls.lua @@ -0,0 +1,25 @@ +-- A Json language server config. +local status_ok, schemastore = pcall(require, "schemastore") +if not status_ok then + return +end + +return { + init_options = { + provideFormatter = false, + }, + settings = { + json = { + schemas = schemastore.json.schemas(), + }, + }, + setup = { + commands = { + Format = { + function() + vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 }) + end, + }, + }, + }, +} diff --git a/lua/config/nvim-tree.lua b/lua/config/nvim-tree.lua new file mode 100644 index 0000000..bae27b4 --- /dev/null +++ b/lua/config/nvim-tree.lua @@ -0,0 +1,136 @@ +-- A file explorer. + +vim.g.nvim_tree_icons = { + default = "", + symlink = "", + git = { + unstaged = "", + staged = "S", + unmerged = "", + renamed = "➜", + deleted = "", + untracked = "U", + ignored = "◌", + }, + folder = { + default = "", + open = "", + empty = "", + empty_open = "", + symlink = "", + }, +} + +local status_ok, nvim_tree = pcall(require, "nvim-tree") +if not status_ok then + return +end + +local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") +if not config_status_ok then + return +end + +local tree_cb = nvim_tree_config.nvim_tree_callback + +nvim_tree.setup { + auto_reload_on_write = true, + disable_netrw = false, + hide_root_folder = false, + hijack_cursor = false, + hijack_netrw = true, + hijack_unnamed_buffer_when_opening = false, + ignore_buffer_on_setup = false, + open_on_setup = false, + open_on_tab = false, + sort_by = "name", + update_cwd = true, + view = { + width = 30, + height = 30, + side = "left", + preserve_window_proportions = false, + number = false, + relativenumber = false, + signcolumn = "yes", + mappings = { + custom_only = false, + list = { + { key = { "l", "<CR>", "o" }, cb = tree_cb "edit" }, + { key = "h", cb = tree_cb "close_node" }, + { key = "v", cb = tree_cb "vsplit" }, + }, + }, + }, + hijack_directories = { + enable = true, + auto_open = true, + }, + update_focused_file = { + enable = true, + update_cwd = true, + ignore_list = {}, + }, + ignore_ft_on_setup = { + "startify", + "dashboard", + "alpha", + }, + system_open = { + cmd = nil, + args = {}, + }, + diagnostics = { + enable = true, + show_on_dirs = false, + icons = { + hint = "", + info = "", + warning = "", + error = "", + }, + }, + filters = { + dotfiles = false, + custom = {}, + exclude = {}, + }, + git = { + enable = true, + ignore = true, + timeout = 400, + }, + actions = { + change_dir = { + enable = true, + global = false, + }, + open_file = { + quit_on_open = false, + resize_window = false, + window_picker = { + enable = true, + chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", + exclude = { + filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" }, + buftype = { "nofile", "terminal", "help" }, + }, + }, + }, + }, + trash = { + cmd = "trash", + require_confirm = true, + }, + log = { + enable = false, + truncate = false, + types = { + all = false, + config = false, + copy_paste = false, + git = false, + profile = false, + }, + }, +} diff --git a/lua/config/orgmode.lua b/lua/config/orgmode.lua new file mode 100644 index 0000000..5b88793 --- /dev/null +++ b/lua/config/orgmode.lua @@ -0,0 +1,21 @@ +-- Orgmode for nvim +local status_ok, orgmode = pcall(require, "orgmode") +if not status_ok then + return +end + +-- Load custom tree-sitter grammar for org filetype +orgmode.setup_ts_grammar() + +orgmode.setup { + org_agenda_files = { "~/.local/share/org/**/*" }, + org_default_notes_file = "~/.local/share/org/refile.org", + org_agenda_templates = { + t = { description = "Task", template = "* TODO %?\n %u" }, + m = { + description = "Meeting", + template = "* MEETING %? :MEETING:\n :LOGBOOK:\n CLOCK: %U\n :END:", + }, + n = { description = "Note", template = "* NOTE %? :NOTE:\n %u" }, + }, +} diff --git a/lua/config/packer.lua b/lua/config/packer.lua new file mode 100644 index 0000000..9302149 --- /dev/null +++ b/lua/config/packer.lua @@ -0,0 +1,23 @@ +local status_ok, packer = pcall(require, "packer") +if not status_ok then + return +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 +]] + +-- Have packer use a popup window +packer.init { + display = { + open_fn = function() + return require("packer.util").float { border = "rounded" } + end, + }, +} + +return packer diff --git a/lua/config/project.lua b/lua/config/project.lua new file mode 100644 index 0000000..60ba3a8 --- /dev/null +++ b/lua/config/project.lua @@ -0,0 +1,50 @@ +-- Provides project management. +local status_ok, project = pcall(require, "project_nvim") +if not status_ok then + return +end + +project.setup { + ---@usage set to false to disable project.nvim. + --- This is on by default since it's currently the expected behavior. + active = true, + + on_config_done = nil, + + ---@usage set to true to disable setting the current-woriking directory + --- Manual mode doesn't automatically change your root directory, so you have + --- the option to manually do so using `:ProjectRoot` command. + manual_mode = false, + + ---@usage Methods of detecting the root directory + --- Allowed values: **"lsp"** uses the native neovim lsp + --- **"pattern"** uses vim-rooter like glob pattern matching. Here + --- order matters: if one is not detected, the other is used as fallback. You + --- can also delete or rearangne the detection methods. + -- detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project + detection_methods = { "pattern" }, + + ---@usage patterns used to detect root dir, when **"pattern"** is in detection_methods + patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" }, + + ---@ Show hidden files in telescope when searching for files in a project + show_hidden = false, + + ---@usage When set to false, you will get a message when project.nvim changes your directory. + -- When set to false, you will get a message when project.nvim changes your directory. + silent_chdir = true, + + ---@usage list of lsp client names to ignore when using **lsp** detection. eg: { "efm", ... } + ignore_lsp = {}, + + ---@type string + ---@usage path to store the project history for use in telescope + datapath = vim.fn.stdpath "data", +} + +local tele_status_ok, telescope = pcall(require, "telescope") +if not tele_status_ok then + return +end + +telescope.load_extension "projects" diff --git a/lua/install.lua b/lua/install.lua new file mode 100644 index 0000000..75e0239 --- /dev/null +++ b/lua/install.lua @@ -0,0 +1,19 @@ +-- Installs plugins with packer. +local plugins = require "plugins" + +require "bootstrap" + +local packer = require "config.packer" + +-- Install your plugins here +return packer.startup(function(use) + for _, plugin in ipairs(plugins) do + use(plugin) + end + + -- Automatically set up your configuration after cloning packer.nvim + -- Put this at the end after all plugins + if PACKER_BOOTSTRAP then + packer.sync() + end +end) diff --git a/lua/plugins.lua b/lua/plugins.lua new file mode 100644 index 0000000..824bd3d --- /dev/null +++ b/lua/plugins.lua @@ -0,0 +1,68 @@ +-- List of plugins + +return { + -- Base + { "wbthomason/packer.nvim" }, -- Have packer manage itself + { "nvim-lua/popup.nvim" }, -- An implementation of the Popup API from vim in Neovim + { "nvim-lua/plenary.nvim" }, -- Useful lua functions used ny lots of plugins + + -- Colorschemes + { "aktersnurra/no-clown-fiesta.nvim" }, + + -- LSP + { "hrsh7th/nvim-cmp" }, -- The completion plugin + { "hrsh7th/cmp-buffer" }, -- buffer completions + { "hrsh7th/cmp-path" }, -- path completions + { "hrsh7th/cmp-cmdline" }, -- cmdline completions + { "saadparwaiz1/cmp_luasnip" }, -- snippet completions + { "hrsh7th/cmp-nvim-lsp" }, + { "neovim/nvim-lspconfig" }, + { "williamboman/nvim-lsp-installer" }, + { "tamago324/nlsp-settings.nvim" }, + { "jose-elias-alvarez/null-ls.nvim" }, + { "b0o/SchemaStore.nvim" }, + + -- Snippets + { "L3MON4D3/LuaSnip" }, + { "rafamadriz/friendly-snippets" }, + + -- Telescope + { "nvim-telescope/telescope.nvim", requires = { { "nvim-lua/plenary.nvim" } } }, + { "nvim-telescope/telescope-fzf-native.nvim", run = "make" }, + { "nvim-telescope/telescope-file-browser.nvim" }, + + -- Treesitter + { + "nvim-treesitter/nvim-treesitter", + run = ":TSUpdate", + }, + { "JoosepAlviste/nvim-ts-context-commentstring" }, + { "nvim-treesitter/playground" }, + + -- Miscellaneous plugins + { "windwp/nvim-autopairs" }, + { "numToStr/Comment.nvim" }, + { "lewis6991/gitsigns.nvim" }, + { "kyazdani42/nvim-web-devicons" }, + { "kyazdani42/nvim-tree.lua" }, + { "akinsho/bufferline.nvim" }, + { "moll/vim-bbye" }, + { + "nvim-lualine/lualine.nvim", + requires = { "kyazdani42/nvim-web-devicons", opt = true }, + }, + { "ahmedkhalf/project.nvim" }, + { "lewis6991/impatient.nvim" }, + { "goolord/alpha-nvim" }, + { "antoinemadec/FixCursorHold.nvim" }, -- This is needed to fix lsp doc highlight + { "folke/which-key.nvim" }, + { "folke/zen-mode.nvim" }, + { "windwp/nvim-spectre" }, + { "phaazon/hop.nvim" }, + { + "kevinhwang91/nvim-bqf", + event = "BufRead", + }, + { "norcalli/nvim-colorizer.lua" }, + { "nvim-orgmode/orgmode" }, +} |