Rename Neovim and update README.

This commit is contained in:
Jake Runyan 2024-09-09 17:12:22 -07:00
parent 3f0d7a55e3
commit 77d514d995
10 changed files with 134 additions and 2 deletions

View File

@ -1,2 +1,18 @@
# dotfiles
Dotfiles for various unix tools.
## Alacritty
A terminal that can handle a nerd font. Used alongside lazyvim.
## LazyVim
An upgraded and more powerful Neovim successor, a sequel to runyanjake/nvim.
## Neovim
My nvim configuration for neovim on ubuntu. Sort of superceded by my LazyVim config.
## Oh My Zsh!
A fancier terminal experience.
## Tmux
A tmux configuration for making life in the editor a bit better.

View File

@ -1,5 +1,5 @@
# Alacritty
A terminal that can handle a nerd font.
A terminal that can handle a nerd font. Used alongside lazyvim.
## MacOS
1. Download a release from `https://github.com/alacritty/alacritty/releases` or get it using Homebrew

45
neovim/README.md Normal file
View File

@ -0,0 +1,45 @@
# nvim
My nvim configuration for neovim on ubuntu. Sort of superceded by nvim config.
## Folder Structure
```
~/.config/nvim
|-- init.lua
|-- lua/
| |-- config/
| | |-- aaa.lua
| | |-- bbb.lua
| | |-- ccc.lua
| | |-- ddd.lua
| |-- plugins/
| |-- xxx.lua
| |-- yyy.lua
| :
```
## Instructions
### First Time Setup
1. Install the latest version of Neovim from the Neovim Launchpad PPA. Ubuntu apt has an older version, and since then much has changed, so we'll prefer the latest stable from the PPA.
- `sudo add-apt-repository ppa:neovim-ppa/stable`
- `sudo apt update`
- `sudo apt install neovim`
2. Ensure that the nvim runtimepath is correctly configured to include `~/.config.nvim`.
You can check that by executing this nvim command: `:echo &runtimepath`.
3. Both `init.lua` as well as the `lua/` folder and its contents should be symlinked to `~/.config/nvim` (Might need to create the nvim folder if first time).
- `ln -sfn /path/to/dotfiles/nvim/init.lua ~/.config/nvim/init.lua`
- `ln -sfn /path/to/dotfiles/nvim/lua ~/.config/nvim/lua`
The next time vim is opened, the config changes will apply.
### Configuration
Configuration files live in lua/config.
The template I am using splits things up logically into a few lua files, that are all included in the top-level init.lua.
### Plugins
Plugins live in lua/plugins.
Plugins can either be manually included in init.lua or managed by lazy nvim.
Each plugin gets its own lua file in there, and lazy or manual edits to init.lua can be used to configure what's enabled.
## References
https://m4xshen.dev/posts/build-your-modern-neovim-config-in-lua (Using their folder structure.)

11
neovim/init.lua Normal file
View File

@ -0,0 +1,11 @@
-- config files
require("config.options")
require("config.mappings")
require("config.autocmds")
-- lazy nvim plugin manager
-- require("config.lazy")
-- manual inclusion of plugins
require("plugins.helloWorld")

View File

@ -0,0 +1,20 @@
-- set tab to 4 space when entering a buffer with .java file
vim.api.nvim_create_autocmd("BufEnter", {
pattern = { "*.java" },
callback = function()
vim.opt.shiftwidth = 4
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
end
})
-- set tab to 2 space when entering a buffer with .yml file
vim.api.nvim_create_autocmd("BufEnter", {
pattern = { "*.yml" },
callback = function()
vim.opt.shiftwidth = 2
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
end
})

View File

@ -0,0 +1,17 @@
-- install lazy.nvim
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", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- load plugins
require("lazy").setup("plugins")

View File

@ -0,0 +1,6 @@
-- set <LEADER> key for nvim (effectively layer key for shortcuts in nvim)
vim.g.mapleader = ","
-- map leader+y to copy to system clipboard in normal mode
vim.keymap.set({ "n", "v" }, "<Leader>y", '"+y', { noremap = true, silent = true })

View File

@ -0,0 +1,8 @@
-- enable line number and relative line number
vim.opt.number = true
-- width of a tab
vim.opt.shiftwidth = 2
vim.opt.tabstop = 2
vim.opt.softtabstop = 2

View File

@ -0,0 +1,10 @@
-- hello.lua
-- Define a function that prints a greeting
local function hello_world()
print("Hello, Neovim!")
end
-- Create a command ":SayHello" that runs the say_hello function
vim.api.nvim_create_user_command('HelloWorld', hello_world, {})

1
nvim

@ -1 +0,0 @@
Subproject commit 341a1e165238a1625cd575d108a247091868ddf4