| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- -- === === === === === === === === Neovim Config === === === === === === === ===
- --
- -- A configuration for Neovim that aims to be beautiful, intuitive, and
- -- pragmatic about plugin usage, while providing a developer experience on par
- -- with professional IDEs. It is tuned for usage with a custom keyboard
- -- layout and terminal configuration, and may not be as useful in other setups.
- --
- -- This configuration leverages a combination of keymaps and omnibars to give
- -- quick access to a large amount of functionality in an intuitive way. Most
- -- keymaps are unchanged from stock Neovim, with the notable exception of
- -- remapping most `s<a-Z>` keymaps.
- --
- -- === === === === === === === === === === === === === === === === === === ===
- --
- -- Core Options
- --
- -- === === === === === === === === === === === === === === === === === === ===
- -- Incantation to render correctly in Alacritty/tmux/macOS
- vim.cmd([[
- let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
- let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
- set termguicolors
- ]])
- -- File options
- vim.opt.wrap = false
- vim.opt.encoding = "UTF-8"
- vim.opt.hlsearch = true
- vim.opt.spell = true
- vim.opt.spelllang = "en_us"
- -- Display options
- vim.opt.pumheight = 15
- vim.opt.laststatus = 2
- vim.opt.showtabline = 2
- vim.opt.showcmd = true
- vim.opt.cmdheight = 0
- vim.opt.number = true
- vim.opt.relativenumber = true
- vim.opt.splitbelow = true
- vim.opt.splitright = true
- vim.opt.expandtab = true
- vim.opt.tabstop = 4
- vim.opt.shiftwidth = 4
- -- === === === === === === === === === === === === === === === === === === ===
- --
- -- Lazy.nvim Configuration
- --
- -- `lazy.nvim` is a modern plugin manager for Neovim.
- --
- -- === === === === === === === === === === === === === === === === === === ===
- -- Bootstrapping `lazy`, as directed by GitHub docs:
- -- https://github.com/folke/lazy.nvim#-installation
- 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", lazypath
- })
- end
- vim.opt.rtp:prepend(lazypath)
- -- Add custom plugins to the runtimepath via lazy.
- local custom_runtime_path_root = vim.fn.stdpath("config") .. "/custom"
- local custom_runtime_paths = {}
- for _, filename in pairs(vim.split(vim.fn.glob(custom_runtime_path_root .. "/*"),
- "\n")) do
- table.insert(custom_runtime_paths, filename)
- end
- -- Load plugins
- require("lazy").setup("plugins", {
- performance = { rtp = { paths = custom_runtime_paths } },
- change_detection = { enabled = false },
- defaults = { lazy = false }
- })
- -- === === === === === === === === === === === === === === === === === === ===
- --
- -- Keymaps
- --
- -- === === === === === === === === === === === === === === === === === === ===
- -- Use `Alt-Arrow` to navigate between panes
- vim.keymap.set("i", "<A-left>", "<C-\\><C-N><C-w>W")
- vim.keymap.set("i", "<A-right>", "<C-\\><C-N><C-w>w")
- vim.keymap.set("i", "<S-A-left>", "<C-\\><C-N>:tabnext<CR>")
- vim.keymap.set("i", "<S-A-right>", "<C-\\><C-N>:tabprevious<CR>")
- vim.keymap.set("n", "<A-left>", "<C-w>W")
- vim.keymap.set("n", "<A-right>", "<C-w>w")
- vim.keymap.set("n", "<S-A-left>", ":tabnext<CR>")
- vim.keymap.set("n", "<S-A-right>", ":tabprevious<CR>")
- -- Folds toggled by homerow roll
- vim.keymap.set("n", "sr", ": normal za<CR>")
- -- Buffer actions
- vim.keymap.set("n", "SV", ":vsp<CR>")
- vim.keymap.set("n", "SQ", ":q<CR>")
- vim.keymap.set("n", "SH", ":noh<CR>")
- -- Yank to system clipboard
- vim.keymap.set({ "n", 'v' }, "Y", "\"+y")
- -- Yank file properties to system clipboard
- local yank_filename = function(full, line)
- local filename = vim.fn.expand("%")
- if full then filename = vim.fn.expand("%:p") end
- if line then filename = filename .. ":" .. vim.api.nvim_win_get_cursor(0)[1] end
- vim.fn.setreg("+", filename)
- end
- vim.keymap.set("n", "Syan", function() yank_filename(true, false) end)
- vim.keymap.set("n", "Syal", function() yank_filename(true, true) end)
- vim.keymap.set("n", "Syrn", function() yank_filename(false, false) end)
- vim.keymap.set("n", "Syrl", function() yank_filename(false, true) end)
- vim.keymap.set("n", "Syf", function() yank_filename(false, false) end)
|