Last active
March 6, 2021 03:00
-
-
Save mhanberg/ccb54e163084d549753cb7d37860bba8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- We're going to install the package manager, packer.nvim | |
-- It is based on (n)vims native package management | |
-- Let's install it into ~/.local/share/nvim | |
local install_path = vim.fn.stdpath("data").."/site/pack/packer/opt/packer.nvim" | |
-- If it's not already installed, let's download it | |
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then | |
vim.api.nvim_command.execute("!git clone https://github.com/wbthomason/packer.nvim "..install_path) | |
end | |
-- packadd is a vim command. We add packer.nvim to our runtime path | |
-- so we can use it | |
vim.cmd [[packadd packer.nvim]] | |
-- We require the "packer" module from packer.nvim and | |
-- call it's startup function. This takes a closure that | |
-- is passed a function to use to initialize a plugin | |
require("packer").startup(function(use) | |
-- We can manage packer.nvim with packer.nvim | |
use {"wbthomason/packer.nvim", opt = true} | |
-- Tim Pope plugin with some sensible defaults | |
use "tpope/vim-sensible" | |
-- Let's install fzf. `run` is a callback used to install the fzf | |
-- executable. This can be optional if you are installing fzf another | |
-- way. | |
use {"junegunn/fzf", | |
run = function() | |
vim.fn["fzf#install"]() | |
end} | |
use "junegunn/fzf.vim" | |
-- Treesitter. Will run the TSUpdate command when installing | |
-- and updating. This will download any parsers and update them if | |
-- there are newer versions. | |
use { | |
"nvim-treesitter/nvim-treesitter", | |
run = function() | |
vim.cmd [[TSUpdate]] | |
end} | |
end) | |
-- The next few items here are copied from this article | |
-- https://oroques.dev/notes/neovim-init/#set-options | |
-- They merely provide some convenience functions | |
local scopes = {o = vim.o, b = vim.bo, w = vim.wo} | |
local function opt(scope, key, value) | |
scopes[scope][key] = value | |
if scope ~= 'o' then scopes['o'][key] = value end | |
end | |
local function map(mode, lhs, rhs, opts) | |
local options = {noremap = true} | |
if opts then options = vim.tbl_extend('force', options, opts) end | |
vim.api.nvim_set_keymap(mode, lhs, rhs, options) | |
end | |
vim.cmd [[autocmd FileType make setlocal noexpandtab]] | |
opt("o", "background", "light") | |
opt("o", "showmatch", true) | |
opt("b", "smartindent", true) | |
opt("b", "tabstop", 4) | |
opt("b", "shiftwidth", 4) | |
opt("b", "expandtab", true) | |
opt("w", "number", true) | |
opt("o", "termguicolors", true) | |
opt("o", "splitbelow", true) | |
opt("o", "splitright", true) | |
opt("o", "lazyredraw", true) | |
opt("o", "showmode", false) | |
opt("o", "ignorecase", true) | |
opt("o", "smartcase", true) | |
opt("o", "inccommand", "nosplit") | |
opt("o", "ruler", true) | |
map("n", "<c-p>", ":Files<cr>", {silent = true, noremap = true}) | |
-- You can find the full documentation here: https://github.com/nvim-treesitter/nvim-treesitter | |
local ts = require 'nvim-treesitter.configs' | |
ts.setup {ensure_installed = "maintained", highlight = {enable = true}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Once you open up neovim, you need to run
:PackerInstall
and then can restart neovim and everything should be loaded