diff options
Diffstat (limited to 'lua/config')
-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 |
7 files changed, 284 insertions, 0 deletions
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" |