Skip to content

Commit

Permalink
Initial Commit. Should work out of the box.
Browse files Browse the repository at this point in the history
  • Loading branch information
FilBot3 committed Jan 8, 2022
0 parents commit 7f2b099
Show file tree
Hide file tree
Showing 8 changed files with 879 additions and 0 deletions.
639 changes: 639 additions & 0 deletions .gitignore

Large diffs are not rendered by default.

73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Phil's Neovim Configurations

## Overview

Using Neovim's Lua interface, download and manage plugins, and configure Neovim.

## Requirements

* Git SCM
* NodeJS with NPM and Yarnpkg
* Neovim 0.6.0 or newer
* ripgrep
* fd-find
* Windows doesn't seem to need this?

For other languages, you'll need to have the various runtimes and other tools in
your PATH so that Neovim can start them up for the language servers and other
tools.

### References

* [Neovim :h lua](https://neovim.io/doc/user/lua.html)
* [nanotee/nvim-lua-guide](https://github.com/nanotee/nvim-lua-guide)
* [packer.nvim](https://github.com/wbthomason/packer.nvim)
* [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)
* [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
* [GitHub: albingroen/quick.nvim](https://github.com/albingroen/quick.nvim)
* [GitHub: LunarVim/LunarVim](https://github.com/LunarVim/LunarVim)
* [SpaceVim.org](https://spacevim.org/)

## Setup

### Clone the Neovim Config

Clone the repository into your `$XDG_CONFIG_DIR/nvim` for Linux or
`$env:LOCALAPPDATA/nvim` for Windows.

```bash
git clone git@github.com/FilBot3/neovim-config \
~/.config/nvim
```

### Setup packer.nvim

Upon first run, if Packer for Neovim is not found, it will automatically
bootstrap/download the plugin. Then you should be able to run

```vimscript
:PackerInstall
```

Otherwise install using the instructions listed on the GitHub Page. Which will
download all the plugins. I exit Neovim and restart just to be safe.

### Setup Neovim lsps

A plugin called `williamboman/nvim-lsp-installer` will allow ther user to
install various language servers. They have a list on their GitHub README, so
check that out.

## Usage

Now that this has all been setup. Simply execute `nvim` and all the
configurations should be available. You'll need to install the various language
servers still.

I think if you want to use this without technically impacting your current
setup, you could probably clone this into a different repository and then
specify the init.lua to load.

```bash
nvim -S ~/.phil/init.lua
```
79 changes: 79 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
-- Neovim init.lua

-- Load Packer.nvim plugins.
require('packer-plugins')

-- Enable Spell Checking
vim.opt.spell = true
-- Set default Spelling Language
vim.opt.spelllang = 'en_us'
-- Show line numbers.
vim.opt.number = true
-- Show the number relative to the cursor.
vim.opt.relativenumber = true
-- Horizontal Splits go below
vim.opt.splitbelow = true
-- Vertical Splits go to the right
vim.opt.splitright = true
-- stop vi compatibility.
vim.cmd([[set nocompatible]])
-- Set the ruler at 80 characters.
vim.opt.colorcolumn = {80}
-- When pressing tab, default to 2 presses of either tab or space.
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
-- Make tabs spaces.
vim.opt.expandtab = true
-- When moving or shifting lines, how far to shift them in spaces.
vim.opt.shiftwidth = 2
-- Netrw configuration. Use menu style 3.
vim.cmd([[let g:netrw_liststyle = 3]])
vim.cmd([[filetype indent plugin on]])
-- Enable Syntax Highlighting
vim.opt.syntax = "on"
-- Show the Vim Commands in the bottom statusline
vim.opt.showcmd = true
-- Highlight the currently line the cursor is on.
vim.opt.cursorline = true
-- Set the colortheme.
vim.cmd([[colorscheme deus]])
-- make vim-deus' background none or transparent.
vim.cmd([[hi Normal cterm=NONE ctermbg=NONE]]) -- Transparent Background.
-- Enable folding. Just don't set the foldmethod
vim.opt.foldenable = true
-- When a line is broken, follow indent.
vim.opt.breakindent = true
-- Show matching characters, like () and [] for example.
vim.opt.showmatch = true
-- Perform increment searches.
vim.opt.incsearch = true
-- Highlight the searches.
vim.opt.hlsearch = true
-- Ignore case when searching.
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- This enables the menu when issuing a Neovim command.
vim.opt.wildmenu = true
-- ALE must be installed. I'll figure out some sort of logic for this so it
-- doesn't fail.
-- Press \aj to go to the next issue ALE has detected.
vim.api.nvim_set_keymap('n', '<leader>aj', ':ALENext<cr>', {noremap = true, silent = true})
-- Press \ak to go to the previous issue ALE has detected.
vim.api.nvim_set_keymap('n', '<leader>ak', ':ALEPrevious<cr>', {noremap = true, silent = true})
-- Goyo's max width.
vim.cmd([[let g:goyo_width = 90]])
-- Configure vim-airline
vim.cmd([[
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
]])
-- Remove any trailing spaces before writing a file.
vim.api.nvim_exec([[
autocmd BufWritePre * %s/\s\+$//e
]], true)

require('telescope-configs')

require('lsp-configs')

require('nvim-cmp-configs')
10 changes: 10 additions & 0 deletions lua/lsp-configs.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- nvim-lspconfig.
-- Requires NodeJS and npm to be available in your PATH.
-- @see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md


require'lspconfig'.bashls.setup{}
require'lspconfig'.dockerls.setup{}
require'lspconfig'.eslint.setup{}
require'lspconfig'.jsonls.setup{}
require'lspconfig'.yamlls.setup{}
13 changes: 13 additions & 0 deletions lua/nvim-cmp-configs.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- nvim-cmp Configs
require('cmp').setup({
sources = {
{ name = 'buffer' },
{ name = 'nvim_lsp' },
{ name = 'path' },
},
})
require'cmp'.setup.cmdline('/', {
sources = {
{ name = 'buffer' }
}
})
42 changes: 42 additions & 0 deletions lua/packer-plugins.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
-- Packer Configurations and Plugins.
-- @see https://github.com/wbthomason/packer.nvim

-- Bootstrap Packer
local fn = vim.fn
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})
end

-- Load the Packer plugin package.
vim.cmd([[packadd packer.nvim]])

-- configure packer and specify plugins from GitHub.
return require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
use 'dense-analysis/ale'
use 'nvim-telescope/telescope.nvim'
use 'nvim-lua/plenary.nvim'
use 'neovim/nvim-lspconfig'
use 'ajmwagar/vim-deus'
use 'aserebryakov/vim-todo-lists'
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-cmdline'
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-path'
use 'junegunn/goyo.vim'
use 'ludovicchabant/vim-gutentags'
use 'mzlogin/vim-markdown-toc'
use 'nvim-treesitter/nvim-treesitter'
use 'sotte/presenting.vim'
use 'tpope/vim-endwise'
use 'tpope/vim-fugitive'
use 'vim-airline/vim-airline'
use 'williamboman/nvim-lsp-installer'

-- part of the packer initial setup.
if packer_bootstrap then
require('packer').sync()
end
end)
18 changes: 18 additions & 0 deletions lua/telescope-configs.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- Telescope Keybindings
vim.api.nvim_exec([[
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
]], true)

-- Telescope Configurations
require('telescope').setup({
defaults = {
layout_config = {},
-- other default configs.
},
pickers = {},
extensions = {},
-- other configuration values here
})
5 changes: 5 additions & 0 deletions lua/tools.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- $XDG_CONFIG_DIR/nvim/lua/tools.lua
local M = {}
function M.makeScratch()
end
return M

0 comments on commit 7f2b099

Please sign in to comment.