feat(neovim): from scratch!

This commit is contained in:
2024-10-07 21:48:03 +01:00
parent e0fc7e698c
commit 7080c2325f
8 changed files with 262 additions and 2 deletions

13
dotfiles.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=Dotfile manager service.
After=network.target
After=systemd-user-sessions.service
After=network-online.target
[Service]
User=john
WorkingDirectory=~
ExecStart=Code/dotfiles/scripts/manager.bash
[Install]
WantedBy=multi-user.target

12
nvim/init.lua Normal file
View File

@ -0,0 +1,12 @@
require("./mappings")
require("./lazy")
-- Guard (Linters + Formatters)
vim.g.guard_config = {
fmt_on_save = true,
lsp_as_default_formatter = true,
save_on_fmt = true,
}
-- Sync system clipboard and neovim register
vim.opt.clipboard = { "unnamedplus" }

13
nvim/lazy-lock.json Normal file
View File

@ -0,0 +1,13 @@
{
"guard-collection": { "branch": "main", "commit": "06da4a065b974bbedf1a5535232c90a3526f8a43" },
"guard.nvim": { "branch": "main", "commit": "bdbc43dadd530b0058708723db76e705a4542063" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" },
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
"nvim-lspconfig": { "branch": "master", "commit": "38da5bbe1eaab2394056109e48c7e195bdb8fdfe" },
"nvim-treesitter": { "branch": "master", "commit": "0179a89656b4ce395a4487c07ae385b8425524ae" },
"nvim-web-devicons": { "branch": "master", "commit": "f0267921c845c42685968401bc49aa65e18d3e09" },
"nvim-window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" },
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
"telescope.nvim": { "branch": "master", "commit": "74ce793a60759e3db0d265174f137fb627430355" }
}

18
nvim/lazy.lua Normal file
View File

@ -0,0 +1,18 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup("plugins")

83
nvim/lua/plugins/init.lua Normal file
View File

@ -0,0 +1,83 @@
return {
{
"nvimdev/guard.nvim",
-- Builtin configuration, optional
dependencies = {
"nvimdev/guard-collection",
},
config = function()
local ft = require("guard.filetype")
ft("lua"):fmt("lsp"):append("stylua")
ft("typescript,javascript,typescriptreact"):fmt("prettierd"):lint("eslint_d")
end,
},
{
"nvim-telescope/telescope.nvim",
tag = "0.1.x",
dependencies = { "nvim-lua/plenary.nvim" },
},
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
local configs = require("nvim-treesitter.configs")
configs.setup({
ensure_installed = { "lua", "javascript", "typescript", "html" },
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
})
end,
},
{
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim",
{
"s1n7ax/nvim-window-picker",
version = "2.*",
config = function()
require("window-picker").setup({
filter_rules = {
include_current_win = false,
autoselect_one = true,
-- filter using buffer options
bo = {
-- if the file type is one of following, the window will be ignored
filetype = { "neo-tree", "neo-tree-popup", "notify" },
-- if the buffer type is one of following, the window will be ignored
buftype = { "terminal", "quickfix" },
},
},
})
end,
},
},
config = function()
require("neo-tree").setup({
close_if_last_window = false,
})
end,
},
{
"neovim/nvim-lspconfig",
config = function()
require("lspconfig").lua_ls.setup({
settings = {
Lua = {
diagnostics = { globals = { "vim", "require" } },
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
},
},
})
end,
},
}

22
nvim/mappings.lua Normal file
View File

@ -0,0 +1,22 @@
vim.g.mapleader = " "
-- Save --
vim.keymap.set("n", "<C-s>", "<Cmd>w<CR>")
-- Split navigation --
vim.keymap.set("n", "<C-h>", "<C-w>h")
vim.keymap.set("n", "<C-j>", "<C-w>j")
vim.keymap.set("n", "<C-k>", "<C-w>k")
vim.keymap.set("n", "<C-l>", "<C-w>l")
-- Buffers --
vim.keymap.set("n", "<leader>x", "<Cmd>bd<CR>")
-- Telescope Mappings --
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Telescope find files" })
vim.keymap.set("n", "<leader>fw", builtin.live_grep, { desc = "Telescope live grep" })
-- Neo Tree --
vim.keymap.set("n", "<C-n>", "<Cmd> Neotree toggle <CR>")
vim.keymap.set("n", "<leader>e", "<Cmd> Neotree focus <CR>")

4
scripts/manager.bash Normal file → Executable file
View File

@ -1,9 +1,9 @@
#!/bin/bash
cd ~/Code/dotfiles
git pull
folders=("hypr" "ags" "tmux" "lazygit" "kitty" "fish")
cd ..
for folder in ${folders[@]}; do
echo Moving $folder
rsync -a ./$folder/ ~/.config/$folder

99
starship.toml Normal file
View File

@ -0,0 +1,99 @@
# Don't print a new line at the start of the prompt
add_newline = false
# Pipes ╰─ ╭─
# Powerline symbols                                   
# Wedges 🭧🭒 🭣🭧🭓
# Random noise 🬖🬥🬔🬗
# format = """
# $cmd_duration$username$hostname $directory $git_branch
# $character
# """
format = """
$cmd_duration$directory $git_branch
$character
"""
# Replace the "" symbol in the prompt with "➜"
[character] # The name of the module we are configuring is "character"
success_symbol = "[• ](bold fg:green) "
error_symbol = "[• 󰅙](bold fg:red) "
# Disable the package module, hiding it from the prompt completely
[package]
disabled = true
[git_branch]
style = "bg: green"
symbol = "󰘬"
truncation_length = 4
truncation_symbol = ""
format = "• [](bold fg:green)[$symbol $branch(:$remote_branch)](fg:black bg:green)[ ](bold fg:green)"
[git_commit]
commit_hash_length = 4
tag_symbol = " "
[git_state]
format = '[\($state( $progress_current of $progress_total)\)]($style) '
cherry_pick = "[🍒 PICKING](bold red)"
[git_status]
conflicted = " 🏳 "
ahead = " 🏎💨 "
behind = " 😰 "
diverged = " 😵 "
untracked = " 🤷 "
stashed = " 📦 "
modified = " 📝 "
staged = '[++\($count\)](green)'
renamed = " ✍️ "
deleted = " 🗑 "
[hostname]
ssh_only = false
format = "[•$hostname](bg:cyan bold fg:black)[](bold fg:cyan )"
trim_at = ".companyname.com"
disabled = false
[line_break]
disabled = false
[memory_usage]
disabled = true
threshold = -1
symbol = " "
style = "bold dimmed green"
[time]
disabled = true
format = '🕙[\[ $time \]]($style) '
time_format = "%T"
[username]
style_user = "bold bg:cyan fg:black"
style_root = "red bold"
format = "[](bold fg:cyan)[$user]($style)"
disabled = false
show_always = true
[directory]
home_symbol = "  "
read_only = "  "
style = "bg:green fg:black"
truncation_length = 6
truncation_symbol = "••/"
format = '[](bold fg:green)[$path ]($style)[](bold fg:green)'
[directory.substitutions]
"Desktop" = "  "
"Documents" = "  "
"Downloads" = "  "
"Music" = " 󰎈 "
"Pictures" = "  "
"Videos" = "  "
[cmd_duration]
min_time = 0
format = '[](bold fg:yellow)[ $duration](bold bg:yellow fg:black)[](bold fg:yellow) •• '