Compare commits

..

2 commits

Author SHA1 Message Date
811747b11c
Add neovim config 2024-03-27 19:16:39 +01:00
a8db391070
Clean up structure of dotfiles 2024-03-27 19:16:28 +01:00
30 changed files with 479 additions and 8 deletions

4
.gitmodules vendored
View file

@ -1,3 +1,3 @@
[submodule "tmux/.tmux/plugins/tpm"]
path = tmux/.tmux/plugins/tpm
[submodule "tmux/dot-tmux/plugins/tpm"]
path = tmux/dot-tmux/plugins/tpm
url = https://github.com/tmux-plugins/tpm

31
install.sh Executable file
View file

@ -0,0 +1,31 @@
#!/bin/bash
function do_stow() {
local package="$1"
local opts=( "--dotfiles" "--dir" "${DOTFILES_DIR}" )
if [[ "$#" -ge 2 ]]; then
opts+=( "--target" "$2" )
fi
stow "${opts[@]}" "$package"
}
set -eo pipefail
DOTFILES_DIR="$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")"
TARGET_DIR="$HOME"
if ! command -v stow &> /dev/null; then
echo "[!] Stow is not installed!"
exit 1
fi
# Install SSH separately, as it requres a different target.
do_stow ssh "${TARGET_DIR}/.ssh"
do_stow tmux
do_stow git
do_stow zsh
do_stow nvim "${TARGET_DIR}/.config"
echo "[+] Installed!"

View file

@ -0,0 +1 @@
require("nvim-autopairs").setup {}

View file

@ -0,0 +1 @@
let g:blamer_enabled = 1

View file

@ -0,0 +1,10 @@
require('indent-o-matic').setup {
-- Number of lines without indentation before giving up.
max_lines = 2048,
-- Space indentation defaults.
standard_widths = { 2, 4, 8 },
-- Skip multi line comments and strings.
skip_multiline = true,
}

View file

@ -0,0 +1,20 @@
local lsp = require("lsp-zero")
lsp.on_attach(function(_client, _bufnr)
lsp.default_keymaps({bufnr = _bufnr})
end)
require("mason").setup({})
require("mason-lspconfig").setup({
ensure_installed = {},
handlers = {
lsp.default_setup,
},
})
local cmp = require("cmp")
cmp.setup({
mapping = cmp.mapping.preset.insert({
['<CR>'] = cmp.mapping.confirm({select = false}),
}),
})

View file

@ -0,0 +1,9 @@
-- Disable netrw at nvim start.
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- Set term gui colours
vim.opt.termguicolors = true
-- Use defaults
require('nvim-tree').setup()

View file

@ -0,0 +1,7 @@
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.git_files, {})
vim.keymap.set('n', '<leader>fF', builtin.find_files, {})
vim.keymap.set('n', '<leader>fG', builtin.live_grep, {})
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
vim.keymap.set('n', '<leader>fc', builtin.commands, {})
vim.keymap.set('n', '<leader>fC', builtin.colorscheme, {})

View file

@ -0,0 +1,27 @@
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "elixir", "go", "bash", "javascript", "typescript", "rust", "graphql" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
-- Indentation is disabled by default.
-- enable it.
indent = {
enable = true,
},
}

View file

@ -0,0 +1 @@
vim.keymap.set('n', '<leader>cu', vim.cmd.UndotreeToggle)

1
nvim/nvim/init.lua Normal file
View file

@ -0,0 +1 @@
require("eyedevelop")

View file

@ -0,0 +1,5 @@
require('eyedevelop.packer')
require('eyedevelop.remap')
require('eyedevelop.theme')
require('eyedevelop.settings')

View file

