refactor: combine with Ubuntu Provisioning repo
Combine with this repository with https://github.com/opdavies/ubuntu-provisioning so that everything can be managed in one place, and add a role for each piece of software.
This commit is contained in:
parent
e11cf61218
commit
8916e90050
73 changed files with 239 additions and 3783 deletions
12
roles/alacritty/files/alacritty.yml
Normal file
12
roles/alacritty/files/alacritty.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
window:
|
||||
decorations: full
|
||||
dynamic_title: false
|
||||
|
||||
font:
|
||||
normal:
|
||||
family: Monospace
|
||||
size: 12
|
||||
offset:
|
||||
y: 20
|
||||
glyph_offset:
|
||||
y: 10
|
19
roles/alacritty/tasks/main.yaml
Normal file
19
roles/alacritty/tasks/main.yaml
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
- name: Install
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- alacritty
|
||||
state: latest
|
||||
become: true
|
||||
|
||||
- name: Config folder
|
||||
ansible.builtin.file:
|
||||
mode: "0755"
|
||||
path: "{{ ansible_user_dir }}/.config/alacritty"
|
||||
state: directory
|
||||
|
||||
- name: Configure
|
||||
ansible.builtin.file:
|
||||
src: "{{ role_path }}/files/alacritty.yml"
|
||||
dest: "{{ ansible_user_dir }}/.config/alacritty/alacritty.yml"
|
||||
state: link
|
7
roles/ctop/tasks/main.yaml
Normal file
7
roles/ctop/tasks/main.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: Install
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- ctop
|
||||
state: latest
|
||||
become: true
|
23
roles/dconf/files/dconf-settings.ini
Normal file
23
roles/dconf/files/dconf-settings.ini
Normal file
|
@ -0,0 +1,23 @@
|
|||
[org/gnome/desktop/wm/keybindings]
|
||||
move-to-workspace-1=['<Shift><Super>Home', '<Shift><Super>1']
|
||||
move-to-workspace-2=['<Shift><Super>2']
|
||||
move-to-workspace-3=['<Shift><Super>3']
|
||||
move-to-workspace-3=['<Shift><Super>3']
|
||||
move-to-workspace-4=['<Shift><Super>4']
|
||||
move-to-workspace-4=['<Shift><Super>4']
|
||||
move-to-workspace-5=['<Shift><Super>5']
|
||||
move-to-workspace-6=['<Shift><Super>6']
|
||||
move-to-workspace-7=['<Shift><Super>7']
|
||||
move-to-workspace-8=['<Shift><Super>8']
|
||||
move-to-workspace-9=['<Shift><Super>9']
|
||||
move-to-workspace-10=['<Shift><Super>0']
|
||||
switch-to-workspace-1=['<Super>1']
|
||||
switch-to-workspace-2=['<Super>2']
|
||||
switch-to-workspace-3=['<Super>3']
|
||||
switch-to-workspace-4=['<Super>4']
|
||||
switch-to-workspace-5=['<Super>5']
|
||||
switch-to-workspace-6=['<Super>6']
|
||||
switch-to-workspace-7=['<Super>7']
|
||||
switch-to-workspace-8=['<Super>8']
|
||||
switch-to-workspace-9=['<Super>9']
|
||||
switch-to-workspace-10=['<Super>0']
|
6
roles/dconf/tasks/main.yaml
Normal file
6
roles/dconf/tasks/main.yaml
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
- name: Configure
|
||||
ansible.builtin.file:
|
||||
src: "{{ role_path }}/files/dconf-settings.ini"
|
||||
dest: "{{ ansible_user_dir }}/.config/dconf-settings.ini"
|
||||
state: link
|
22
roles/docker/tasks/main.yaml
Normal file
22
roles/docker/tasks/main.yaml
Normal file
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
- name: Install
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- docker
|
||||
- docker-compose
|
||||
state: latest
|
||||
become: yes
|
||||
|
||||
- name: Enable service
|
||||
ansible.builtin.systemd:
|
||||
enabled: yes
|
||||
name: docker
|
||||
state: started
|
||||
become: yes
|
||||
|
||||
- name: Add to group
|
||||
ansible.builtin.user:
|
||||
append: yes
|
||||
groups: docker
|
||||
name: "{{ ansible_env['USER'] }}"
|
||||
become: yes
|
7
roles/firefox/tasks/main.yaml
Normal file
7
roles/firefox/tasks/main.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: Install
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- firefox
|
||||
state: latest
|
||||
become: true
|
7
roles/fzf/tasks/main.yaml
Normal file
7
roles/fzf/tasks/main.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: Install
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- fzf
|
||||
state: latest
|
||||
become: true
|
133
roles/git/files/.gitconfig
Normal file
133
roles/git/files/.gitconfig
Normal file
|
@ -0,0 +1,133 @@
|
|||
[alias]
|
||||
aa = add --all
|
||||
assume = update-index --assume-unchanged
|
||||
assumed = !git ls-files -v | grep '^[hsmrck?]' | cut -c 3-
|
||||
b = branch
|
||||
browse = !hub browse
|
||||
ca = commit --amend --verbose
|
||||
car = commit --amend --no-edit
|
||||
cl = !hub clone
|
||||
cl = !hub clone
|
||||
co = checkout
|
||||
compare = !hub compare
|
||||
current-branch = rev-parse --abbrev-ref HEAD
|
||||
dc = diff --color --word-diff --cached
|
||||
df = diff --color --word-diff
|
||||
dup = !git checkout develop && git fetch origin && echo && git sl develop..origin/develop && echo && git pull --quiet && git checkout -
|
||||
fixup = commit --fixup
|
||||
issues = !hub browse -- issues
|
||||
mup = !git master-to-main-wrapper checkout %BRANCH% && git fetch origin && echo && git sl %BRANCH%..origin/%BRANCH% && echo && git pull --quiet && git checkout -
|
||||
nah = !git reset --hard && git clean -fd
|
||||
no-ff = merge --no-ff
|
||||
pl = pull
|
||||
prune = remote prune origin
|
||||
ps = push
|
||||
pulls = !hub browse -- pulls
|
||||
rbc = rebase --continue
|
||||
rdup = !git dup && git rebase develop
|
||||
remotes = remote -v
|
||||
repush = !git pull --rebase && git push
|
||||
ri = rebase --interactive
|
||||
rid = !git rebase -i $(git merge-base develop HEAD)
|
||||
rim = !git rebase -i $(git master-to-main-wrapper merge-base %BRANCH% HEAD)
|
||||
rip = !git rebase -i $(git merge-base production HEAD)
|
||||
ris = !git rebase -i $(git merge-base staging HEAD)
|
||||
riu = !git rebase -i $(git rev-parse --abbrev-ref --symbolic-full-name @{u})
|
||||
rmup = !git mup && git master-to-main-wrapper rebase %BRANCH%
|
||||
sl = log --oneline --decorate -20
|
||||
sla = log --oneline --decorate --graph --all -20
|
||||
slap = log --oneline --decorate --graph --all
|
||||
slp = log --oneline --decorate
|
||||
staged = diff --staged
|
||||
unassume = update-index --no-assume-unchanged
|
||||
uncommit = reset --soft HEAD^
|
||||
unstage = reset
|
||||
upstream = rev-parse --abbrev-ref --symbolic-full-name @{u}
|
||||
ureset = !git reset --hard $(git upstream)
|
||||
wip = !git add . && git commit -m 'wip'
|
||||
|
||||
[branch]
|
||||
autosetupmerge = true
|
||||
autosetuprebase = always
|
||||
|
||||
[checkout]
|
||||
defaultRemote = origin
|
||||
|
||||
[color]
|
||||
branch = auto
|
||||
diff = auto
|
||||
status = auto
|
||||
ui = true
|
||||
|
||||
[color "branch"]
|
||||
current = red reverse
|
||||
local = blue
|
||||
remote = green
|
||||
|
||||
[color "diff"]
|
||||
meta = yellow
|
||||
frag = magenta
|
||||
old = red bold
|
||||
new = green
|
||||
plain = white
|
||||
|
||||
[color "status"]
|
||||
added = yellow
|
||||
changed = green
|
||||
untracked = cyan
|
||||
|
||||
[commit]
|
||||
template = ~/.gitmessage
|
||||
verbose = true
|
||||
|
||||
[core]
|
||||
editor = nvim
|
||||
excludesFile = ~/.gitignore-global
|
||||
|
||||
[diff]
|
||||
tool = vimdiff
|
||||
|
||||
[fetch]
|
||||
prune = true
|
||||
|
||||
[gitsh]
|
||||
nogreeting = true
|
||||
|
||||
[grep]
|
||||
lineNumber = true
|
||||
|
||||
[help]
|
||||
autocorrect = 1
|
||||
|
||||
[include]
|
||||
path = ~/.gitconfig.local
|
||||
|
||||
[init]
|
||||
templatedir = ~/.git_template
|
||||
|
||||
[merge]
|
||||
ff = only
|
||||
|
||||
[rebase]
|
||||
autosquash = true
|
||||
autostash = true
|
||||
|
||||
[rerere]
|
||||
enabled = true
|
||||
|
||||
[push]
|
||||
default = upstream
|
||||
|
||||
[url "https://git.drupal.org/project/"]
|
||||
insteadOf = do:
|
||||
insteadOf = drupal:
|
||||
|
||||
[pull]
|
||||
ff = only
|
||||
rebase = true
|
||||
|
||||
[filter "lfs"]
|
||||
process = git-lfs filter-process
|
||||
required = true
|
||||
clean = git-lfs clean -- %f
|
||||
smudge = git-lfs smudge -- %f
|
10
roles/git/files/.gitignore
vendored
Normal file
10
roles/git/files/.gitignore
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
*
|
||||
!*/
|
||||
!/bin/**
|
||||
!/tag-*/**
|
||||
/tag-php/composer/.env
|
||||
/tag-php/composer/auth.json
|
||||
/tag-php/composer/bin/
|
||||
/tag-php/composer/config/
|
||||
/tag-php/composer/keys.*.pub
|
||||
/**/*.zwc
|
43
roles/git/files/.gitignore-global
Normal file
43
roles/git/files/.gitignore-global
Normal file
|
@ -0,0 +1,43 @@
|
|||
# Ignore archive files.
|
||||
*.7z
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.phar
|
||||
*.phar.version
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
|
||||
# Ignore database exports.
|
||||
*.*sql
|
||||
|
||||
# Ignore patch files and interdiffs.
|
||||
*.patch
|
||||
*.diff
|
||||
*.rej
|
||||
*.orig
|
||||
interdiff*.txt
|
||||
|
||||
# Ignore Vagrant directories.
|
||||
.vagrant/
|
||||
|
||||
# Ignore logs.
|
||||
*.log
|
||||
|
||||
# Ignore IDE and text editor files.
|
||||
.idea/
|
||||
*.sublime-*
|
||||
|
||||
# Ignore temporary directories.
|
||||
.php_cs.cache
|
||||
tmp/
|
||||
|
||||
# Ignore Ansible Playbook retrys.
|
||||
*.retry
|
||||
|
||||
# Ignore notes within projects.
|
||||
.notes/
|
||||
|
||||
# Ignore directory level aliases
|
||||
.aliases
|
16
roles/git/files/.gitmessage
Normal file
16
roles/git/files/.gitmessage
Normal file
|
@ -0,0 +1,16 @@
|
|||
|
||||
|
||||
# 50-character subject line
|
||||
#
|
||||
# 72-character wrapped longer description. This should answer:
|
||||
#
|
||||
# * Why was this change necessary?
|
||||
# * How does it address the problem?
|
||||
# * Are there any side effects?
|
||||
#
|
||||
# Include a link to the ticket, if any.
|
||||
#
|
||||
# Add co-authors if you worked on this code with others:
|
||||
#
|
||||
# Co-authored-by: Full Name <email@example.com>
|
||||
# Co-authored-by: Full Name <email@example.com>
|
17
roles/git/tasks/main.yaml
Normal file
17
roles/git/tasks/main.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: Install
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- git
|
||||
state: latest
|
||||
become: true
|
||||
|
||||
- name: Configuration
|
||||
ansible.builtin.file:
|
||||
src: "{{ role_path }}/files/{{ item }}"
|
||||
dest: "{{ ansible_user_dir }}/{{ item }}"
|
||||
state: link
|
||||
with_items:
|
||||
- .gitconfig
|
||||
- .gitignore-global
|
||||
- .gitmessage
|
7
roles/htop/tasks/main.yaml
Normal file
7
roles/htop/tasks/main.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: Install
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- htop
|
||||
state: latest
|
||||
become: true
|
7
roles/lazydocker/tasks/main.yaml
Normal file
7
roles/lazydocker/tasks/main.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: Install
|
||||
community.general.homebrew:
|
||||
name:
|
||||
- lazydocker
|
||||
state: latest
|
||||
path: /home/linuxbrew/.linuxbrew/bin
|
7
roles/lazygit/tasks/main.yaml
Normal file
7
roles/lazygit/tasks/main.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: Install
|
||||
community.general.homebrew:
|
||||
name:
|
||||
- lazygit
|
||||
state: latest
|
||||
path: /home/linuxbrew/.linuxbrew/bin
|
14
roles/neovim/files/init.lua
Normal file
14
roles/neovim/files/init.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
require("opdavies.autopairs")
|
||||
require("opdavies.colours")
|
||||
require("opdavies.comment")
|
||||
require("opdavies.completion")
|
||||
require("opdavies.floaterm")
|
||||
require("opdavies.gitsigns")
|
||||
require("opdavies.indent-blankline")
|
||||
require("opdavies.lsp")
|
||||
require("opdavies.options").setup()
|
||||
require("opdavies.plugins")
|
||||
require("opdavies.seiya")
|
||||
require("opdavies.telescope")
|
||||
require("opdavies.treesitter")
|
||||
require("opdavies.vim-test")
|
16
roles/neovim/files/lua/opdavies/autopairs.lua
Normal file
16
roles/neovim/files/lua/opdavies/autopairs.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
local status_ok, autopairs = pcall(require, "nvim-autopairs")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
autopairs.setup {}
|
||||
|
||||
local cmp_status_ok, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp")
|
||||
if not cmp_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local cmp = require('cmp')
|
||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done({
|
||||
map_char = { tex = '' }
|
||||
}))
|
13
roles/neovim/files/lua/opdavies/colours.lua
Normal file
13
roles/neovim/files/lua/opdavies/colours.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local colorbuddy_status_ok, colorbuddy = pcall(require, "colorbuddy")
|
||||
if not colorbuddy_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local colorizer_status_ok, colorizer = pcall(require, "colorizer")
|
||||
if not colorizer_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
colorbuddy.colorscheme("gruvbuddy")
|
||||
|
||||
colorizer.setup()
|
19
roles/neovim/files/lua/opdavies/comment.lua
Normal file
19
roles/neovim/files/lua/opdavies/comment.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
local status_ok, comment = pcall(require, "Comment")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
comment.setup {
|
||||
padding = true,
|
||||
|
||||
opleader = {
|
||||
line = 'gc',
|
||||
block = 'gb',
|
||||
},
|
||||
|
||||
mappings = {
|
||||
basic = true,
|
||||
extra = true,
|
||||
extended = false,
|
||||
},
|
||||
}
|
60
roles/neovim/files/lua/opdavies/completion.lua
Normal file
60
roles/neovim/files/lua/opdavies/completion.lua
Normal file
|
@ -0,0 +1,60 @@
|
|||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||
if not cmp_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
||||
if not snip_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
require("luasnip/loaders/from_vscode").lazy_load()
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end
|
||||
},
|
||||
|
||||
mapping = {
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<c-y>"] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
},
|
||||
},
|
||||
|
||||
sources = {
|
||||
{ name = "buffer", priority = 2, keyword_length = 5, max_item_count = 5 },
|
||||
{ name = "calc" },
|
||||
{ name = "path" },
|
||||
{ name = "spell" },
|
||||
{ name = "treesitter" },
|
||||
|
||||
-- Neovim
|
||||
{ name = "nvim_lsp", priority = 10 },
|
||||
{ name = "nvim_lua" },
|
||||
|
||||
-- Plugins
|
||||
{ name = "luasnip" },
|
||||
{ name = "cmp_tabnine" },
|
||||
},
|
||||
|
||||
formatting = {
|
||||
format = require("lspkind").cmp_format({with_text = true, menu = ({
|
||||
buffer = "[buf]",
|
||||
cmp_tabnine = "[tn]",
|
||||
luasnip = "[snip]",
|
||||
nvim_lsp = "[lsp]",
|
||||
nvim_lua = "[lua]",
|
||||
path = "[path]",
|
||||
})}),
|
||||
},
|
||||
|
||||
experimental = {
|
||||
ghost_text = true
|
||||
},
|
||||
}
|
8
roles/neovim/files/lua/opdavies/floaterm.lua
Normal file
8
roles/neovim/files/lua/opdavies/floaterm.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
local map = vim.api.nvim_set_keymap
|
||||
|
||||
local options = { noremap = true }
|
||||
|
||||
map('n', '<leader>ld', '<cmd>FloatermNew --autoclose=2 --height=0.9 --width=0.9 lazydocker<cr>', options)
|
||||
map('n', '<leader>lg', '<cmd>FloatermNew --autoclose=2 --height=0.9 --width=0.9 lazygit<cr>', options)
|
||||
map('n', '<leader>nn', '<cmd>FloatermNew --autoclose=2 --height=0.5 --width=0.5 nnn -Hde<cr>', options)
|
||||
map('n', '<leader>tt', '<cmd>FloatermNew --autoclose=2 --height=0.9 --width=0.9 zsh<cr>', options)
|
31
roles/neovim/files/lua/opdavies/gitsigns.lua
Normal file
31
roles/neovim/files/lua/opdavies/gitsigns.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
local colorbuddy_status_ok, colorbuddy = pcall(require, "colorbuddy")
|
||||
if not colorbuddy_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local gitsigns_status_ok, gitsigns = pcall(require, "gitsigns")
|
||||
if not gitsigns_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local c = require("colorbuddy.color").colors
|
||||
local Group = require("colorbuddy.group").Group
|
||||
|
||||
Group.new("GitSignsAdd", c.green)
|
||||
Group.new("GitSignsChange", c.yellow)
|
||||
Group.new("GitSignsDelete", c.red)
|
||||
|
||||
gitsigns.setup {
|
||||
linehl = false,
|
||||
numhl = true,
|
||||
|
||||
signs = {
|
||||
add = { hl = "GitSignsAdd", text = "│", numhl = "GitSignsAddNr" },
|
||||
change = { hl = "GitSignsChange", text = "│", numhl = "GitSignsChangeNr" },
|
||||
delete = { hl = "GitSignsDelete", text = "_", numhl = "GitSignsDeleteNr" },
|
||||
topdelete = { hl = "GitSignsDelete", text = "‾", numhl = "GitSignsDeleteNr" },
|
||||
changedelete = { hl = "GitSignsDelete", text = "~", numhl = "GitSignsChangeNr" },
|
||||
},
|
||||
|
||||
word_diff = false,
|
||||
}
|
18
roles/neovim/files/lua/opdavies/indent-blankline.lua
Normal file
18
roles/neovim/files/lua/opdavies/indent-blankline.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
local status_ok, indent_blankline = pcall(require, "indent_blankline")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = {
|
||||
eol = "↴",
|
||||
}
|
||||
|
||||
vim.cmd [[highlight IndentBlanklineIndent1 guifg=#555555 gui=nocombine]]
|
||||
|
||||
indent_blankline.setup {
|
||||
char_highlight_list = {
|
||||
"IndentBlanklineIndent1",
|
||||
},
|
||||
show_end_of_line = true,
|
||||
}
|
47
roles/neovim/files/lua/opdavies/lsp/handlers.lua
Normal file
47
roles/neovim/files/lua/opdavies/lsp/handlers.lua
Normal file
|
@ -0,0 +1,47 @@
|
|||
local M = {}
|
||||
|
||||
M.setup = function()
|
||||
local config = {
|
||||
virtual_text = false,
|
||||
update_in_insert = true,
|
||||
underline = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
focusable = false,
|
||||
style = "minimal",
|
||||
source = "always",
|
||||
header = "",
|
||||
prefix = "",
|
||||
}
|
||||
}
|
||||
|
||||
vim.diagnostic.config(config)
|
||||
end
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
|
||||
local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local function lsp_keymaps(bufnr)
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
local keymap = vim.api.nvim_buf_set_keymap
|
||||
|
||||
keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||
keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||
keymap(bufnr, "n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||
end
|
||||
|
||||
M.on_attach = function(bufnr)
|
||||
lsp_keymaps(bufnr)
|
||||
end
|
||||
|
||||
M.capabilities = cmp_nvim_lsp.update_capabilities(capabilities)
|
||||
|
||||
return M
|
40
roles/neovim/files/lua/opdavies/lsp/init.lua
Normal file
40
roles/neovim/files/lua/opdavies/lsp/init.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
local status_ok, lspconfig = pcall(require, "lspconfig")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local opts = {
|
||||
on_attach = require("opdavies.lsp.handlers").on_attach,
|
||||
capabilities = require("opdavies.lsp.handlers").capabilities,
|
||||
}
|
||||
|
||||
local servers = {
|
||||
"ansiblels",
|
||||
"bashls",
|
||||
"cssls",
|
||||
"html",
|
||||
"tsserver",
|
||||
"vuels",
|
||||
"yamlls",
|
||||
}
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup(opts)
|
||||
end
|
||||
|
||||
local intelephense_opts = require("opdavies.lsp.settings.intelephense")
|
||||
lspconfig.intelephense.setup {
|
||||
vim.tbl_deep_extend("force", intelephense_opts, opts)
|
||||
}
|
||||
|
||||
local sumneko_lua_opts = require("opdavies.lsp.settings.sumneko_lua")
|
||||
lspconfig.sumneko_lua.setup(
|
||||
vim.tbl_deep_extend("force", sumneko_lua_opts, opts)
|
||||
)
|
||||
|
||||
local tailwindcss_opts = require("opdavies.lsp.settings.tailwindcss")
|
||||
lspconfig.tailwindcss.setup {
|
||||
vim.tbl_deep_extend("force", tailwindcss_opts, opts)
|
||||
}
|
||||
|
||||
require("opdavies.lsp.handlers").setup()
|
13
roles/neovim/files/lua/opdavies/lsp/null-ls.lua
Normal file
13
roles/neovim/files/lua/opdavies/lsp/null-ls.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local status_ok, null_ls = pcall(require, "null-ls")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.formatting.prettier,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.diagnostics.eslint,
|
||||
null_ls.builtins.completion.spell,
|
||||
},
|
||||
})
|
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
filetypes = { "php", "module", "test", "inc" }
|
||||
}
|
15
roles/neovim/files/lua/opdavies/lsp/settings/sumneko_lua.lua
Normal file
15
roles/neovim/files/lua/opdavies/lsp/settings/sumneko_lua.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "use", "vim" }
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
filetypes = { "html", "html.twig", "lua" }
|
||||
}
|
119
roles/neovim/files/lua/opdavies/options.lua
Normal file
119
roles/neovim/files/lua/opdavies/options.lua
Normal file
|
@ -0,0 +1,119 @@
|
|||
local M = {}
|
||||
|
||||
local function set_autocmd()
|
||||
vim.cmd[[
|
||||
autocmd BufRead,BufNewFile *.test set filetype=php
|
||||
|
||||
autocmd BufWritePost plugins.lua luafile %
|
||||
autocmd BufWritePost plugins.lua PackerSync
|
||||
|
||||
autocmd FileType gitcommit highlight ColorColumn ctermbg=8
|
||||
autocmd FileType gitcommit setlocal colorcolumn=50,72
|
||||
autocmd FileType gitcommit setlocal spell
|
||||
autocmd FileType gitcommit setlocal textwidth=72
|
||||
]]
|
||||
end
|
||||
|
||||
local function set_filetypes()
|
||||
vim.cmd[[
|
||||
filetype indent on
|
||||
filetype on
|
||||
filetype plugin on
|
||||
]]
|
||||
end
|
||||
|
||||
local function set_key_mappings()
|
||||
local map = vim.api.nvim_set_keymap
|
||||
|
||||
local options = { noremap = true }
|
||||
|
||||
map('n', '<Leader>so', ':luafile ~/.config/nvim/init.lua<Cr>', options)
|
||||
|
||||
-- Format paragraphs to an 80 character line length.
|
||||
map('n', '<Leader>g', 'gqap', options)
|
||||
map('x', '<Leader>g', 'gqa', options)
|
||||
|
||||
-- Make the current file executable
|
||||
map('n', '<Leader>x', ':!chmod +x %<Cr>', options)
|
||||
|
||||
-- Yank from the current column to the end of the line
|
||||
map('n', 'Y', 'yg$', options)
|
||||
|
||||
-- Keep things centred
|
||||
map('n', 'n', 'nzzzv', options)
|
||||
map('n', 'N', 'Nzzzv', options)
|
||||
|
||||
-- Remove arrow keys
|
||||
map('v', '<down>', '<nop>', options)
|
||||
map('v', '<left>', '<nop>', options)
|
||||
map('v', '<right>', '<nop>', options)
|
||||
map('v', '<up>', '<nop>', options)
|
||||
|
||||
-- Clears hlsearch after doing a search, otherwise just does normal <CR> stuff
|
||||
vim.cmd[[ nnoremap <expr> <CR> {-> v:hlsearch ? ":nohl\<CR>" : "\<CR>"}() ]]
|
||||
|
||||
map(
|
||||
'n',
|
||||
'<C-f>',
|
||||
':silent !tmux neww tmux-sessioniser<CR>',
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
end
|
||||
|
||||
local function set_highlights()
|
||||
vim.cmd[[highlight Comment cterm=italic gui=italic]]
|
||||
end
|
||||
|
||||
local function set_vim_g()
|
||||
vim.g.mapleader = ' '
|
||||
end
|
||||
|
||||
local function set_vim_o()
|
||||
local settings = {
|
||||
autoindent = true,
|
||||
breakindent = true,
|
||||
conceallevel = 0,
|
||||
expandtab = true,
|
||||
foldlevel = 1,
|
||||
foldlevelstart = 1,
|
||||
foldmethod = 'indent',
|
||||
formatoptions = 'lm',
|
||||
linebreak = true,
|
||||
mouse = 'n',
|
||||
number = true,
|
||||
pumblend = 10,
|
||||
pumheight = 10,
|
||||
relativenumber = true,
|
||||
scrolloff = 10,
|
||||
shiftwidth = 2,
|
||||
showmode = false,
|
||||
smartindent = true,
|
||||
softtabstop = 2,
|
||||
splitbelow = true,
|
||||
splitright = true,
|
||||
swapfile = false,
|
||||
syntax = 'on',
|
||||
tabstop = 2,
|
||||
termguicolors = true,
|
||||
textwidth = 0,
|
||||
updatetime = 1000,
|
||||
wrap = true,
|
||||
}
|
||||
|
||||
for key, value in pairs(settings) do
|
||||
vim.o[key] = value
|
||||
end
|
||||
|
||||
vim.opt.clipboard:append 'unnamedplus'
|
||||
end
|
||||
|
||||
M.setup = function()
|
||||
set_vim_g()
|
||||
set_vim_o()
|
||||
set_key_mappings()
|
||||
set_autocmd()
|
||||
set_filetypes()
|
||||
set_highlights()
|
||||
end
|
||||
|
||||
return M
|
84
roles/neovim/files/lua/opdavies/plugins.lua
Normal file
84
roles/neovim/files/lua/opdavies/plugins.lua
Normal file
|
@ -0,0 +1,84 @@
|
|||
local status_ok, packer = pcall(require, "packer")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
packer.init {
|
||||
display = {
|
||||
open_fn = function()
|
||||
return require'packer.util'.float {}
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
return packer.startup(function()
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
-- Utilities
|
||||
use 'cakebaker/scss-syntax.vim'
|
||||
use 'christoomey/vim-sort-motion'
|
||||
use 'christoomey/vim-tmux-navigator'
|
||||
use 'editorconfig/editorconfig-vim'
|
||||
use 'icatalina/vim-case-change'
|
||||
use 'kyazdani42/nvim-web-devicons'
|
||||
use 'lewis6991/gitsigns.nvim'
|
||||
use 'lukas-reineke/indent-blankline.nvim'
|
||||
use 'machakann/vim-highlightedyank'
|
||||
use 'miyakogi/seiya.vim'
|
||||
use 'norcalli/nvim-colorizer.lua'
|
||||
use 'numToStr/Comment.nvim'
|
||||
use 'nvim-lua/plenary.nvim'
|
||||
use 'nvim-lua/popup.nvim'
|
||||
use 'sheerun/vim-polyglot'
|
||||
use 'tpope/vim-surround'
|
||||
use 'vim-test/vim-test'
|
||||
use 'voldikss/vim-floaterm'
|
||||
use 'windwp/nvim-autopairs'
|
||||
use { 'mg979/vim-visual-multi', branch = 'master' }
|
||||
|
||||
-- Themes
|
||||
use {
|
||||
'tjdevries/gruvbuddy.nvim',
|
||||
requires = {
|
||||
'tjdevries/colorbuddy.vim'
|
||||
},
|
||||
}
|
||||
|
||||
-- Navigation
|
||||
use 'ThePrimeagen/harpoon'
|
||||
|
||||
-- Treesitter
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
run = ':TSUpdate',
|
||||
}
|
||||
|
||||
-- Completion
|
||||
use {
|
||||
'hrsh7th/nvim-cmp',
|
||||
requires = {
|
||||
'L3MON4D3/LuaSnip',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-path',
|
||||
'onsails/lspkind-nvim',
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
{
|
||||
'tzachar/cmp-tabnine',
|
||||
run = './install.sh'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- Snippets
|
||||
use 'L3MON4D3/LuaSnip'
|
||||
use 'rafamadriz/friendly-snippets'
|
||||
|
||||
-- LSP
|
||||
use 'neovim/nvim-lspconfig'
|
||||
use 'jose-elias-alvarez/null-ls.nvim'
|
||||
|
||||
-- Telescope
|
||||
use 'nvim-telescope/telescope.nvim'
|
||||
use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
|
||||
end)
|
3
roles/neovim/files/lua/opdavies/seiya.lua
Normal file
3
roles/neovim/files/lua/opdavies/seiya.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
vim.g.seiya_auto_enable = 1
|
||||
|
||||
vim.g.seiya_target_groups = { 'guibg' }
|
58
roles/neovim/files/lua/opdavies/telescope/init.lua
Normal file
58
roles/neovim/files/lua/opdavies/telescope/init.lua
Normal file
|
@ -0,0 +1,58 @@
|
|||
local status_ok, telescope = pcall(require, "telescope")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local previewers = require('telescope.previewers')
|
||||
local Job = require('plenary.job')
|
||||
|
||||
-- Create a new maker that won't preview binary files
|
||||
-- https://github.com/nvim-telescope/telescope.nvim/wiki/Configuration-Recipes#dont-preview-binaries
|
||||
local new_maker = function(filepath, bufnr, opts)
|
||||
filepath = vim.fn.expand(filepath)
|
||||
Job:new({
|
||||
command = 'file',
|
||||
args = { '--mime-type', '-b', filepath },
|
||||
on_exit = function(j)
|
||||
local mime_type = vim.split(j:result()[1], '/')[1]
|
||||
if mime_type == "text" then
|
||||
previewers.buffer_previewer_maker(filepath, bufnr, opts)
|
||||
else
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { 'BINARY' })
|
||||
end)
|
||||
end
|
||||
end
|
||||
}):sync()
|
||||
end
|
||||
|
||||
telescope.setup{
|
||||
defaults = {
|
||||
buffer_previewer_maker = new_maker,
|
||||
prompt_prefix = "$ "
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
telescope.load_extension("fzf")
|
||||
local map = vim.api.nvim_set_keymap
|
||||
|
||||
local options = {
|
||||
noremap = true,
|
||||
silent = true,
|
||||
}
|
||||
|
||||
-- Builtin
|
||||
map('n', '<leader>fb', '<CMD>lua require("telescope.builtin").buffers()<CR>', options)
|
||||
map('n', '<leader>fc', '<CMD>lua require("telescope.builtin").lsp_code_actions()<CR>', options)
|
||||
map('n', '<leader>fd', '<CMD>lua require("telescope.builtin").lsp_workspace_diagnostics()<CR>', options)
|
||||
map('n', '<leader>fe', '<CMD>lua require("telescope.builtin").file_browser{ cwd = vim.fn.expand("%:p:h") }<CR>', options)
|
||||
map('n', '<leader>fg', '<CMD>lua require("telescope.builtin").git_files{}<CR>', options)
|
||||
map('n', '<leader>fh', '<CMD>lua require("telescope.builtin").help_tags()<CR>', options)
|
||||
map('n', '<leader>fl', '<CMD>lua require("telescope.builtin").live_grep()<CR>', options)
|
||||
map('n', '<leader>fr', '<CMD>lua require("telescope.builtin").registers()<CR>', options)
|
||||
map('n', '<leader>fr', '<CMD>lua require("telescope.builtin").registers()<CR>', options)
|
||||
|
||||
-- Custom
|
||||
map("n", "<Leader>en", '<CMD>lua require("opdavies.telescope.mappings").edit_neovim()<Cr>', options)
|
||||
map("n", "<Leader>ff", '<CMD>lua require("opdavies.telescope.mappings").fd()<Cr>', options)
|
33
roles/neovim/files/lua/opdavies/telescope/mappings.lua
Normal file
33
roles/neovim/files/lua/opdavies/telescope/mappings.lua
Normal file
|
@ -0,0 +1,33 @@
|
|||
local M = {}
|
||||
|
||||
function M.edit_neovim()
|
||||
local opts = {
|
||||
prompt_title = "~ dotfiles ~",
|
||||
shorten_path = false,
|
||||
cwd = "~/.config/nvim",
|
||||
|
||||
layout_strategy = "flex",
|
||||
layout_config = {
|
||||
height = 0.8,
|
||||
prompt_position = "top",
|
||||
width = 0.9,
|
||||
|
||||
horizontal = {
|
||||
width = { padding = 0.15 },
|
||||
},
|
||||
vertical = {
|
||||
preview_height = 0.75,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require("telescope.builtin").find_files(opts)
|
||||
end
|
||||
|
||||
function M.fd()
|
||||
local themes = require "telescope.themes"
|
||||
|
||||
require("telescope.builtin").find_files(themes.get_ivy())
|
||||
end
|
||||
|
||||
return M
|
18
roles/neovim/files/lua/opdavies/treesitter.lua
Normal file
18
roles/neovim/files/lua/opdavies/treesitter.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
local status_ok, configs = pcall(require, "nvim-treesitter.configs")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
configs.setup {
|
||||
context_commenting = {
|
||||
enable = true
|
||||
},
|
||||
ensure_installed = "maintained",
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
indent = {
|
||||
disable = { "yaml" },
|
||||
enable = true,
|
||||
}
|
||||
}
|
13
roles/neovim/files/lua/opdavies/vim-test.lua
Normal file
13
roles/neovim/files/lua/opdavies/vim-test.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local map = vim.api.nvim_set_keymap
|
||||
|
||||
local options = {
|
||||
silent = true
|
||||
}
|
||||
|
||||
map('n', 't<C-f>', ':TestFile<CR>', options)
|
||||
map('n', 't<C-g>', ':TestVisit<CR>', options)
|
||||
map('n', 't<C-l>', ':TestLast<CR>', options)
|
||||
map('n', 't<C-n>', ':TestNearest<CR>', options)
|
||||
map('n', 't<C-s>', ':TestSuite<CR>', options)
|
||||
|
||||
vim.g['test#strategy'] = "neovim"
|
26
roles/neovim/tasks/main.yaml
Normal file
26
roles/neovim/tasks/main.yaml
Normal file
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
- name: Add neovim PPA
|
||||
apt_repository:
|
||||
repo: "ppa:neovim-ppa/unstable"
|
||||
become: true
|
||||
|
||||
- name: Install Neovim
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- neovim
|
||||
state: latest
|
||||
become: true
|
||||
|
||||
- name: Create .config/nvim directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ ansible_user_dir }}/.config/nvim"
|
||||
state: directory
|
||||
|
||||
- name: Configuration files
|
||||
ansible.builtin.file:
|
||||
src: "{{ role_path }}/files/{{ item }}"
|
||||
dest: "{{ ansible_user_dir }}/.config/nvim/{{ item }}"
|
||||
state: link
|
||||
with_items:
|
||||
- init.lua
|
||||
- lua
|
7
roles/nnn/tasks/main.yaml
Normal file
7
roles/nnn/tasks/main.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: Install
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- nnn
|
||||
state: latest
|
||||
become: true
|
7
roles/pv/tasks/main.yaml
Normal file
7
roles/pv/tasks/main.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: Install
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- pv
|
||||
state: latest
|
||||
become: true
|
7
roles/rename/tasks/main.yaml
Normal file
7
roles/rename/tasks/main.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: Install
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- rename
|
||||
state: latest
|
||||
become: true
|
7
roles/ripgrep/tasks/main.yaml
Normal file
7
roles/ripgrep/tasks/main.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: Install
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- ripgrep
|
||||
state: latest
|
||||
become: true
|
90
roles/tmux/files/.tmux.conf
Normal file
90
roles/tmux/files/.tmux.conf
Normal file
|
@ -0,0 +1,90 @@
|
|||
unbind C-b
|
||||
set -g prefix C-s
|
||||
|
||||
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
|
||||
|
||||
bind-key -n C-h select-pane -L
|
||||
bind-key -n C-j select-pane -D
|
||||
bind-key -n C-k select-pane -U
|
||||
bind-key -n C-l select-pane -R
|
||||
|
||||
set-option -g status-keys "emacs"
|
||||
set-option -g default-terminal "xterm-256color"
|
||||
set-option -ga terminal-overrides ",*256col*:Tc"
|
||||
|
||||
bind-key - split-window -v -c '#{pane_current_path}'
|
||||
bind-key \\ split-window -h -c '#{pane_current_path}'
|
||||
|
||||
bind -n S-Left resize-pane -L 2
|
||||
bind -n S-Right resize-pane -R 2
|
||||
bind -n S-Down resize-pane -D 1
|
||||
bind -n S-Up resize-pane -U 1
|
||||
|
||||
bind -n C-Left resize-pane -L 10
|
||||
bind -n C-Right resize-pane -R 10
|
||||
bind -n C-Down resize-pane -D 5
|
||||
bind -n C-Up resize-pane -U 5
|
||||
|
||||
set-option -g status-left-length 50
|
||||
set-option -g status-right ""
|
||||
|
||||
bind c new-window -c "#{pane_current_path}"
|
||||
|
||||
set -g base-index 1
|
||||
set -g renumber-windows on
|
||||
|
||||
# Break a pane into a new window.
|
||||
bind-key b break-pane -d
|
||||
|
||||
bind-key C-j choose-tree
|
||||
|
||||
# Use vim keybindings in copy mode
|
||||
setw -g mode-keys vi
|
||||
|
||||
# Setup 'v' to begin selection as in Vim
|
||||
bind-key -T copy-mode-vi 'v' send -X begin-selection
|
||||
bind-key -T copy-mode-vi 'y' send -X copy-pipe "reattach-to-user-namespace pbcopy"
|
||||
|
||||
# Update default binding of `Enter` to also use copy-pipe
|
||||
unbind -T copy-mode-vi Enter
|
||||
bind-key -T copy-mode-vi 'Enter' send -X copy-pipe "reattach-to-user-namespace pbcopy"
|
||||
|
||||
bind C-j split-window -v "tmux list-sessions | sed -E 's/:.*$//' | grep -v \"^$(tmux display-message -p '#S')\$\" | fzf --reverse | xargs tmux switch-client -t"
|
||||
|
||||
bind-key C-b send-keys 'tat && exit' 'C-m'
|
||||
bind-key K run-shell 'tmux switch-client -n \; kill-session -t "$(tmux display-message -p "#S")" || tmux kill-session'
|
||||
|
||||
# Smart pane switching with awareness of Vim splits.
|
||||
# See: https://github.com/christoomey/vim-tmux-navigator
|
||||
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
||||
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
|
||||
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
|
||||
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
|
||||
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
|
||||
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
|
||||
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
|
||||
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
|
||||
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
|
||||
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
|
||||
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
|
||||
|
||||
bind-key -T copy-mode-vi 'C-h' select-pane -L
|
||||
bind-key -T copy-mode-vi 'C-j' select-pane -D
|
||||
bind-key -T copy-mode-vi 'C-k' select-pane -U
|
||||
bind-key -T copy-mode-vi 'C-l' select-pane -R
|
||||
bind-key -T copy-mode-vi 'C-\' select-pane -l
|
||||
|
||||
# Allow clearing screen with ctrl-l by using <prefix> C-l
|
||||
bind C-l send-keys 'C-l'
|
||||
bind C-k send-keys 'C-k'
|
||||
|
||||
# Enable mouse support.
|
||||
setw -g mouse on
|
||||
|
||||
# Plugins
|
||||
set -g @plugin "arcticicestudio/nord-tmux"
|
||||
set -g @plugin 'tmux-plugins/tmux-sensible'
|
||||
set -g @plugin 'tmux-plugins/tpm'
|
||||
|
||||
# Initialize TMUX plugin manager
|
||||
run '~/.tmux/plugins/tpm/tpm'
|
13
roles/tmux/tasks/main.yaml
Normal file
13
roles/tmux/tasks/main.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
- name: Install
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- tmux
|
||||
state: latest
|
||||
become: true
|
||||
|
||||
- name: Link .tmux.conf file
|
||||
ansible.builtin.file:
|
||||
src: "{{ role_path }}/files/.tmux.conf"
|
||||
dest: "{{ ansible_user_dir }}/.tmux.conf"
|
||||
state: link
|
5
roles/zsh-antigen/tasks/main.yaml
Normal file
5
roles/zsh-antigen/tasks/main.yaml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- name: Download
|
||||
get_url:
|
||||
dest: ~/.antigen.zsh
|
||||
url: https://raw.githubusercontent.com/zsh-users/antigen/master/bin/antigen.zsh
|
3
roles/zsh/files/.zsh/completion-scripts/_g
Normal file
3
roles/zsh/files/.zsh/completion-scripts/_g
Normal file
|
@ -0,0 +1,3 @@
|
|||
#compdef g
|
||||
compdef g=git
|
||||
|
2
roles/zsh/files/.zsh/completion-scripts/_m
Normal file
2
roles/zsh/files/.zsh/completion-scripts/_m
Normal file
|
@ -0,0 +1,2 @@
|
|||
#compdef m
|
||||
compdef m=make
|
32
roles/zsh/files/.zsh/configs/aliases.zsh
Normal file
32
roles/zsh/files/.zsh/configs/aliases.zsh
Normal file
|
@ -0,0 +1,32 @@
|
|||
alias c="clear"
|
||||
alias l="ls -lah"
|
||||
|
||||
# Open the current directory in Finder.
|
||||
alias o="open ."
|
||||
|
||||
alias hosts="sudo vim /etc/hosts"
|
||||
alias sshconfig='vim ~/.ssh/config'
|
||||
|
||||
# Pretty print the path.
|
||||
alias path='echo $PATH | tr -s ":" "\n"'
|
||||
|
||||
# Open the current directory in PhpStorm.
|
||||
# Open the current directory in Sublime Text.
|
||||
alias sublime='open -a /Applications/Sublime\ Text.app "`pwd`"'
|
||||
|
||||
# Allow for pasting lines of code that start with a dollar sign.
|
||||
alias \$=''
|
||||
|
||||
# Re-implement pbcopy and pbpaste from macOS.
|
||||
alias pbcopy="xclip -selection clipboard"
|
||||
alias pbpaste="xclip -selection clipboard -o"
|
||||
|
||||
# Include custom aliases
|
||||
if [[ -f ~/.aliases.local ]]; then
|
||||
source ~/.aliases.local
|
||||
fi
|
||||
|
||||
# Open directory aliases
|
||||
if [[ -f $(pwd)/.aliases ]]; then
|
||||
source $(pwd)/.aliases
|
||||
fi
|
4
roles/zsh/files/.zsh/configs/colour.zsh
Normal file
4
roles/zsh/files/.zsh/configs/colour.zsh
Normal file
|
@ -0,0 +1,4 @@
|
|||
autoload -U colors
|
||||
colors
|
||||
|
||||
export CLICOLOR=1
|
38
roles/zsh/files/.zsh/configs/functions.zsh
Normal file
38
roles/zsh/files/.zsh/configs/functions.zsh
Normal file
|
@ -0,0 +1,38 @@
|
|||
function m() {
|
||||
if [[ -f .notes/Makefile ]];
|
||||
then
|
||||
make -f .notes/Makefile "$@"
|
||||
else
|
||||
make "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function mkd() {
|
||||
mkdir -p "$@" && cd "$@"
|
||||
}
|
||||
|
||||
function composer() {
|
||||
docker run -u $UID -it --rm \
|
||||
-v $(pwd):/app \
|
||||
-v ~/.composer:/root/.composer \
|
||||
-v ~/.ssh:/root/.ssh \
|
||||
composer \
|
||||
composer $*
|
||||
}
|
||||
|
||||
# Run 'phpunit' or 'pest' depending on the project.
|
||||
function p () {
|
||||
vendor/bin/$(phpunit-or-pest) $*;
|
||||
}
|
||||
function pf () {
|
||||
vendor/bin/$(phpunit-or-pest) --filter $*
|
||||
}
|
||||
|
||||
nv() {
|
||||
if [[ $# > 0 ]];
|
||||
then
|
||||
nvim $@
|
||||
else
|
||||
nvim .
|
||||
fi
|
||||
}
|
2
roles/zsh/files/.zsh/configs/fzf.zsh
Normal file
2
roles/zsh/files/.zsh/configs/fzf.zsh
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Include keybindings for fzf.
|
||||
. /usr/share/doc/fzf/examples/key-bindings.zsh
|
5
roles/zsh/files/.zsh/configs/general.zsh
Normal file
5
roles/zsh/files/.zsh/configs/general.zsh
Normal file
|
@ -0,0 +1,5 @@
|
|||
precmd() {
|
||||
# Add a blank line before each command.
|
||||
print ''
|
||||
}
|
||||
|
10
roles/zsh/files/.zsh/configs/git.zsh
Normal file
10
roles/zsh/files/.zsh/configs/git.zsh
Normal file
|
@ -0,0 +1,10 @@
|
|||
# No arguments: `git status`
|
||||
# With arguments: acts like `git`
|
||||
g() {
|
||||
if [[ $# > 0 ]];
|
||||
then
|
||||
git $@
|
||||
else
|
||||
git status --short --branch
|
||||
fi
|
||||
}
|
7
roles/zsh/files/.zsh/configs/history.zsh
Normal file
7
roles/zsh/files/.zsh/configs/history.zsh
Normal file
|
@ -0,0 +1,7 @@
|
|||
setopt histignoredups
|
||||
|
||||
setopt inc_append_history
|
||||
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
HISTFILE=~/.cache/zsh/history
|
9
roles/zsh/files/.zsh/configs/navigation.zsh
Normal file
9
roles/zsh/files/.zsh/configs/navigation.zsh
Normal file
|
@ -0,0 +1,9 @@
|
|||
bindkey -s "^f" "tmux-sessioniser\n"
|
||||
|
||||
# Search through history with the up and down arrows.
|
||||
autoload -U up-line-or-beginning-search
|
||||
autoload -U down-line-or-beginning-search
|
||||
zle -N up-line-or-beginning-search
|
||||
zle -N down-line-or-beginning-search
|
||||
bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search # Up
|
||||
bindkey "${terminfo[kcud1]}" up-line-or-beginning-search # Down
|
2
roles/zsh/files/.zsh/configs/nvm.zsh
Normal file
2
roles/zsh/files/.zsh/configs/nvm.zsh
Normal file
|
@ -0,0 +1,2 @@
|
|||
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
3
roles/zsh/files/.zsh/configs/options.zsh
Normal file
3
roles/zsh/files/.zsh/configs/options.zsh
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Fix "zsh: no matches found: HEAD^" error.
|
||||
# See https://github.com/opdavies/dotfiles/issues/14.
|
||||
setopt NO_NOMATCH
|
20
roles/zsh/files/.zsh/configs/path.zsh
Normal file
20
roles/zsh/files/.zsh/configs/path.zsh
Normal file
|
@ -0,0 +1,20 @@
|
|||
setopt auto_cd
|
||||
|
||||
export PATH=\
|
||||
$PATH:\
|
||||
/usr/bin:\
|
||||
$HOME/.composer/vendor/bin:\
|
||||
$HOME/.local/bin:\
|
||||
$HOME/.platformsh/bin:\
|
||||
$HOME/bin:\
|
||||
$HOME/snap/bin:\
|
||||
bin:\
|
||||
node_modules/.bin:\
|
||||
vendor/bin
|
||||
|
||||
export CDPATH=\
|
||||
./:\
|
||||
$HOME/Code:\
|
||||
$HOME/Code/clients:\
|
||||
$HOME/Code/os:\
|
||||
$HOME
|
6
roles/zsh/files/.zsh/configs/platformsh.zsh
Normal file
6
roles/zsh/files/.zsh/configs/platformsh.zsh
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Platform.sh CLI configuration.
|
||||
export PATH="$HOME/"'.platformsh/bin':"$PATH"
|
||||
|
||||
if [ -f "$HOME/"'.platformsh/shell-config.rc' ]; then
|
||||
. "$HOME/"'.platformsh/shell-config.rc';
|
||||
fi
|
10
roles/zsh/files/.zsh/configs/plugins.zsh
Normal file
10
roles/zsh/files/.zsh/configs/plugins.zsh
Normal file
|
@ -0,0 +1,10 @@
|
|||
# antigen.zsh has been downloaded manually for now,
|
||||
# see https://github.com/zsh-users/antigen/issues/659.
|
||||
source $HOME/.antigen.zsh
|
||||
|
||||
antigen bundle mollifier/cd-gitroot
|
||||
antigen bundle zsh-users/zsh-autosuggestions
|
||||
antigen bundle zsh-users/zsh-completions
|
||||
antigen bundle zsh-users/zsh-syntax-highlighting
|
||||
|
||||
antigen apply
|
BIN
roles/zsh/files/.zsh/configs/plugins.zsh.zwc
Normal file
BIN
roles/zsh/files/.zsh/configs/plugins.zsh.zwc
Normal file
Binary file not shown.
18
roles/zsh/files/.zsh/configs/post/completion.zsh
Normal file
18
roles/zsh/files/.zsh/configs/post/completion.zsh
Normal file
|
@ -0,0 +1,18 @@
|
|||
# load our own completion functions
|
||||
fpath=(~/.zsh/completion-scripts /usr/local/share/zsh/site-functions $fpath)
|
||||
|
||||
# completion; use cache if updated within 24h
|
||||
autoload -Uz compinit
|
||||
if [[ -n $HOME/.zcompdump(#qN.mh+24) ]]; then
|
||||
compinit -d $HOME/.zcompdump;
|
||||
else
|
||||
compinit -C;
|
||||
fi;
|
||||
|
||||
# disable zsh bundled function mtools command mcd
|
||||
# which causes a conflict.
|
||||
compdef -d mcd
|
||||
|
||||
## case-insensitive (all), partial-word and then substring completion
|
||||
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' \
|
||||
'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
45
roles/zsh/files/.zsh/configs/prompt.zsh
Normal file
45
roles/zsh/files/.zsh/configs/prompt.zsh
Normal file
|
@ -0,0 +1,45 @@
|
|||
source /usr/lib/git-core/git-sh-prompt
|
||||
|
||||
git_is_repo() {
|
||||
if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == "true" ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
git_current_branch() {
|
||||
echo $(git rev-parse --abbrev-ref HEAD)
|
||||
}
|
||||
|
||||
git_repo_is_dirty() {
|
||||
if [[ -z $(git status --short) ]]; then
|
||||
return 1;
|
||||
fi
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
git_prompt_info() {
|
||||
! git_is_repo || return
|
||||
|
||||
current_branch=$(git_current_branch 2> /dev/null)
|
||||
current_commit=$(git rev-parse --short HEAD 2> /dev/null)
|
||||
suffix=''
|
||||
|
||||
if [[ ! -z ${current_commit} ]]; then
|
||||
suffix="${suffix} [%{$fg_bold[yellow]%}${current_commit}%{$reset_color%}]"
|
||||
fi
|
||||
|
||||
if git_repo_is_dirty; then
|
||||
suffix="${suffix} %{$fg_bold[red]%}*%{$reset_color%}"
|
||||
fi
|
||||
|
||||
if [[ -n git_current_branch ]]; then
|
||||
echo " %{$fg_bold[green]%}$(__git_ps1 %s)%{$reset_color%}${suffix}"
|
||||
fi
|
||||
}
|
||||
|
||||
setopt promptsubst
|
||||
|
||||
export PS1='${SSH_CONNECTION+"%{$fg_bold[green]%}%n@%m:"}%{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) \$ '
|
4
roles/zsh/files/.zshenv
Normal file
4
roles/zsh/files/.zshenv
Normal file
|
@ -0,0 +1,4 @@
|
|||
PROMPT_EOL_MARK=''
|
||||
TERM=xterm-256color
|
||||
WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
|
||||
ZLE_REMOVE_SUFFIX_CHARS=''
|
37
roles/zsh/files/.zshrc
Normal file
37
roles/zsh/files/.zshrc
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Enable extended globbing for use in _load_settings()
|
||||
setopt extendedglob
|
||||
|
||||
# extra files in ~/.zsh/configs/pre , ~/.zsh/configs , and ~/.zsh/configs/post
|
||||
# these are loaded first, second, and third, respectively.
|
||||
_load_settings() {
|
||||
_dir="$1"
|
||||
if [ -d "$_dir" ]; then
|
||||
if [ -d "$_dir/pre" ]; then
|
||||
for config in "$_dir"/pre/**/*~*.zwc(N-.); do
|
||||
. $config
|
||||
done
|
||||
fi
|
||||
|
||||
for config in "$_dir"/**/*(N-.); do
|
||||
case "$config" in
|
||||
"$_dir"/(pre|post)/*|*.zwc)
|
||||
:
|
||||
;;
|
||||
*)
|
||||
. $config
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -d "$_dir/post" ]; then
|
||||
for config in "$_dir"/post/**/*~*.zwc(N-.); do
|
||||
. $config
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
_load_settings "$HOME/.zsh/configs"
|
||||
|
||||
# Local config
|
||||
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local
|
23
roles/zsh/tasks/main.yaml
Normal file
23
roles/zsh/tasks/main.yaml
Normal file
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
- name: Install
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- zsh
|
||||
state: latest
|
||||
become: true
|
||||
|
||||
- name: Set default
|
||||
user:
|
||||
name: "{{ ansible_env['USER'] }}"
|
||||
shell: /usr/bin/zsh
|
||||
become: yes
|
||||
|
||||
- name: Configuration
|
||||
ansible.builtin.file:
|
||||
src: "{{ role_path }}/files/{{ item }}"
|
||||
dest: "{{ ansible_user_dir }}/{{ item }}"
|
||||
state: link
|
||||
with_items:
|
||||
- .zsh
|
||||
- .zshenv
|
||||
- .zshrc
|
Loading…
Add table
Add a link
Reference in a new issue