roles: add tmux + git; nvim: more mappings for telescope-symbols.nvim

This commit is contained in:
Hoang Nguyen 2021-11-17 22:39:12 +07:00
parent 17038fb5fc
commit ba851f8dbe
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
10 changed files with 159 additions and 4 deletions

View File

@ -14,4 +14,6 @@
- amfora
- bash
- foot
- git
- nvim
- tmux

View File

@ -1,6 +1,7 @@
---
user_name: FollieHiyuki
user_email: folliekazetani@protonmail.com
gpg_signature: 813CF484F4993419
default_browser: qutebrowser
term_font: Iosevka Nerd Font
cjk_font: Sarasa Mono J

11
roles/git/tasks/main.yml Normal file
View File

@ -0,0 +1,11 @@
---
- name: Create config directory
file:
path: ~/.config/git
state: directory
- name: Copy config
template:
src: config.j2
dest: ~/.config/git/config
force: yes

View File

@ -0,0 +1,45 @@
[http]
sslverify = true
[commit]
gpgsign = true
[user]
name = {{ user_name }}
email = {{ user_email }}
signingkey = {{ gpg_signature }}
[core]
editor = nvim
whitespace = trailing-space
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[rebase]
autosquash = true
[pull]
rebase = true
[fetch]
prune = true
[init]
defaultBranch = main
[push]
followTags = true
[help]
autocorrect = 1
[submodule]
recurse = true
[alias]
l = log --graph --pretty=format:'%C(italic)%t%Creset %C(bold)<%an>%Creset -> %C(bold)%d%Creset %C(blue)%s%Creset - %C(italic)(%cr)%Creset'
s = status -sbu
sbu = submodule update --remote --merge
unstage = reset HEAD
[url "https://github.com/"]
insteadOf = gh:
[url "https://gitlab.com/"]
insteadOf = gl:
[url "https://git.disroot.org/"]
insteadOf = dr:
[url "https://codeberg.org/"]
insteadOf = cb:
[url "https://git.sr.ht/~"]
insteadOf = sr:

View File