@ -0,0 +1,105 @@
-- This file can be loaded by calling `lua require("plugins")` from your init.vim
-- Bootstrap packer
local ensure_packer = function()
local packer_path = vim.fn.stdpath('data') .. 'site/pack/packer/start/packer.nvim'
if vim.fn.empty(vim.fn.glob(packer_path)) > 0 then
print('Installing Packer...')
vim.fn.system({
'git',
'clone',
'--depth=1',
'https://github.com/wbthomason/packer.nvim',
packer_path
})
vim.cmd [[packadd packer.nvim]]
return true
else
return false
end
end
local packer_bootstrap = ensure_packer()
return require("packer").startup(function(use)
-- Packer can manage itself
use "wbthomason/packer.nvim"
-- Fuzzy finder
use {
"nvim-telescope/telescope.nvim", tag = "0.1.6",
requires = { { "nvim-lua/plenary.nvim" } }
}
-- Colour theme
use {
"rose-pine/neovim", tag = "v3.0.1",
}
-- TreeSitter
use {
"nvim-treesitter/nvim-treesitter", tag = "v0.9.2",
run = function()
local ts_update = require("nvim-treesitter.install").update({ with_sync = true })
ts_update()
end,
}
-- UndoTree
use {
"mbbill/undotree", tag = "rel_6.1",
}
-- LSP
use {
"VonHeikemen/lsp-zero.nvim",
branch = "v3.x",
requires = {
-- LSP Support
{ "neovim/nvim-lspconfig" },
{ "williamboman/mason.nvim" },
{ "williamboman/mason-lspconfig.nvim" },
-- Autocompletion
{ "hrsh7th/nvim-cmp" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "L3MON4D3/LuaSnip" },
}
}
-- File manager
use {
"nvim-tree/nvim-tree.lua", tag = "v1.2",
}
use {
"nvim-tree/nvim-web-devicons"
}
-- Git BLAME
use {
"APZelos/blamer.nvim", tag = "v1.3.0",
}
-- Tab support
use {
"romgrk/barbar.nvim", tag = "v1.7.0",
requires = {
{ "lewis6991/gitsigns.nvim" }, -- Git status
{ "nvim-tree/nvim-web-devicons" }, -- Icons
}
}
-- Automatically set indent values
use {
"Darazaki/indent-o-matic"
}
-- Auto match brackets.
use {
"windwp/nvim-autopairs",
}
if packer_bootstrap then
require("packer").sync()
end
end)

View file

@ -0,0 +1,4 @@
vim.g.mapleader = ' '
vim.keymap.set('n', '<leader>q', vim.cmd.bd, {})
vim.keymap.set('n', '<leader>fv', vim.cmd.NvimTreeToggle, {})

View file

@ -0,0 +1,37 @@
-- Line numbers
vim.opt.nu = true
vim.opt.relativenumber = true
-- Indent settings
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
-- No line wrap
vim.opt.wrap = false
-- Undo for greater times
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv('HOME') .. '/.local/share/nvim/undodir'
vim.opt.undofile = true
-- No highlighting for search
vim.opt.hlsearch = false
vim.opt.incsearch = true
-- Colours
vim.opt.termguicolors = true
-- Scrolling
vim.opt.scrolloff = 15
vim.opt.signcolumn = 'yes'
vim.opt.isfname:append('@-@')
-- Fast updates
vim.opt.updatetime = 50
-- Colour columns
vim.opt.colorcolumn = '120'

View file

@ -0,0 +1,20 @@
require('rose-pine').setup({
variant = "main",
dark_variant = "main",
dim_inactive_windows = false,
extend_background_behind_borders = true,
enable = {
terminal = true,
legacy_highlights = false,
migrations = true,
},
styles = {
bold = true,
italic = true,
transparency = false,
}
})
vim.cmd("colorscheme rose-pine")

View file

@ -0,0 +1,194 @@
-- Automatically generated packer.nvim plugin loader code
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
return
end
vim.api.nvim_command('packadd packer.nvim')
local no_errors, error_msg = pcall(function()
_G._packer = _G._packer or {}
_G._packer.inside_compile = true
local time
local profile_info
local should_profile = false
if should_profile then
local hrtime = vim.loop.hrtime
profile_info = {}
time = function(chunk, start)
if start then
profile_info[chunk] = hrtime()
else
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
end
end
else
time = function(chunk, start) end
end
local function save_profiles(threshold)
local sorted_times = {}
for chunk_name, time_taken in pairs(profile_info) do
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
end
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
local results = {}
for i, elem in ipairs(sorted_times) do
if not threshold or threshold and elem[2] > threshold then
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
end
end
if threshold then
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
end
_G._packer.profile_output = results
end
time([[Luarocks path setup]], true)
local package_path_str = "/home/eyedevelop/.cache/nvim/packer_hererocks/2.1.1707061634/share/lua/5.1/?.lua;/home/eyedevelop/.cache/nvim/packer_hererocks/2.1.1707061634/share/lua/5.1/?/init.lua;/home/eyedevelop/.cache/nvim/packer_hererocks/2.1.1707061634/lib/luarocks/rocks-5.1/?.lua;/home/eyedevelop/.cache/nvim/packer_hererocks/2.1.1707061634/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/eyedevelop/.cache/nvim/packer_hererocks/2.1.1707061634/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str
end
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
package.cpath = package.cpath .. ';' .. install_cpath_pattern
end
time([[Luarocks path setup]], false)
time([[try_loadstring definition]], true)
local function try_loadstring(s, component, name)
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
if not success then
vim.schedule(function()
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
end)
end
return result
end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
LuaSnip = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/LuaSnip",
url = "https://github.com/L3MON4D3/LuaSnip"
},
["barbar.nvim"] = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/barbar.nvim",
url = "https://github.com/romgrk/barbar.nvim"
},
["blamer.nvim"] = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/blamer.nvim",
url = "https://github.com/APZelos/blamer.nvim"
},
["cmp-nvim-lsp"] = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
},
["gitsigns.nvim"] = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
url = "https://github.com/lewis6991/gitsigns.nvim"
},
["indent-o-matic"] = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/indent-o-matic",
url = "https://github.com/Darazaki/indent-o-matic"
},
["lsp-zero.nvim"] = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim",
url = "https://github.com/VonHeikemen/lsp-zero.nvim"
},
["mason-lspconfig.nvim"] = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
url = "https://github.com/williamboman/mason-lspconfig.nvim"
},
["mason.nvim"] = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/mason.nvim",
url = "https://github.com/williamboman/mason.nvim"
},
neovim = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/neovim",
url = "https://github.com/rose-pine/neovim"
},
["nvim-autopairs"] = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
url = "https://github.com/windwp/nvim-autopairs"
},
["nvim-cmp"] = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/nvim-cmp",
url = "https://github.com/hrsh7th/nvim-cmp"
},
["nvim-lspconfig"] = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
url = "https://github.com/neovim/nvim-lspconfig"
},
["nvim-tree.lua"] = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
url = "https://github.com/nvim-tree/nvim-tree.lua"
},
["nvim-treesitter"] = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
url = "https://github.com/nvim-treesitter/nvim-treesitter"
},
["nvim-web-devicons"] = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
url = "https://github.com/nvim-tree/nvim-web-devicons"
},
["packer.nvim"] = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/packer.nvim",
url = "https://github.com/wbthomason/packer.nvim"
},
["plenary.nvim"] = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/plenary.nvim",
url = "https://github.com/nvim-lua/plenary.nvim"
},
["telescope.nvim"] = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/telescope.nvim",
url = "https://github.com/nvim-telescope/telescope.nvim"
},
undotree = {
loaded = true,
path = "/home/eyedevelop/.local/share/nvim/site/pack/packer/start/undotree",
url = "https://github.com/mbbill/undotree"
}
}
time([[Defining packer_plugins]], false)
_G._packer.inside_compile = false
if _G._packer.needs_bufread == true then
vim.cmd("doautocmd BufRead")
end
_G._packer.needs_bufread = false
if should_profile then save_profiles() end
end)
if not no_errors then
error_msg = error_msg:gsub('"', '\\"')
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
end

View file

@ -1 +0,0 @@
plugins/

2
tmux/dot-tmux/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
plugins/*
!plugins/tpm

View file

@ -70,7 +70,7 @@ zstyle ':omz:update' mode auto # update automatically without asking
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
plugins=()
source $ZSH/oh-my-zsh.sh
@ -105,7 +105,4 @@ zstyle ':completion:*:manuals' separate-sections true
zstyle ':completion:*:manuals.*' insert-sections true
zstyle ':completion:*:man:*' menu yes select
# Auto start tmux
if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ] && [ -z "$SSH_CONNECTION" ]; then
exec tmux
fi
alias vim="nvim"