@ -147,7 +147,17 @@ local normal_leader_mappings = {
g = {':Telescope live_grep<CR>', 'Live grep'},
h = {':Telescope help_tags<CR>', 'Help tags'},
i = {':Telescope highlights<CR>', 'Highlight groups'},
j = {':Telescope symbols<CR>', 'Pick emojis'},
j = {
name = 'Symbols',
g = 'Gitmoji',
h = {':Telescope symbols<CR>', 'All symbols'},
j = 'Emoji',
k = 'Kaomoji',
l = 'Julia',
m = 'Math symbols',
n = 'Nerd-fonts symbols',
t = 'Latex symbols'
},
k = {':Telescope keymaps<CR>', 'Normal keymaps'},
m = {':Telescope marks<CR>', 'Bookmarks'},
n = {':Telescope man_pages<CR>', 'Man pages'},

View File

@ -51,6 +51,15 @@ function M.telescope_conf()
-- wrap lines inside preview pane
vim.api.nvim_command('autocmd User TelescopePreviewerLoaded setlocal wrap')
-- Mappings for telescope-symbols.nvim
vim.api.nvim_set_keymap('n', '<leader>fjg', ':lua require("telescope.builtin").symbols{sources = {"gitmoji"}, prompt_title = "Gitmoji"}<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>fjj', ':lua require("telescope.builtin").symbols{sources = {"emoji"}, prompt_title = "Emoji"}<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>fjk', ':lua require("telescope.builtin").symbols{sources = {"kaomoji"}, prompt_title = "Kaomoji"}<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>fjl', ':lua require("telescope.builtin").symbols{sources = {"julia"}, prompt_title = "Julia symbols"}<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>fjm', ':lua require("telescope.builtin").symbols{sources = {"math"}, prompt_title = "Math symbols"}<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>fjn', ':lua require("telescope.builtin").symbols{sources = {"nerd"}, prompt_title = "Nerd-fonts symbols"}<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>fjt', ':lua require("telescope.builtin").symbols{sources = {"latex"}, prompt_title = "Latex symbols"}<CR>', {noremap = true, silent = true})
end
function M.octo_conf()

View File

@ -499,7 +499,7 @@ function M.gitsigns_conf()
['v <leader>gr'] = ':lua require"gitsigns".reset_hunk({vim.fn.line("."), vim.fn.line("v")})<CR>',
['n <leader>gR'] = ':lua require"gitsigns".reset_buffer()<CR>',
['n <leader>gp'] = ':lua require"gitsigns".preview_hunk()<CR>',
['n <leader>gb'] = ':lua require"gitsigns".blame_line(true)<CR>',
['n <leader>gb'] = ':lua require"gitsigns".blame_line{full = true}<CR>',
['n <leader>gS'] = ':lua require"gitsigns".stage_buffer()<CR>',
['n <leader>gU'] = ':lua require"gitsigns".reset_buffer_index()<CR>',
@ -516,7 +516,8 @@ function M.gitsigns_conf()
current_line_blame_opts = {
delay = 1000,
virt_text = true,
virt_text_pos = 'right_align'
virt_text_pos = 'right_align',
ignore_whitespace = false
},
current_line_blame_formatter_opts = {
relative_time = false

View File

@ -321,6 +321,7 @@ local tools = require('modules.tools')
local tools_plugins = function(use)
use { -- TODO: check out fzf-lua
'nvim-telescope/telescope.nvim',
keys = '<leader>fj',
cmd = 'Telescope',
wants = {
'popup.nvim',
@ -439,7 +440,7 @@ local tools_plugins = function(use)
config = tools.winshift_conf
}
use {
'FollieHiyuki/window-picker.nvim',
'ten3roberts/window-picker.nvim',
cmd = {'WindowPick', 'WindowSwap', 'WindowSwapStay'},
config = tools.winpicker_conf
}

18
roles/tmux/tasks/main.yml Normal file
View File

@ -0,0 +1,18 @@
---
- name: Create config directory
file:
path: ~/.config/tmux
state: directory
- name: Copy config
template:
src: tmux.j2
dest: ~/.config/tmux/tmux.conf
force: yes
- name: Clone tpm
git:
depth: 1
update: yes
repo: https://github.com/tmux-plugins/tpm.git
dest: ~/.config/tmux/plugins/tpm

View File

@ -0,0 +1,57 @@
# delay between prefix and command
set -s escape-time 0
# start with 1 instead of 0
set -g base-index 1
set -g pane-base-index 1
# increase scrollback buffer size
set -g history-limit 50000
# tmux messages are displayed for 4 seconds
set -g display-time 4000
# refresh 'status-left' and 'status-right' more often
set -g status-interval 5
# upgrade $TERM for 24-bit colors
set -g default-terminal "screen-256color"
set-option -ga terminal-overrides ",screen-256color:Tc"
# no vim keys -_-
set -g status-keys emacs
# focus events enabled for terminals that support them
set -g focus-events on
# enable mouse
set -g mouse on
# super useful when using "grouped sessions" and multi-monitor setup
setw -g aggressive-resize on
# ______________ _____
# ___ __ \__ /___ ________ ___(_)______________
# __ /_/ /_ /_ / / /_ __ `/_ /__ __ \_ ___/
# _ ____/_ / / /_/ /_ /_/ /_ / _ / / /(__ )
# /_/ /_/ \__,_/ _\__, / /_/ /_/ /_//____/
# /____/
#
# Custom plugins' settings
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_show_sync_mode 'on'
set -g @prefix_highlight_prefix_prompt 'Wait'
set -g @prefix_highlight_copy_prompt 'Copy'
set -g @prefix_highlight_sync_prompt 'Sync'
set -g @tmux_nordone_theme '{{ theme }}'
# Load plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'https://git.disroot.org/FollieHiyuki/tmux-nordone'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'sainnhe/tmux-fzf'
run '~/.config/tmux/plugins/tpm/tpm'