roles: add alacritty, palette; nvim: refactor mappings
This commit is contained in:
parent
7106c2335c
commit
041f076d07
|
@ -0,0 +1 @@
|
||||||
|
palette.yml
|
|
@ -1,11 +1,12 @@
|
||||||
## dotfiles v2
|
## dotfiles v2
|
||||||
|
|
||||||
This is the continuation of my old dotfiles, which now only contains stuff I really need.
|
This is the continuation of [my old dotfiles](https://git.disroot.org/FollieHiyuki/dotfiles), now contains only stuff I really need.
|
||||||
|
|
||||||
Managed with `ansible`.
|
Managed with `ansible`.
|
||||||
|
|
||||||
### Notes
|
### 📓 Notes
|
||||||
|
|
||||||
I use Alpine-edge aka. the best binary distro on Earth :). Therefore some tasks won't work on other distros (eg. `apk` tasks)
|
I use Alpine-edge aka. the best binary distro on Earth 😃. Therefore some tasks won't work on other distros (eg. `apk` tasks)
|
||||||
|
|
||||||
### 🌟 Credits
|
### 🌟 Credits
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
[defaults]
|
||||||
|
inventory = ./hosts
|
||||||
|
display_skipped_hosts = False
|
||||||
|
host_key_checking = False
|
||||||
|
interpreter_python = auto_silent
|
14
dotfiles.yml
14
dotfiles.yml
|
@ -1,4 +1,14 @@
|
||||||
- name: Setup local dotfiles
|
---
|
||||||
hosts: localhost
|
- hosts: all
|
||||||
|
gather_facts: yes
|
||||||
|
|
||||||
|
- hosts: all
|
||||||
roles:
|
roles:
|
||||||
|
- palette
|
||||||
|
|
||||||
|
- hosts: all
|
||||||
|
vars_files:
|
||||||
|
- '{{ ansible_env.PWD }}/palette.yml'
|
||||||
|
roles:
|
||||||
|
- alacritty
|
||||||
- nvim
|
- nvim
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
user_name: FollieHiyuki
|
||||||
|
user_email: folliekazetani@protonmail.com
|
||||||
|
term_font: Iosevka Nerd Font
|
||||||
|
cjk_font: Sarasa Mono J
|
||||||
|
theme: nord
|
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
- name: Create config directory
|
||||||
|
file:
|
||||||
|
path: ~/.config/alacritty
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Copy config
|
||||||
|
template:
|
||||||
|
src: alacritty.j2
|
||||||
|
dest: ~/.config/alacritty/alacritty.yml
|
||||||
|
force: yes
|
|
@ -0,0 +1,373 @@
|
||||||
|
# Configuration for Alacritty, the GPU enhanced terminal emulator.
|
||||||
|
|
||||||
|
env:
|
||||||
|
TERM: alacritty
|
||||||
|
|
||||||
|
window:
|
||||||
|
padding:
|
||||||
|
x: 2
|
||||||
|
y: 2
|
||||||
|
|
||||||
|
dynamic_padding: false
|
||||||
|
|
||||||
|
decorations: none
|
||||||
|
|
||||||
|
title: Alacritty
|
||||||
|
|
||||||
|
class:
|
||||||
|
instance: Alacritty
|
||||||
|
general: Alacritty
|
||||||
|
|
||||||
|
gtk_theme_variant: dark
|
||||||
|
|
||||||
|
dynamic_title: true
|
||||||
|
|
||||||
|
scrolling:
|
||||||
|
history: 50000
|
||||||
|
|
||||||
|
multiplier: 5
|
||||||
|
|
||||||
|
font:
|
||||||
|
normal:
|
||||||
|
family: {{ term_font }}
|
||||||
|
style: Regular
|
||||||
|
|
||||||
|
bold:
|
||||||
|
family: {{ term_font }}
|
||||||
|
style: Bold
|
||||||
|
|
||||||
|
italic:
|
||||||
|
family: {{ term_font }}
|
||||||
|
style: Italic
|
||||||
|
|
||||||
|
bold_italic:
|
||||||
|
family: {{ term_font }}
|
||||||
|
style: Bold Italic
|
||||||
|
|
||||||
|
size: 14
|
||||||
|
|
||||||
|
offset:
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
|
||||||
|
glyph_offset:
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
|
||||||
|
draw_bold_text_with_bright_colors: false
|
||||||
|
|
||||||
|
colors:
|
||||||
|
primary:
|
||||||
|
background: '{{ background }}'
|
||||||
|
foreground: '{{ foreground }}'
|
||||||
|
|
||||||
|
cursor:
|
||||||
|
text: '{{ background }}'
|
||||||
|
cursor: '{{ foreground }}'
|
||||||
|
|
||||||
|
selection:
|
||||||
|
text: '{{ background }}'
|
||||||
|
background: '{{ foreground }}'
|
||||||
|
|
||||||
|
normal:
|
||||||
|
black: '{{ color0 }}'
|
||||||
|
red: '{{ color1 }}'
|
||||||
|
green: '{{ color2 }}'
|
||||||
|
yellow: '{{ color3 }}'
|
||||||
|
blue: '{{ color4 }}'
|
||||||
|
magenta: '{{ color5 }}'
|
||||||
|
cyan: '{{ color6 }}'
|
||||||
|
white: '{{ color7 }}'
|
||||||
|
|
||||||
|
bright:
|
||||||
|
black: '{{ color8 }}'
|
||||||
|
red: '{{ color9 }}'
|
||||||
|
green: '{{ color10 }}'
|
||||||
|
yellow: '{{ color11 }}'
|
||||||
|
blue: '{{ color12 }}'
|
||||||
|
magenta: '{{ color13 }}'
|
||||||
|
cyan: '{{ color14 }}'
|
||||||
|
white: '{{ color15 }}'
|
||||||
|
|
||||||
|
background_opacity: 1.0
|
||||||
|
|
||||||
|
selection:
|
||||||
|
#semantic_escape_chars: ",│`|:\"' ()[]{}<>\t"
|
||||||
|
|
||||||
|
# When set to `true`, selected text will be copied to the primary clipboard.
|
||||||
|
save_to_clipboard: false
|
||||||
|
|
||||||
|
cursor:
|
||||||
|
# Cursor style
|
||||||
|
#
|
||||||
|
# Values for `style`:
|
||||||
|
# - ▇ Block
|
||||||
|
# - _ Underline
|
||||||
|
# - | Beam
|
||||||
|
style: Block
|
||||||
|
#vi_mode_style: None
|
||||||
|
|
||||||
|
# If this is `true`, the cursor will be rendered as a hollow box when the
|
||||||
|
# window is not focused.
|
||||||
|
unfocused_hollow: true
|
||||||
|
|
||||||
|
# Live config reload (changes require restart)
|
||||||
|
live_config_reload: false
|
||||||
|
|
||||||
|
#shell:
|
||||||
|
# program: /bin/bash
|
||||||
|
# args:
|
||||||
|
# - --login
|
||||||
|
|
||||||
|
# Startup directory
|
||||||
|
#
|
||||||
|
# Directory the shell is started in. If this is unset, or `None`, the working
|
||||||
|
# directory of the parent process will be used.
|
||||||
|
working_directory: None
|
||||||
|
|
||||||
|
# Send ESC (\x1b) before characters when alt is pressed.
|
||||||
|
#alt_send_esc: true
|
||||||
|
|
||||||
|
mouse:
|
||||||
|
# Click settings
|
||||||
|
#
|
||||||
|
# The `double_click` and `triple_click` settings control the time
|
||||||
|
# alacritty should wait for accepting multiple clicks as one double
|
||||||
|
# or triple click.
|
||||||
|
double_click: { threshold: 300 }
|
||||||
|
triple_click: { threshold: 300 }
|
||||||
|
|
||||||
|
# If this is `true`, the cursor is temporarily hidden when typing.
|
||||||
|
hide_when_typing: true
|
||||||
|
|
||||||
|
url:
|
||||||
|
# URL launcher
|
||||||
|
#
|
||||||
|
# This program is executed when clicking on a text which is recognized as a URL.
|
||||||
|
# The URL is always added to the command as the last parameter.
|
||||||
|
#
|
||||||
|
# When set to `None`, URL launching will be disabled completely.
|
||||||
|
#
|
||||||
|
# Default:
|
||||||
|
# - (macOS) open
|
||||||
|
# - (Linux/BSD) xdg-open
|
||||||
|
# - (Windows) explorer
|
||||||
|
launcher:
|
||||||
|
program: xdg-open
|
||||||
|
args: []
|
||||||
|
|
||||||
|
# URL modifiers
|
||||||
|
#
|
||||||
|
# These are the modifiers that need to be held down for opening URLs when clicking
|
||||||
|
# on them. The available modifiers are documented in the key binding section.
|
||||||
|
modifiers: None
|
||||||
|
|
||||||
|
# Mouse bindings
|
||||||
|
#
|
||||||
|
# Mouse bindings are specified as a list of objects, much like the key
|
||||||
|
# bindings further below.
|
||||||
|
#
|
||||||
|
# To trigger mouse bindings when an application running within Alacritty captures the mouse, the
|
||||||
|
# `Shift` modifier is automatically added as a requirement.
|
||||||
|
#
|
||||||
|
# Each mouse binding will specify a:
|
||||||
|
#
|
||||||
|
# - `mouse`:
|
||||||
|
#
|
||||||
|
# - Middle
|
||||||
|
# - Left
|
||||||
|
# - Right
|
||||||
|
# - Numeric identifier such as `5`
|
||||||
|
#
|
||||||
|
# - `action` (see key bindings)
|
||||||
|
#
|
||||||
|
# And optionally:
|
||||||
|
#
|
||||||
|
# - `mods` (see key bindings)
|
||||||
|
mouse_bindings:
|
||||||
|
- { mouse: Middle, action: PasteSelection }
|
||||||
|
|
||||||
|
# Key bindings
|
||||||
|
#
|
||||||
|
# Key bindings are specified as a list of objects. For example, this is the
|
||||||
|
# default paste binding:
|
||||||
|
#
|
||||||
|
# `- { key: V, mods: Control|Shift, action: Paste }`
|
||||||
|
#
|
||||||
|
# Each key binding will specify a:
|
||||||
|
#
|
||||||
|
# - `key`: Identifier of the key pressed
|
||||||
|
#
|
||||||
|
# - A-Z
|
||||||
|
# - F1-F24
|
||||||
|
# - Key0-Key9
|
||||||
|
#
|
||||||
|
# A full list with available key codes can be found here:
|
||||||
|
# https://docs.rs/glutin/*/glutin/event/enum.VirtualKeyCode.html#variants
|
||||||
|
#
|
||||||
|
# Instead of using the name of the keys, the `key` field also supports using
|
||||||
|
# the scancode of the desired key. Scancodes have to be specified as a
|
||||||
|
# decimal number. This command will allow you to display the hex scancodes
|
||||||
|
# for certain keys:
|
||||||
|
#
|
||||||
|
# `showkey --scancodes`.
|
||||||
|
#
|
||||||
|
# Then exactly one of:
|
||||||
|
#
|
||||||
|
# - `chars`: Send a byte sequence to the running application
|
||||||
|
#
|
||||||
|
# The `chars` field writes the specified string to the terminal. This makes
|
||||||
|
# it possible to pass escape sequences. To find escape codes for bindings
|
||||||
|
# like `PageUp` (`"\x1b[5~"`), you can run the command `showkey -a` outside
|
||||||
|
# of tmux. Note that applications use terminfo to map escape sequences back
|
||||||
|
# to keys. It is therefore required to update the terminfo when changing an
|
||||||
|
# escape sequence.
|
||||||
|
#
|
||||||
|
# - `action`: Execute a predefined action
|
||||||
|
#
|
||||||
|
# - Copy
|
||||||
|
# - Paste
|
||||||
|
# - PasteSelection
|
||||||
|
# - IncreaseFontSize
|
||||||
|
# - DecreaseFontSize
|
||||||
|
# - ResetFontSize
|
||||||
|
# - ScrollPageUp
|
||||||
|
# - ScrollPageDown
|
||||||
|
# - ScrollLineUp
|
||||||
|
# - ScrollLineDown
|
||||||
|
# - ScrollToTop
|
||||||
|
# - ScrollToBottom
|
||||||
|
# - ClearHistory
|
||||||
|
# - Hide
|
||||||
|
# - Minimize
|
||||||
|
# - Quit
|
||||||
|
# - ToggleFullscreen
|
||||||
|
# - SpawnNewInstance
|
||||||
|
# - ClearLogNotice
|
||||||
|
# - ReceiveChar
|
||||||
|
# - None
|
||||||
|
#
|
||||||
|
# (macOS only):
|
||||||
|
# - ToggleSimpleFullscreen: Enters fullscreen without occupying another space
|
||||||
|
#
|
||||||
|
# - `command`: Fork and execute a specified command plus arguments
|
||||||
|
#
|
||||||
|
# The `command` field must be a map containing a `program` string and an
|
||||||
|
# `args` array of command line parameter strings. For example:
|
||||||
|
# `{ program: "alacritty", args: ["-e", "vttest"] }`
|
||||||
|
#
|
||||||
|
# And optionally:
|
||||||
|
#
|
||||||
|
# - `mods`: Key modifiers to filter binding actions
|
||||||
|
#
|
||||||
|
# - Command
|
||||||
|
# - Control
|
||||||
|
# - Option
|
||||||
|
# - Super
|
||||||
|
# - Shift
|
||||||
|
# - Alt
|
||||||
|
#
|
||||||
|
# Multiple `mods` can be combined using `|` like this:
|
||||||
|
# `mods: Control|Shift`.
|
||||||
|
# Whitespace and capitalization are relevant and must match the example.
|
||||||
|
#
|
||||||
|
# - `mode`: Indicate a binding for only specific terminal reported modes
|
||||||
|
#
|
||||||
|
# This is mainly used to send applications the correct escape sequences
|
||||||
|
# when in different modes.
|
||||||
|
#
|
||||||
|
# - AppCursor
|
||||||
|
# - AppKeypad
|
||||||
|
# - Alt
|
||||||
|
#
|
||||||
|
# A `~` operator can be used before a mode to apply the binding whenever
|
||||||
|
# the mode is *not* active, e.g. `~Alt`.
|
||||||
|
#
|
||||||
|
# Bindings are always filled by default, but will be replaced when a new
|
||||||
|
# binding with the same triggers is defined. To unset a default binding, it can
|
||||||
|
# be mapped to the `ReceiveChar` action. Alternatively, you can use `None` for
|
||||||
|
# a no-op if you do not wish to receive input characters for that binding.
|
||||||
|
#
|
||||||
|
# If the same trigger is assigned to multiple actions, all of them are executed
|
||||||
|
# at once.
|
||||||
|
key_bindings:
|
||||||
|
- { key: V, mods: Control|Shift, action: Paste }
|
||||||
|
- { key: C, mods: Control|Shift, action: Copy }
|
||||||
|
- { key: Insert, mods: Shift, action: PasteSelection }
|
||||||
|
- { key: Key0, mods: Control, action: ResetFontSize }
|
||||||
|
- { key: Equals, mods: Control, action: IncreaseFontSize }
|
||||||
|
- { key: Minus, mods: Control, action: DecreaseFontSize }
|
||||||
|
|
||||||
|
- { key: Paste, action: Paste }
|
||||||
|
- { key: Copy, action: Copy }
|
||||||
|
- { key: L, mods: Control, action: ClearLogNotice }
|
||||||
|
- { key: L, mods: Control, chars: "\x0c" }
|
||||||
|
- { key: PageUp, mods: Shift, action: ScrollPageUp, mode: ~Alt }
|
||||||
|
- { key: PageDown, mods: Shift, action: ScrollPageDown, mode: ~Alt }
|
||||||
|
- { key: Home, mods: Shift, action: ScrollToTop, mode: ~Alt }
|
||||||
|
- { key: End, mods: Shift, action: ScrollToBottom, mode: ~Alt }
|
||||||
|
|
||||||
|
# Vi Mode
|
||||||
|
- { key: Space, mods: Shift|Control, mode: Vi, action: ScrollToBottom }
|
||||||
|
- { key: Space, mods: Shift|Control, action: ToggleViMode }
|
||||||
|
- { key: Escape, mode: Vi, action: ClearSelection }
|
||||||
|
- { key: I, mode: Vi, action: ScrollToBottom }
|
||||||
|
- { key: I, mode: Vi, action: ToggleViMode }
|
||||||
|
- { key: Y, mods: Control, mode: Vi, action: ScrollLineUp }
|
||||||
|
- { key: E, mods: Control, mode: Vi, action: ScrollLineDown }
|
||||||
|
- { key: G, mode: Vi, action: ScrollToTop }
|
||||||
|
- { key: G, mods: Shift, mode: Vi, action: ScrollToBottom }
|
||||||
|
- { key: B, mods: Control, mode: Vi, action: ScrollPageUp }
|
||||||
|
- { key: F, mods: Control, mode: Vi, action: ScrollPageDown }
|
||||||
|
- { key: U, mods: Control, mode: Vi, action: ScrollHalfPageUp }
|
||||||
|
- { key: D, mods: Control, mode: Vi, action: ScrollHalfPageDown }
|
||||||
|
- { key: Y, mode: Vi, action: Copy }
|
||||||
|
- { key: Y, mode: Vi, action: ClearSelection }
|
||||||
|
- { key: Copy, mode: Vi, action: ClearSelection }
|
||||||
|
- { key: V, mode: Vi, action: ToggleNormalSelection }
|
||||||
|
- { key: V, mods: Shift, mode: Vi, action: ToggleLineSelection }
|
||||||
|
- { key: V, mods: Control, mode: Vi, action: ToggleBlockSelection }
|
||||||
|
- { key: V, mods: Alt, mode: Vi, action: ToggleSemanticSelection }
|
||||||
|
- { key: Return, mode: Vi, action: Open }
|
||||||
|
- { key: K, mode: Vi, action: Up }
|
||||||
|
- { key: J, mode: Vi, action: Down }
|
||||||
|
- { key: H, mode: Vi, action: Left }
|
||||||
|
- { key: L, mode: Vi, action: Right }
|
||||||
|
- { key: Up, mode: Vi, action: Up }
|
||||||
|
- { key: Down, mode: Vi, action: Down }
|
||||||
|
- { key: Left, mode: Vi, action: Left }
|
||||||
|
- { key: Right, mode: Vi, action: Right }
|
||||||
|
- { key: Key0, mode: Vi, action: First }
|
||||||
|
- { key: Key4, mods: Shift, mode: Vi, action: Last }
|
||||||
|
- { key: Key6, mods: Shift, mode: Vi, action: FirstOccupied }
|
||||||
|
- { key: H, mods: Shift, mode: Vi, action: High }
|
||||||
|
- { key: M, mods: Shift, mode: Vi, action: Middle }
|
||||||
|
- { key: L, mods: Shift, mode: Vi, action: Low }
|
||||||
|
- { key: B, mode: Vi, action: SemanticLeft }
|
||||||
|
- { key: W, mode: Vi, action: SemanticRight }
|
||||||
|
- { key: E, mode: Vi, action: SemanticRightEnd }
|
||||||
|
- { key: B, mods: Shift, mode: Vi, action: WordLeft }
|
||||||
|
- { key: W, mods: Shift, mode: Vi, action: WordRight }
|
||||||
|
- { key: E, mods: Shift, mode: Vi, action: WordRightEnd }
|
||||||
|
- { key: Key5, mods: Shift, mode: Vi, action: Bracket }
|
||||||
|
- { key: Slash, mode: Vi, action: SearchForward }
|
||||||
|
- { key: Slash, mods: Shift, mode: Vi, action: SearchBackward }
|
||||||
|
- { key: N, mode: Vi, action: SearchNext }
|
||||||
|
- { key: N, mods: Shift, mode: Vi, action: SearchPrevious }
|
||||||
|
|
||||||
|
debug:
|
||||||
|
render_timer: false
|
||||||
|
persistent_logging: false
|
||||||
|
|
||||||
|
# Log level
|
||||||
|
#
|
||||||
|
# Values for `log_level`:
|
||||||
|
# - None
|
||||||
|
# - Error
|
||||||
|
# - Warn
|
||||||
|
# - Info
|
||||||
|
# - Debug
|
||||||
|
# - Trace
|
||||||
|
log_level: Warn
|
||||||
|
|
||||||
|
print_events: false
|
|
@ -1,13 +1,11 @@
|
||||||
local async
|
|
||||||
async = vim.loop.new_async(vim.schedule_wrap(function()
|
|
||||||
require('autocmd')
|
|
||||||
require('plugins')
|
|
||||||
require('mappings')
|
|
||||||
async:close()
|
|
||||||
end))
|
|
||||||
|
|
||||||
local options = require('options')
|
local options = require('options')
|
||||||
|
|
||||||
options.disable_default_plugins()
|
options.disable_default_plugins()
|
||||||
options.load_options()
|
options.load_options()
|
||||||
async:send()
|
require('mappings').setup()
|
||||||
|
require('autocmd').setup()
|
||||||
|
|
||||||
|
-- packer_compiled.lua exists, so don't need to load this early
|
||||||
|
vim.defer_fn(function()
|
||||||
|
require('plugins')
|
||||||
|
end, 0)
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
local definitions = {
|
local M = {}
|
||||||
|
|
||||||
|
local augroups = {
|
||||||
bufs = {
|
bufs = {
|
||||||
-- Reload vim config automatically
|
-- Reload vim config automatically
|
||||||
{'BufWritePost', [[$VIM_PATH/{*.vim,*.yaml,vimrc} nested source $MYVIMRC | redraw]]},
|
{'BufWritePost', [[$VIM_PATH/{*.vim,*.yaml,vimrc} nested source $MYVIMRC | redraw]]},
|
||||||
|
@ -26,12 +28,20 @@ local definitions = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for group_name, definition in pairs(definitions) do
|
local load_autocmd = function(definitions)
|
||||||
vim.api.nvim_command('augroup ' .. group_name)
|
for group_name, definition in pairs(definitions) do
|
||||||
vim.api.nvim_command('autocmd!')
|
vim.api.nvim_command('augroup ' .. group_name)
|
||||||
for _, def in ipairs(definition) do
|
vim.api.nvim_command('autocmd!')
|
||||||
local command = table.concat(vim.tbl_flatten{'autocmd', def}, ' ')
|
for _, def in ipairs(definition) do
|
||||||
vim.api.nvim_command(command)
|
local command = table.concat(vim.tbl_flatten{'autocmd', def}, ' ')
|
||||||
|
vim.api.nvim_command(command)
|
||||||
|
end
|
||||||
|
vim.api.nvim_command('augroup END')
|
||||||
end
|
end
|
||||||
vim.api.nvim_command('augroup END')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
load_autocmd(augroups)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
|
@ -1,29 +1,8 @@
|
||||||
local api = vim.api
|
local api = vim.api
|
||||||
local wk = require('which-key')
|
local wk = require('which-key')
|
||||||
|
local M = {}
|
||||||
|
|
||||||
-- Escape to normal mode in terminal buffer
|
local normal_mappings = {
|
||||||
api.nvim_set_keymap('t', '<Esc>', '<C-\\><C-n>', {noremap = true, silent = true})
|
|
||||||
|
|
||||||
-- Continuous indent
|
|
||||||
api.nvim_set_keymap('v', '<', '<gv', {noremap = true, silent = true})
|
|
||||||
api.nvim_set_keymap('v', '>', '>gv', {noremap = true, silent = true})
|
|
||||||
|
|
||||||
-- Also move up/down virual lines (:set wrap)
|
|
||||||
api.nvim_set_keymap('n', 'j', 'gj', {noremap = true, silent = true})
|
|
||||||
api.nvim_set_keymap('n', 'k', 'gk', {noremap = true, silent = true})
|
|
||||||
|
|
||||||
-- winshift.nvim
|
|
||||||
api.nvim_set_keymap('n', '<C-w><C-m>', ':WinShift<CR>', {noremap = true, silent = true})
|
|
||||||
api.nvim_set_keymap('n', '<C-w>m', ':WinShift<CR>', {noremap = true, silent = true})
|
|
||||||
api.nvim_set_keymap('n', '<C-A-h>', ':WinShift left<CR>', {noremap = true, silent = true})
|
|
||||||
api.nvim_set_keymap('n', '<C-A-j>', ':WinShift down<CR>', {noremap = true, silent = true})
|
|
||||||
api.nvim_set_keymap('n', '<C-A-k>', ':WinShift up<CR>', {noremap = true, silent = true})
|
|
||||||
api.nvim_set_keymap('n', '<C-A-l>', ':WinShift right<CR>', {noremap = true, silent = true})
|
|
||||||
|
|
||||||
-----------------
|
|
||||||
-- Normal mode --
|
|
||||||
-----------------
|
|
||||||
wk.register({
|
|
||||||
-- Better Y
|
-- Better Y
|
||||||
Y = {'y$', 'Yank to eol'},
|
Y = {'y$', 'Yank to eol'},
|
||||||
|
|
||||||
|
@ -70,45 +49,16 @@ wk.register({
|
||||||
-- Naming common keys
|
-- Naming common keys
|
||||||
['['] = {
|
['['] = {
|
||||||
name = 'Block motions (previous)',
|
name = 'Block motions (previous)',
|
||||||
d = {':Lspsaga diagnostic_jump_prev<CR>', 'Previous diagnostics'},
|
g = 'Previous git hunk'
|
||||||
g = 'Previous git hunk',
|
|
||||||
m = 'Previous start of outer class',
|
|
||||||
M = 'Previous end of outer class',
|
|
||||||
['['] = 'Previous start of outer function',
|
|
||||||
[']'] = 'Previous end of outer function'
|
|
||||||
},
|
},
|
||||||
[']'] = {
|
[']'] = {
|
||||||
name = 'Block motions (next)',
|
name = 'Block motions (next)',
|
||||||
d = {':Lspsaga diagnostic_jump_next<CR>', 'Next diagnostics'},
|
g = 'Next git hunk'
|
||||||
g = 'Next git hunk',
|
|
||||||
m = 'Next start of outer class',
|
|
||||||
M = 'Next end of outer class',
|
|
||||||
['['] = 'Next start of outer function',
|
|
||||||
[']'] = 'Next end of outer function'
|
|
||||||
},
|
},
|
||||||
g = {
|
g = {
|
||||||
name = 'Goto motions',
|
name = 'Goto motions',
|
||||||
b = {
|
|
||||||
name = 'Block',
|
|
||||||
c = 'Comment'
|
|
||||||
},
|
|
||||||
c = {
|
|
||||||
name = 'Comment',
|
|
||||||
c = 'Current line'
|
|
||||||
},
|
|
||||||
d = {':lua vim.lsp.buf.definition()<CR>', 'Go to definition'},
|
|
||||||
D = {':lua vim.lsp.buf.declaration()<CR>', 'Go to declaration'},
|
|
||||||
i = {':Lspsaga implement<CR>', 'Implementations'},
|
|
||||||
I = {':Telescope lsp_implementations<CR>', 'Implementations (Telescope)'},
|
|
||||||
n = {
|
|
||||||
name = 'Incremental selection',
|
|
||||||
i = 'Initialize selection'
|
|
||||||
},
|
|
||||||
r = {':TroubleToggle lsp_references<CR>', 'References'},
|
|
||||||
R = {':Telescope lsp_references<CR>', 'References (Telescope)'},
|
|
||||||
t = {':TodoTrouble<CR>', 'Todo list'}
|
t = {':TodoTrouble<CR>', 'Todo list'}
|
||||||
},
|
},
|
||||||
K = {':Lspsaga hover_doc<CR>', 'Hover doc'},
|
|
||||||
z = {name = 'Misc utils'},
|
z = {name = 'Misc utils'},
|
||||||
|
|
||||||
-- Move between tabs
|
-- Move between tabs
|
||||||
|
@ -126,54 +76,9 @@ wk.register({
|
||||||
S = {':HopWord<CR>', 'Hop to word'},
|
S = {':HopWord<CR>', 'Hop to word'},
|
||||||
['<C-s>'] = {':HopChar1<CR>', 'Hop to character'},
|
['<C-s>'] = {':HopChar1<CR>', 'Hop to character'},
|
||||||
['<A-s>'] = {':HopPattern<CR>', 'Hop to pattern'}
|
['<A-s>'] = {':HopPattern<CR>', 'Hop to pattern'}
|
||||||
})
|
}
|
||||||
|
|
||||||
-----------------
|
|
||||||
-- Visual mode --
|
|
||||||
-----------------
|
|
||||||
wk.register({
|
|
||||||
a = {
|
|
||||||
c = 'Outer class',
|
|
||||||
f = 'Outer function'
|
|
||||||
},
|
|
||||||
|
|
||||||
i = {
|
|
||||||
c = 'Inner class',
|
|
||||||
f = 'Inner function'
|
|
||||||
},
|
|
||||||
|
|
||||||
g = {
|
|
||||||
c = 'Comment',
|
|
||||||
n = {
|
|
||||||
name = 'Incremental selection',
|
|
||||||
n = 'Increment node',
|
|
||||||
s = 'Increment scope',
|
|
||||||
m = 'Decrement node'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, {mode = 'v'})
|
|
||||||
|
|
||||||
-----------------------------------
|
|
||||||
-- Normal mode (with leader key) --
|
|
||||||
-----------------------------------
|
|
||||||
wk.register({
|
|
||||||
b = {
|
|
||||||
name = 'Buffer',
|
|
||||||
c = {':ColorizerToggle<CR>', 'Colorizer'},
|
|
||||||
d = {
|
|
||||||
name = 'Delete',
|
|
||||||
a = {':BDelete all<CR>', 'All buffers'},
|
|
||||||
d = {':BDelete this<CR>', 'Current buffer'},
|
|
||||||
h = {':BDelete hidden<CR>', 'Hidden buffers'},
|
|
||||||
n = {':BDelete nameless<CR>', 'Buffers without name'},
|
|
||||||
o = {':BDelete other<CR>', 'Other buffers'}
|
|
||||||
},
|
|
||||||
j = {':BufferLineCyclePrev<CR>', 'Previous buffer'},
|
|
||||||
k = {':BufferLineCycleNext<CR>', 'Next buffer'},
|
|
||||||
n = {':enew<CR>', 'New buffer'},
|
|
||||||
u = {':UndotreeToggle<CR>', 'Undotree'}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
local normal_leader_mappings = {
|
||||||
d = {
|
d = {
|
||||||
name = 'DAP',
|
name = 'DAP',
|
||||||
b = 'Toggle breakpoint',
|
b = 'Toggle breakpoint',
|
||||||
|
@ -205,23 +110,22 @@ wk.register({
|
||||||
if venn_enabled == 'nil' then
|
if venn_enabled == 'nil' then
|
||||||
vim.b.venn_enabled = true
|
vim.b.venn_enabled = true
|
||||||
vim.api.nvim_command('setlocal virtualedit=all')
|
vim.api.nvim_command('setlocal virtualedit=all')
|
||||||
-- Draw lines with HJKL keystroke
|
-- Draw lines with WASD keystroke
|
||||||
vim.api.nvim_buf_set_keymap(0, 'n', 'H', '<C-v>h:VBox<CR>', {noremap = true, silent = true})
|
vim.api.nvim_buf_set_keymap(0, 'n', 'A', '<C-v>h:VBox<CR>', {noremap = true, silent = true})
|
||||||
vim.api.nvim_buf_set_keymap(0, 'n', 'J', '<C-v>j:VBox<CR>', {noremap = true, silent = true})
|
vim.api.nvim_buf_set_keymap(0, 'n', 'S', '<C-v>j:VBox<CR>', {noremap = true, silent = true})
|
||||||
vim.api.nvim_buf_set_keymap(0, 'n', 'K', '<C-v>k:VBox<CR>', {noremap = true, silent = true})
|
vim.api.nvim_buf_set_keymap(0, 'n', 'W', '<C-v>k:VBox<CR>', {noremap = true, silent = true})
|
||||||
vim.api.nvim_buf_set_keymap(0, 'n', 'L', '<C-v>l:VBox<CR>', {noremap = true, silent = true})
|
vim.api.nvim_buf_set_keymap(0, 'n', 'D', '<C-v>l:VBox<CR>', {noremap = true, silent = true})
|
||||||
-- Draw boxes by pressing 'f' with visual selection
|
-- Draw boxes by pressing 'f' with visual selection
|
||||||
vim.api.nvim_buf_set_keymap(0, 'v', 'f', ':VBox<CR>', {noremap = true, silent = true})
|
vim.api.nvim_buf_set_keymap(0, 'v', 'f', ':VBox<CR>', {noremap = true, silent = true})
|
||||||
vim.notify('Virtual box edit enabled.', vim.log.levels.INFO)
|
vim.notify('Virtual box edit enabled.', vim.log.levels.INFO)
|
||||||
else
|
else
|
||||||
vim.b.venn_enabled = nil
|
vim.b.venn_enabled = nil
|
||||||
vim.api.nvim_command('setlocal virtualedit=block')
|
vim.api.nvim_command('setlocal virtualedit=block')
|
||||||
-- vim.api.nvim_command('mapclear <buffer>') -- quicker, but also deletes buf keymap for lsp
|
|
||||||
vim.api.nvim_buf_del_keymap(0, 'v', 'f')
|
vim.api.nvim_buf_del_keymap(0, 'v', 'f')
|
||||||
vim.api.nvim_buf_del_keymap(0, 'n', 'H')
|
vim.api.nvim_buf_del_keymap(0, 'n', 'A')
|
||||||
vim.api.nvim_buf_del_keymap(0, 'n', 'J')
|
vim.api.nvim_buf_del_keymap(0, 'n', 'S')
|
||||||
vim.api.nvim_buf_del_keymap(0, 'n', 'K')
|
vim.api.nvim_buf_del_keymap(0, 'n', 'W')
|
||||||
vim.api.nvim_buf_del_keymap(0, 'n', 'L')
|
vim.api.nvim_buf_del_keymap(0, 'n', 'D')
|
||||||
vim.notify('Virtual box edit disabled.', vim.log.levels.INFO)
|
vim.notify('Virtual box edit disabled.', vim.log.levels.INFO)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -287,37 +191,11 @@ wk.register({
|
||||||
c = {'cw<C-R>=system(\'trans -brief -no-ansi :\', getreg(""))[:-2]<S-Left><S-Left><Right>', 'Translate and replace with direction'}
|
c = {'cw<C-R>=system(\'trans -brief -no-ansi :\', getreg(""))[:-2]<S-Left><S-Left><Right>', 'Translate and replace with direction'}
|
||||||
},
|
},
|
||||||
|
|
||||||
l = {
|
|
||||||
name = 'LSP',
|
|
||||||
a = {':lua vim.lsp.buf.add_workspace_folder()<CR>', 'Add workspace folder'},
|
|
||||||
b = {':TroubleToggle lsp_document_diagnostics<CR>', 'Buffer diagnostics'},
|
|
||||||
B = {':Telescope lsp_document_diagnostics<CR>', 'Buffer diagnostics (Telescope)'},
|
|
||||||
c = {':Lspsaga code_action<CR>', 'Code action'},
|
|
||||||
C = {':Telescope lsp_code_actions<CR>', 'Code action (Telescope)'},
|
|
||||||
d = {':TroubleToggle lsp_definitions<CR>', 'Definitions'},
|
|
||||||
D = {':Telescope lsp_definitions<CR>', 'Definitions (Telescope)'},
|
|
||||||
e = {':Lspsaga show_line_diagnostics<CR>', 'Line diagnostics'},
|
|
||||||
f = {':Lspsaga lsp_finder<CR>', 'Finder'},
|
|
||||||
g = {':SymbolsOutline<CR>', 'Symbol outline'},
|
|
||||||
l = {':TroubleToggle loclist<CR>', 'Diagnostics loclist'},
|
|
||||||
n = {':Lspsaga rename<CR>', 'Rename'},
|
|
||||||
o = 'Format buffer',
|
|
||||||
p = {':Lspsaga preview_definition<CR>', 'Preview definition'},
|
|
||||||
r = {':lua vim.lsp.buf.remove_workspace_folder()<CR>', 'Remove workspace folder'},
|
|
||||||
s = {':Telescope lsp_document_symbols<CR>', 'Buffer symbols'},
|
|
||||||
S = {':Telescope lsp_workspace_symbols<CR>', 'Workspace symbols'},
|
|
||||||
t = {':TroubleToggle<CR>', 'Toggle Trouble'},
|
|
||||||
w = {':TroubleToggle lsp_workspace_diagnostics<CR>', 'Workspace diagnostics'},
|
|
||||||
W = {':Telescope lsp_workspace_diagnostics<CR>', 'Workspace diagnostics (Telescope)'},
|
|
||||||
x = {':lua vim.lsp.buf.signature_help()<CR>', 'Signature help'},
|
|
||||||
y = {':lua vim.notify(vim.inspect(vim.lsp.buf.list_workspace_folders()), vim.log.levels.INFO)<CR>', 'List workspace folders'}
|
|
||||||
},
|
|
||||||
|
|
||||||
p = {
|
p = {
|
||||||
name = 'Find/Replace',
|
name = 'Find/Replace',
|
||||||
o = 'Open spectre',
|
o = 'Open spectre',
|
||||||
p = 'Search in current file',
|
p = 'Search in current file',
|
||||||
w = 'Find/replace cursorword'
|
w = 'Find/Replace cursorword'
|
||||||
},
|
},
|
||||||
|
|
||||||
r = {
|
r = {
|
||||||
|
@ -337,14 +215,11 @@ wk.register({
|
||||||
|
|
||||||
w = {':WindowPick<CR>', 'Pick window'}
|
w = {':WindowPick<CR>', 'Pick window'}
|
||||||
|
|
||||||
}, {prefix = '<leader>'})
|
}
|
||||||
|
|
||||||
-----------------------------------
|
local visual_leader_mappings = {
|
||||||
-- Visual mode (with leader key) --
|
e = {
|
||||||
-----------------------------------
|
name = 'Editor',
|
||||||
wk.register({
|
|
||||||
a = {
|
|
||||||
name = 'Action',
|
|
||||||
a = {':EasyAlign<CR>', 'Range align'}
|
a = {':EasyAlign<CR>', 'Range align'}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -368,77 +243,72 @@ wk.register({
|
||||||
c = {'c<C-R>=system(\'trans -brief -no-ansi :\', getreg(""))[:-2]<S-Left><S-Left><Right>', 'Translate and replace with direction'}
|
c = {'c<C-R>=system(\'trans -brief -no-ansi :\', getreg(""))[:-2]<S-Left><S-Left><Right>', 'Translate and replace with direction'}
|
||||||
},
|
},
|
||||||
|
|
||||||
l = {
|
|
||||||
name = 'LSP',
|
|
||||||
c = {':<C-U>Lspsaga range_code_action<CR>', 'Range code action'},
|
|
||||||
C = {':Telescope lsp_range_code_actions<CR>', 'Range code action (Telescope)'},
|
|
||||||
o = 'Range format'
|
|
||||||
},
|
|
||||||
|
|
||||||
p = 'Find/Replace'
|
p = 'Find/Replace'
|
||||||
}, {mode = 'v', prefix = '<leader>'})
|
}
|
||||||
|
|
||||||
------------------------
|
local localleader_mappings = function()
|
||||||
-- Filetype specified --
|
vim.api.nvim_command('autocmd BufReadPre,BufNewFile * lua WhichkeyLocal()')
|
||||||
------------------------
|
function WhichkeyLocal()
|
||||||
-- FIX: not working?????
|
local bufnr = vim.api.nvim_get_current_buf()
|
||||||
vim.api.nvim_command [[
|
wk.register({
|
||||||
autocmd FileType org lua WhichkeyOrg()
|
c = {':ColorizerToggle<CR>', 'Colorizer'},
|
||||||
autocmd FileType markdown lua WhichkeyMarkdown()
|
d = {
|
||||||
autocmd FileType html lua WhichkeyHtml()
|
name = 'Delete',
|
||||||
]]
|
a = {':BDelete all<CR>', 'All buffers'},
|
||||||
|
d = {':BDelete this<CR>', 'Current buffer'},
|
||||||
function WhichkeyOrg()
|
h = {':BDelete hidden<CR>', 'Hidden buffers'},
|
||||||
wk.register({
|
n = {':BDelete nameless<CR>', 'Buffers without name'},
|
||||||
['<leader>o'] = {
|
o = {':BDelete other<CR>', 'Other buffers'}
|
||||||
name = 'Org',
|
|
||||||
a = 'Agenda',
|
|
||||||
A = 'Toggle ARCHIVE',
|
|
||||||
c = 'Capture',
|
|
||||||
e = 'Export',
|
|
||||||
i = {
|
|
||||||
name = 'Insert',
|
|
||||||
h = 'Add headline',
|
|
||||||
t = 'Add TODO heading and content',
|
|
||||||
T = 'Add TODO heading',
|
|
||||||
},
|
},
|
||||||
J = 'Move subtree down',
|
j = {':BufferLineCyclePrev<CR>', 'Previous buffer'},
|
||||||
K = 'Move subtree up',
|
k = {':BufferLineCycleNext<CR>', 'Next buffer'},
|
||||||
o = 'Open at point',
|
n = {':enew<CR>', 'New buffer'},
|
||||||
r = 'Refile',
|
u = {':UndotreeToggle<CR>', 'Undotree'}
|
||||||
t = 'Set tags',
|
}, {buffer = bufnr, prefix = '<localleader>'})
|
||||||
['$'] = 'Archive current headline'
|
end
|
||||||
},
|
|
||||||
['<leader><CR>'] = 'Org meta return',
|
vim.api.nvim_command('autocmd FileType markdown lua WhichkeyMarkdown()')
|
||||||
['<C-a>'] = 'Org increase date',
|
function WhichkeyMarkdown()
|
||||||
['<C-x>'] = 'Org decrease date',
|
wk.register({
|
||||||
['cid'] = 'Org change date',
|
p = {':MarkdownPreviewToggle<CR>', 'Preview markdown'}
|
||||||
['cit'] = 'Org TODO',
|
}, {buffer = vim.api.nvim_get_current_buf(), prefix = '<localleader>'})
|
||||||
['ciT'] = 'Org TODO prev',
|
end
|
||||||
['<C-Space>'] = 'Org toggle checkbox',
|
|
||||||
['<TAB>'] = 'Org cycle folding',
|
vim.api.nvim_command('autocmd FileType html lua WhichkeyHtml()')
|
||||||
['<S-TAB>'] = 'Org cycle global folding',
|
function WhichkeyHtml()
|
||||||
['<<'] = 'Org promote headline',
|
wk.register({
|
||||||
['>>'] = 'Org demote headline',
|
p = {':Bracey<CR>', 'Preview html'}
|
||||||
['<s'] = 'Org prmote subtree',
|
}, {buffer = vim.api.nvim_get_current_buf(), prefix = '<localleader>'})
|
||||||
['>s'] = 'Org demote subtree',
|
end
|
||||||
['}'] = 'Org next visible heading',
|
|
||||||
['{'] = 'Org previous visible heading',
|
|
||||||
[']]'] = 'Org forward heading',
|
|
||||||
['[['] = 'Org backward heading',
|
|
||||||
['g{'] = 'Org parent heading',
|
|
||||||
['?'] = 'Org help'
|
|
||||||
}, {buffer = vim.api.nvim_get_current_buf()})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function WhichkeyMarkdown()
|
local undefined_mappings = function()
|
||||||
wk.register({
|
-- Escape to normal mode in terminal buffer
|
||||||
['<leader>bp'] = {':MarkdownPreviewToggle<CR>', 'Preview markdown'}
|
api.nvim_set_keymap('t', '<Esc>', '<C-\\><C-n>', {noremap = true, silent = true})
|
||||||
}, {buffer = vim.api.nvim_get_current_buf()})
|
|
||||||
|
-- Continuous indent
|
||||||
|
api.nvim_set_keymap('v', '<', '<gv', {noremap = true, silent = true})
|
||||||
|
api.nvim_set_keymap('v', '>', '>gv', {noremap = true, silent = true})
|
||||||
|
|
||||||
|
-- Also move up/down virual lines (:set wrap)
|
||||||
|
api.nvim_set_keymap('n', 'j', 'gj', {noremap = true, silent = true})
|
||||||
|
api.nvim_set_keymap('n', 'k', 'gk', {noremap = true, silent = true})
|
||||||
|
|
||||||
|
-- winshift.nvim
|
||||||
|
api.nvim_set_keymap('n', '<C-w><C-m>', ':WinShift<CR>', {noremap = true, silent = true})
|
||||||
|
api.nvim_set_keymap('n', '<C-w>m', ':WinShift<CR>', {noremap = true, silent = true})
|
||||||
|
api.nvim_set_keymap('n', '<C-A-h>', ':WinShift left<CR>', {noremap = true, silent = true})
|
||||||
|
api.nvim_set_keymap('n', '<C-A-j>', ':WinShift down<CR>', {noremap = true, silent = true})
|
||||||
|
api.nvim_set_keymap('n', '<C-A-k>', ':WinShift up<CR>', {noremap = true, silent = true})
|
||||||
|
api.nvim_set_keymap('n', '<C-A-l>', ':WinShift right<CR>', {noremap = true, silent = true})
|
||||||
end
|
end
|
||||||
|
|
||||||
function WhichkeyHtml()
|
function M.setup()
|
||||||
wk.register({
|
undefined_mappings()
|
||||||
['<leader>bp'] = {':Bracey<CR>', 'Preview html'}
|
localleader_mappings()
|
||||||
}, {buffer = vim.api.nvim_get_current_buf()})
|
wk.register(normal_mappings)
|
||||||
|
wk.register(normal_leader_mappings, {prefix = '<leader>'})
|
||||||
|
wk.register(visual_leader_mappings, {mode = 'v', prefix = '<leader>'})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
|
@ -47,6 +47,101 @@ function M.blankline_conf()
|
||||||
-- vim.api.nvim_command('autocmd CursorMoved * IndentBlanklineRefresh')
|
-- vim.api.nvim_command('autocmd CursorMoved * IndentBlanklineRefresh')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.orgmode_conf()
|
||||||
|
local c = require('themes.' .. vim.g.colors_name .. '.colors')
|
||||||
|
|
||||||
|
require('orgmode').setup {
|
||||||
|
-- General settings
|
||||||
|
org_agenda_files = {'~/Documents/Org/agenda/*'},
|
||||||
|
org_default_notes_file = '~/Documents/Org/notes.org',
|
||||||
|
org_todo_keywords = {
|
||||||
|
'TODO', 'PROJ', 'LOOP', 'STRT', 'WAIT', 'HOLD', 'IDEA', 'DONE', 'KILL',
|
||||||
|
'[ ]', '[-]', '[X]' , '|', 'OKAY', 'YES', 'NO'
|
||||||
|
},
|
||||||
|
org_todo_keyword_faces = {
|
||||||
|
TODO = ':foreground ' .. c.green .. ' :weight bold',
|
||||||
|
PROJ = ':foreground ' .. c.grey_bright .. ' :weight bold :slant italic',
|
||||||
|
LOOP = ':foreground ' .. c.green .. ' :weight bold :underline on',
|
||||||
|
STRT = ':foreground ' .. c.blue .. ' :weight bold',
|
||||||
|
WAIT = ':foreground ' .. c.yellow .. ' :weight bold',
|
||||||
|
HOLD = ':foreground ' .. c.yellow .. ' :weight bold :slant italic',
|
||||||
|
IDEA = ':foreground ' .. c.green .. ' :weight bold :slant italic',
|
||||||
|
DONE = ':foreground ' .. c.grey2 .. ' :weight bold',
|
||||||
|
KILL = ':foreground ' .. c.red .. ' :weight bold',
|
||||||
|
OKAY = ':foreground ' .. c.grey1 .. ' :weight bold :slant italic',
|
||||||
|
YES = ':foreground ' .. c.grey1 .. ' :weight bold :underline on',
|
||||||
|
NO = ':foreground ' .. c.red .. ' :weight bold :underline on'
|
||||||
|
},
|
||||||
|
org_hide_leading_stars = true,
|
||||||
|
org_highlight_latex_and_related = 'entities',
|
||||||
|
|
||||||
|
-- Agenda settings
|
||||||
|
org_deadline_warning_days = 7,
|
||||||
|
org_agenda_span = 'week',
|
||||||
|
org_agenda_start_on_weekday = 7, -- Start a week in Sunday
|
||||||
|
org_agenda_min_height = 15,
|
||||||
|
|
||||||
|
-- Tags settings
|
||||||
|
org_use_tag_inheritance = false
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Define mappings's names
|
||||||
|
vim.api.nvim_command('autocmd FileType org lua WhichkeyOrg()')
|
||||||
|
local wk = require('which-key')
|
||||||
|
function WhichkeyOrg()
|
||||||
|
wk.register({
|
||||||
|
['<leader>o'] = {
|
||||||
|
name = 'Org',
|
||||||
|
a = 'Agenda',
|
||||||
|
A = 'Toggle ARCHIVE',
|
||||||
|
c = 'Capture',
|
||||||
|
e = 'Export',
|
||||||
|
i = {
|
||||||
|
name = 'Insert',
|
||||||
|
h = 'Add headline',
|
||||||
|
t = 'Add TODO heading and content',
|
||||||
|
T = 'Add TODO heading'
|
||||||
|
},
|
||||||
|
J = 'Move subtree down',
|
||||||
|
K = 'Move subtree up',
|
||||||
|
o = 'Open at point',
|
||||||
|
r = 'Refile',
|
||||||
|
t = 'Set tags',
|
||||||
|
['$'] = 'Archive current headline'
|
||||||
|
},
|
||||||
|
['<leader><CR>'] = 'Org meta return',
|
||||||
|
['<C-a>'] = 'Org increase date',
|
||||||
|
['<C-x>'] = 'Org decrease date',
|
||||||
|
['cid'] = 'Org change date',
|
||||||
|
['cit'] = 'Org TODO',
|
||||||
|
['ciT'] = 'Org TODO prev',
|
||||||
|
['<C-Space>'] = 'Org toggle checkbox',
|
||||||
|
['<TAB>'] = 'Org cycle folding',
|
||||||
|
['<S-TAB>'] = 'Org cycle global folding',
|
||||||
|
['<<'] = 'Org promote headline',
|
||||||
|
['>>'] = 'Org demote headline',
|
||||||
|
['<s'] = 'Org prmote subtree',
|
||||||
|
['>s'] = 'Org demote subtree',
|
||||||
|
['}'] = 'Org next visible heading',
|
||||||
|
['{'] = 'Org previous visible heading',
|
||||||
|
[']]'] = 'Org forward heading',
|
||||||
|
['[['] = 'Org backward heading',
|
||||||
|
['g{'] = 'Org parent heading',
|
||||||
|
['?'] = 'Org help'
|
||||||
|
}, {buffer = vim.api.nvim_get_current_buf()})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.bullets_conf()
|
||||||
|
require('org-bullets').setup {
|
||||||
|
symbols = {'', '', '', ''}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.headlines_conf()
|
||||||
|
require('headlines').setup()
|
||||||
|
end
|
||||||
|
|
||||||
function M.treesitter_conf()
|
function M.treesitter_conf()
|
||||||
-- Additional parser for rest.nvim (*.http files)
|
-- Additional parser for rest.nvim (*.http files)
|
||||||
local parser_configs = require('nvim-treesitter.parsers').get_parser_configs()
|
local parser_configs = require('nvim-treesitter.parsers').get_parser_configs()
|
||||||
|
@ -145,6 +240,52 @@ function M.treesitter_conf()
|
||||||
-- tree-sitter based folding
|
-- tree-sitter based folding
|
||||||
vim.opt.foldmethod = 'expr'
|
vim.opt.foldmethod = 'expr'
|
||||||
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
|
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
|
||||||
|
|
||||||
|
-- Define mappings' names
|
||||||
|
local wk = require('which-key')
|
||||||
|
local mappings = {
|
||||||
|
['['] = {
|
||||||
|
m = 'Previous start of outer class',
|
||||||
|
M = 'Previous end of outer class',
|
||||||
|
['['] = 'Previous start of outer function',
|
||||||
|
[']'] = 'Previous end of outer function'
|
||||||
|
},
|
||||||
|
[']'] = {
|
||||||
|
m = 'Next start of outer class',
|
||||||
|
M = 'Next end of outer class',
|
||||||
|
['['] = 'Next start of outer function',
|
||||||
|
[']'] = 'Next end of outer function'
|
||||||
|
},
|
||||||
|
g = {
|
||||||
|
n = {
|
||||||
|
name = 'Incremental selection',
|
||||||
|
i = 'Initialize selection'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
local visual_mappings = {
|
||||||
|
a = {
|
||||||
|
c = 'Outer class',
|
||||||
|
f = 'Outer function'
|
||||||
|
},
|
||||||
|
|
||||||
|
i = {
|
||||||
|
c = 'Inner class',
|
||||||
|
f = 'Inner function'
|
||||||
|
},
|
||||||
|
|
||||||
|
g = {
|
||||||
|
n = {
|
||||||
|
name = 'Incremental selection',
|
||||||
|
n = 'Increment node',
|
||||||
|
s = 'Increment scope',
|
||||||
|
m = 'Decrement node'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wk.register(mappings)
|
||||||
|
wk.register(visual_mappings, {mode = 'v'})
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.iswap_conf()
|
function M.iswap_conf()
|
||||||
|
|
|
@ -12,7 +12,7 @@ function M.signature_conf()
|
||||||
transpancy = 5,
|
transpancy = 5,
|
||||||
handler_opts = {border = 'single'},
|
handler_opts = {border = 'single'},
|
||||||
zindex = 50, -- set to 200 to make the float window on top of others
|
zindex = 50, -- set to 200 to make the float window on top of others
|
||||||
toggle_key = '<M-x>'
|
toggle_key = '<C-k>'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -62,30 +62,83 @@ end
|
||||||
|
|
||||||
function M.lsp_conf()
|
function M.lsp_conf()
|
||||||
local lspconf = require('lspconfig')
|
local lspconf = require('lspconfig')
|
||||||
|
local lsp_mappings = {
|
||||||
|
g = {
|
||||||
|
d = {':lua vim.lsp.buf.definition()<CR>', 'Goto definition'},
|
||||||
|
D = {':lua vim.lsp.buf.declaration()<CR>', 'Goto declaration'},
|
||||||
|
i = {':Lspsaga implement<CR>', 'Implementations'},
|
||||||
|
I = {':Telescope lsp_implementations<CR>', 'Implementations (Telescope)'},
|
||||||
|
r = {':TroubleToggle lsp_references<CR>', 'References'},
|
||||||
|
R = {':Telescope lsp_references<CR>', 'References (Telescope)'}
|
||||||
|
},
|
||||||
|
K = {':Lspsaga hover_doc<CR>', 'Hover doc'},
|
||||||
|
['[d'] = {':Lspsaga diagnostic_jump_prev<CR>', 'Previous diagnostics'},
|
||||||
|
[']d'] = {':Lspsaga diagnostic_jump_next<CR>', 'Next diagnostics'}
|
||||||
|
}
|
||||||
|
local lsp_leader_mappings = {
|
||||||
|
l = {
|
||||||
|
name = 'LSP',
|
||||||
|
a = {':lua vim.lsp.buf.add_workspace_folder()<CR>', 'Add workspace folder'},
|
||||||
|
b = {':TroubleToggle lsp_document_diagnostics<CR>', 'Buffer diagnostics'},
|
||||||
|
B = {':Telescope lsp_document_diagnostics<CR>', 'Buffer diagnostics (Telescope)'},
|
||||||
|
c = {':Lspsaga code_action<CR>', 'Code action'},
|
||||||
|
C = {':Telescope lsp_code_actions<CR>', 'Code action (Telescope)'},
|
||||||
|
d = {':TroubleToggle lsp_definitions<CR>', 'Definitions'},
|
||||||
|
D = {':Telescope lsp_definitions<CR>', 'Definitions (Telescope)'},
|
||||||
|
e = {':Lspsaga show_line_diagnostics<CR>', 'Line diagnostics'},
|
||||||
|
f = {':Lspsaga lsp_finder<CR>', 'Finder'},
|
||||||
|
g = {':SymbolsOutline<CR>', 'Symbol outline'},
|
||||||
|
i = {':LspInfo<CR>', 'Lsp info'},
|
||||||
|
l = {':TroubleToggle loclist<CR>', 'Diagnostics loclist'},
|
||||||
|
n = {':Lspsaga rename<CR>', 'Rename'},
|
||||||
|
p = {':Lspsaga preview_definition<CR>', 'Preview definition'},
|
||||||
|
r = {':lua vim.lsp.buf.remove_workspace_folder()<CR>', 'Remove workspace folder'},
|
||||||
|
s = {':Telescope lsp_document_symbols<CR>', 'Buffer symbols'},
|
||||||
|
S = {':Telescope lsp_workspace_symbols<CR>', 'Workspace symbols'},
|
||||||
|
t = {':TroubleToggle<CR>', 'Toggle Trouble'},
|
||||||
|
w = {':TroubleToggle lsp_workspace_diagnostics<CR>', 'Workspace diagnostics'},
|
||||||
|
W = {':Telescope lsp_workspace_diagnostics<CR>', 'Workspace diagnostics (Telescope)'},
|
||||||
|
x = {':lua vim.lsp.buf.signature_help()<CR>', 'Signature help'},
|
||||||
|
y = {':lua vim.notify(vim.inspect(vim.lsp.buf.list_workspace_folders()), vim.log.levels.INFO)<CR>', 'List workspace folders'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
local lsp_visual_mappings = {
|
||||||
|
l = {
|
||||||
|
name = 'LSP',
|
||||||
|
c = {':<C-U>Lspsaga range_code_action<CR>', 'Range code action'},
|
||||||
|
C = {':Telescope lsp_range_code_actions<CR>', 'Range code action (Telescope)'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
|
||||||
local function buf_set_keymap(...)
|
local wk = require('which-key')
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
wk.register(lsp_mappings, {buffer = bufnr})
|
||||||
end
|
wk.register(lsp_leader_mappings, {buffer = bufnr, prefix = '<leader>'})
|
||||||
|
wk.register(lsp_visual_mappings, {buffer = bufnr, prefix = '<leader>', mode = 'v'})
|
||||||
|
|
||||||
local opts = {noremap = true, silent = true}
|
local opts = {noremap = true, silent = true}
|
||||||
buf_set_keymap('n', '<C-f>', ':lua require("lspsaga.action").smart_scroll_with_saga(1)<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-f>', ':lua require("lspsaga.action").smart_scroll_with_saga(1)<CR>', opts)
|
||||||
buf_set_keymap('n', '<C-b>', ':lua require("lspsaga.action").smart_scroll_with_saga(-1)<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-b>', ':lua require("lspsaga.action").smart_scroll_with_saga(-1)<CR>', opts)
|
||||||
|
|
||||||
if client.resolved_capabilities.document_formatting then
|
if client.resolved_capabilities.document_formatting then
|
||||||
buf_set_keymap('n', '<leader>lo', ':lua vim.lsp.buf.formatting()<CR>', opts)
|
wk.register({
|
||||||
|
['lo'] = {':lua vim.lsp.buf.formatting()<CR>', 'Format buffer'}
|
||||||
|
}, {buffer = bufnr, prefix = '<leader>'})
|
||||||
-- vim.api.nvim_command('autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()')
|
-- vim.api.nvim_command('autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()')
|
||||||
elseif client.resolved_capabilities.document_range_formatting then
|
elseif client.resolved_capabilities.document_range_formatting then
|
||||||
buf_set_keymap('n', '<leader>lo', ':lua vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0})<CR>', opts)
|
wk.register({
|
||||||
buf_set_keymap('v', '<leader>lo', ':lua vim.lsp.buf.range_formatting()<CR>', opts)
|
['lo'] = {':lua vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0})<CR>', 'Format buffer'}
|
||||||
|
}, {buffer = bufnr, prefix = '<leader>'})
|
||||||
|
wk.register({
|
||||||
|
['lo'] = {':lua vim.lsp.buf.range_formatting()<CR>', 'Format range'}
|
||||||
|
}, {buffer = bufnr, prefix = '<leader>', mode = 'v'})
|
||||||
-- vim.api.nvim_command('autocmd BufWritePre <buffer> lua vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0})')
|
-- vim.api.nvim_command('autocmd BufWritePre <buffer> lua vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0})')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
|
||||||
-- Add additional capabilities supported by nvim-cmp
|
-- Add additional capabilities supported by nvim-cmp
|
||||||
local completionItem = capabilities.textDocument.completion.completionItem
|
local completionItem = capabilities.textDocument.completion.completionItem
|
||||||
completionItem.documentationFormat = {'markdown', 'plaintext'}
|
completionItem.documentationFormat = {'markdown', 'plaintext'}
|
||||||
|
@ -662,6 +715,7 @@ function M.dapui_conf()
|
||||||
floating = {
|
floating = {
|
||||||
max_height = nil, -- These can be integers or a float between 0 and 1.
|
max_height = nil, -- These can be integers or a float between 0 and 1.
|
||||||
max_width = nil, -- Floats will be treated as percentage of your screen.
|
max_width = nil, -- Floats will be treated as percentage of your screen.
|
||||||
|
border = 'single',
|
||||||
mappings = {
|
mappings = {
|
||||||
close = {'q', '<Esc>'}
|
close = {'q', '<Esc>'}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,55 +107,6 @@ function M.rest_conf()
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.orgmode_conf()
|
|
||||||
local c = require('themes.' .. vim.g.colors_name .. '.colors')
|
|
||||||
|
|
||||||
require('orgmode').setup {
|
|
||||||
-- General settings
|
|
||||||
org_agenda_files = {'~/Documents/Org/agenda/*'},
|
|
||||||
org_default_notes_file = '~/Documents/Org/notes.org',
|
|
||||||
org_todo_keywords = {
|
|
||||||
'TODO', 'PROJ', 'LOOP', 'STRT', 'WAIT', 'HOLD', 'IDEA', 'DONE', 'KILL',
|
|
||||||
'[ ]', '[-]', '[X]' , '|', 'OKAY', 'YES', 'NO'
|
|
||||||
},
|
|
||||||
org_todo_keyword_faces = {
|
|
||||||
TODO = ':foreground ' .. c.green .. ' :weight bold',
|
|
||||||
PROJ = ':foreground ' .. c.grey_bright .. ' :weight bold :slant italic',
|
|
||||||
LOOP = ':foreground ' .. c.green .. ' :weight bold :underline on',
|
|
||||||
STRT = ':foreground ' .. c.blue .. ' :weight bold',
|
|
||||||
WAIT = ':foreground ' .. c.yellow .. ' :weight bold',
|
|
||||||
HOLD = ':foreground ' .. c.yellow .. ' :weight bold :slant italic',
|
|
||||||
IDEA = ':foreground ' .. c.green .. ' :weight bold :slant italic',
|
|
||||||
DONE = ':foreground ' .. c.grey2 .. ' :weight bold',
|
|
||||||
KILL = ':foreground ' .. c.red .. ' :weight bold',
|
|
||||||
OKAY = ':foreground ' .. c.grey1 .. ' :weight bold :slant italic',
|
|
||||||
YES = ':foreground ' .. c.grey1 .. ' :weight bold :underline on',
|
|
||||||
NO = ':foreground ' .. c.red .. ' :weight bold :underline on'
|
|
||||||
},
|
|
||||||
org_hide_leading_stars = true,
|
|
||||||
org_highlight_latex_and_related = 'entities',
|
|
||||||
|
|
||||||
-- Agenda settings
|
|
||||||
org_deadline_warning_days = 7,
|
|
||||||
org_agenda_span = 'week',
|
|
||||||
org_agenda_start_on_weekday = 7, -- Start a week in Sunday
|
|
||||||
org_agenda_min_height = 15,
|
|
||||||
|
|
||||||
-- Tags settings
|
|
||||||
org_use_tag_inheritance = false
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.bullets_conf()
|
|
||||||
require('org-bullets').setup {
|
|
||||||
symbols = {'', '', '', ''}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.headlines_conf()
|
|
||||||
require('headlines').setup()
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.spectre_conf()
|
function M.spectre_conf()
|
||||||
require('spectre').setup()
|
require('spectre').setup()
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,23 @@
|
||||||
|
-- TODO: rust-tools.nvim, crates.nvim, go.nvim, clojure-vim/*, nvim-bqf,
|
||||||
|
-- nvim-comment-frame, nvim-revJ.lua, nvim-remote-containers, tex.nvim,
|
||||||
|
-- telescope-dap.nvim, fcitx.nvim, pandoc.nvim
|
||||||
local packer = require('modules.pack')
|
local packer = require('modules.pack')
|
||||||
|
|
||||||
-- This is recommended when using `luafile <afile>` a lot
|
-- This is recommended when using `luafile <afile>` a lot
|
||||||
-- packer.reset()
|
packer.reset()
|
||||||
|
|
||||||
return packer.startup(function(use)
|
-- Necessary stuff
|
||||||
|
local needed_plugins = function(use)
|
||||||
use {'wbthomason/packer.nvim', opt = true}
|
use {'wbthomason/packer.nvim', opt = true}
|
||||||
|
|
||||||
---------------------------------
|
|
||||||
-- Plugins used by many others --
|
|
||||||
---------------------------------
|
|
||||||
use {'kyazdani42/nvim-web-devicons', module = 'nvim-web-devicons'}
|
use {'kyazdani42/nvim-web-devicons', module = 'nvim-web-devicons'}
|
||||||
use {'nvim-lua/plenary.nvim', module = 'plenary'}
|
use {'nvim-lua/plenary.nvim', module = 'plenary'}
|
||||||
use {'nvim-lua/popup.nvim', module = 'popup'}
|
use {'nvim-lua/popup.nvim', module = 'popup'}
|
||||||
|
end
|
||||||
|
|
||||||
--------
|
-- UI components
|
||||||
-- UI --
|
local ui = require('modules.ui')
|
||||||
--------
|
local ui_plugins = function(use)
|
||||||
local ui = require('modules.ui')
|
|
||||||
use {
|
use {
|
||||||
'goolord/alpha-nvim',
|
'goolord/alpha-nvim',
|
||||||
event = 'VimEnter',
|
event = 'VimEnter',
|
||||||
|
@ -40,7 +41,6 @@ return packer.startup(function(use)
|
||||||
}
|
}
|
||||||
use {
|
use {
|
||||||
'folke/which-key.nvim',
|
'folke/which-key.nvim',
|
||||||
event = 'VimEnter',
|
|
||||||
config = ui.whichkey_conf
|
config = ui.whichkey_conf
|
||||||
}
|
}
|
||||||
use {
|
use {
|
||||||
|
@ -49,11 +49,11 @@ return packer.startup(function(use)
|
||||||
wants = 'plenary.nvim',
|
wants = 'plenary.nvim',
|
||||||
config = ui.gitsigns_conf
|
config = ui.gitsigns_conf
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
------------
|
-- Editing-related plugins
|
||||||
-- Editor --
|
local editor = require('modules.editor')
|
||||||
------------
|
local editor_plugins = function(use)
|
||||||
local editor = require('modules.editor')
|
|
||||||
use {
|
use {
|
||||||
'norcalli/nvim-colorizer.lua',
|
'norcalli/nvim-colorizer.lua',
|
||||||
cmd = 'ColorizerToggle',
|
cmd = 'ColorizerToggle',
|
||||||
|
@ -68,6 +68,23 @@ return packer.startup(function(use)
|
||||||
'Olical/conjure',
|
'Olical/conjure',
|
||||||
ft = {'clojure', 'fennel', 'scheme', 'hy', 'janet', 'racket'}
|
ft = {'clojure', 'fennel', 'scheme', 'hy', 'janet', 'racket'}
|
||||||
}
|
}
|
||||||
|
use { -- TODO: check out neorg
|
||||||
|
'kristijanhusak/orgmode.nvim',
|
||||||
|
ft = 'org',
|
||||||
|
requires = {
|
||||||
|
{
|
||||||
|
'akinsho/org-bullets.nvim',
|
||||||
|
after = 'orgmode.nvim',
|
||||||
|
config = editor.bullets_conf
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'lukas-reineke/headlines.nvim',
|
||||||
|
after = 'orgmode.nvim',
|
||||||
|
config = editor.headlines_conf
|
||||||
|
}
|
||||||
|
},
|
||||||
|
config = editor.orgmode_conf
|
||||||
|
}
|
||||||
use {
|
use {
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
run = ':TSUpdate',
|
run = ':TSUpdate',
|
||||||
|
@ -176,11 +193,11 @@ return packer.startup(function(use)
|
||||||
config = editor.gitlinker_conf
|
config = editor.gitlinker_conf
|
||||||
}
|
}
|
||||||
use {'jbyuki/venn.nvim', cmd = 'VBox'}
|
use {'jbyuki/venn.nvim', cmd = 'VBox'}
|
||||||
|
end
|
||||||
|
|
||||||
---------
|
-- LSP-related
|
||||||
-- LSP --
|
local lsp = require('modules.lsp')
|
||||||
---------
|
local lsp_plugins = function(use)
|
||||||
local lsp = require('modules.lsp')
|
|
||||||
use {
|
use {
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
event = 'BufReadPre',
|
event = 'BufReadPre',
|
||||||
|
@ -242,11 +259,11 @@ return packer.startup(function(use)
|
||||||
}},
|
}},
|
||||||
config = lsp.dapui_conf
|
config = lsp.dapui_conf
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
----------------
|
-- Completion
|
||||||
-- Completion --
|
local completion = require('modules.completion')
|
||||||
----------------
|
local completion_plugins = function(use)
|
||||||
local completion = require('modules.completion')
|
|
||||||
use {
|
use {
|
||||||
'hrsh7th/nvim-cmp',
|
'hrsh7th/nvim-cmp',
|
||||||
event = {'InsertEnter', 'CmdlineEnter'},
|
event = {'InsertEnter', 'CmdlineEnter'},
|
||||||
|
@ -291,11 +308,11 @@ return packer.startup(function(use)
|
||||||
wants = 'nvim-treesitter',
|
wants = 'nvim-treesitter',
|
||||||
config = completion.autotag_conf
|
config = completion.autotag_conf
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
-----------
|
-- Other tools
|
||||||
-- Tools --
|
local tools = require('modules.tools')
|
||||||
-----------
|
local tools_plugins = function(use)
|
||||||
local tools = require('modules.tools')
|
|
||||||
use { -- TODO: check out fzf-lua
|
use { -- TODO: check out fzf-lua
|
||||||
'nvim-telescope/telescope.nvim',
|
'nvim-telescope/telescope.nvim',
|
||||||
cmd = 'Telescope',
|
cmd = 'Telescope',
|
||||||
|
@ -360,23 +377,6 @@ return packer.startup(function(use)
|
||||||
run = 'npm install --prefix server',
|
run = 'npm install --prefix server',
|
||||||
cmd = 'Bracey'
|
cmd = 'Bracey'
|
||||||
}
|
}
|
||||||
use { -- TODO: check out neorg
|
|
||||||
'kristijanhusak/orgmode.nvim',
|
|
||||||
requires = {
|
|
||||||
{
|
|
||||||
'akinsho/org-bullets.nvim',
|
|
||||||
after = 'orgmode.nvim',
|
|
||||||
config = tools.bullets_conf
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'lukas-reineke/headlines.nvim',
|
|
||||||
after = 'orgmode.nvim',
|
|
||||||
config = tools.headlines_conf
|
|
||||||
}
|
|
||||||
},
|
|
||||||
ft = 'org',
|
|
||||||
config = tools.orgmode_conf
|
|
||||||
}
|
|
||||||
use {
|
use {
|
||||||
'windwp/nvim-spectre',
|
'windwp/nvim-spectre',
|
||||||
keys = '<leader>p',
|
keys = '<leader>p',
|
||||||
|
@ -451,11 +451,19 @@ return packer.startup(function(use)
|
||||||
config = tools.distant_conf
|
config = tools.distant_conf
|
||||||
}
|
}
|
||||||
use {'dstein64/vim-startuptime', cmd = 'StartupTime'} -- Just for benchmarking
|
use {'dstein64/vim-startuptime', cmd = 'StartupTime'} -- Just for benchmarking
|
||||||
|
end
|
||||||
|
|
||||||
-- TODO: rust-tools.nvim, crates.nvim, go.nvim, clojure-vim/*, nvim-bqf,
|
-- Merge everything together
|
||||||
-- nvim-comment-frame, nvim-revJ.lua, nvim-remote-containers, tex.nvim,
|
local sumary = function(use)
|
||||||
-- telescope-dap.nvim, fcitx.nvim, pandoc.nvim
|
needed_plugins(use)
|
||||||
|
ui_plugins(use)
|
||||||
|
editor_plugins(use)
|
||||||
|
lsp_plugins(use)
|
||||||
|
completion_plugins(use)
|
||||||
|
tools_plugins(use)
|
||||||
|
|
||||||
-- Install plugins if missing
|
-- Install plugins if missing
|
||||||
packer.install()
|
packer.install()
|
||||||
end)
|
end
|
||||||
|
|
||||||
|
return packer.startup(sumary)
|
||||||
|
|
|
@ -74,6 +74,7 @@ function M.highlight_editor()
|
||||||
hi('Directory', c.cyan, '', '', '')
|
hi('Directory', c.cyan, '', '', '')
|
||||||
|
|
||||||
-- Prompt
|
-- Prompt
|
||||||
|
cmd('hi! link MsgArea Normal')
|
||||||
hi('ErrorMsg' , c.fg , c.red , '', '')
|
hi('ErrorMsg' , c.fg , c.red , '', '')
|
||||||
hi('ModeMsg' , c.fg , '' , '', '')
|
hi('ModeMsg' , c.fg , '' , '', '')
|
||||||
hi('MoreMsg' , c.cyan , '' , '', '')
|
hi('MoreMsg' , c.cyan , '' , '', '')
|
||||||
|
@ -132,7 +133,7 @@ function M.highlight_syntax()
|
||||||
hi('Structure', c.blue, '', '', '')
|
hi('Structure', c.blue, '', '', '')
|
||||||
hi('Tag', c.fg, '', '', '')
|
hi('Tag', c.fg, '', '', '')
|
||||||
hi('Todo', c.yellow, '', '', '')
|
hi('Todo', c.yellow, '', '', '')
|
||||||
hi('Type', c.orange, '', '', '')
|
hi('Type', c.dark_blue, '', 'bold', '')
|
||||||
hi('Typedef', c.blue, '', '', '')
|
hi('Typedef', c.blue, '', '', '')
|
||||||
cmd('hi! link Macro Define')
|
cmd('hi! link Macro Define')
|
||||||
cmd('hi! link PreCondit PreProc')
|
cmd('hi! link PreCondit PreProc')
|
||||||
|
@ -217,8 +218,8 @@ function M.highlight_treesitter()
|
||||||
hi('TSStringRegex', c.teal, '', '', '')
|
hi('TSStringRegex', c.teal, '', '', '')
|
||||||
hi('TSStringEscape', c.purple, '', '', '')
|
hi('TSStringEscape', c.purple, '', '', '')
|
||||||
hi('TSSymbol', c.purple, '', '', '')
|
hi('TSSymbol', c.purple, '', '', '')
|
||||||
hi('TSType', c.orange, '', '', '')
|
hi('TSType', c.dark_blue, '', 'bold', '')
|
||||||
hi('TSTypeBuiltin', c.orange, '', '', '')
|
hi('TSTypeBuiltin', c.dark_blue, '', 'bold', '')
|
||||||
hi('TSTag', c.fg, '', '', '')
|
hi('TSTag', c.fg, '', '', '')
|
||||||
hi('TSTagDelimiter', c.purple, '', '', '')
|
hi('TSTagDelimiter', c.purple, '', '', '')
|
||||||
hi('TSText', c.fg, '', '', '')
|
hi('TSText', c.fg, '', '', '')
|
||||||
|
@ -226,8 +227,9 @@ function M.highlight_treesitter()
|
||||||
hi('TSStrong' , c.fg, '', 'bold', '')
|
hi('TSStrong' , c.fg, '', 'bold', '')
|
||||||
hi('TSEmphasis', c.fg, '', 'bold,italic', '')
|
hi('TSEmphasis', c.fg, '', 'bold,italic', '')
|
||||||
hi('TSUnderline', '', '', 'underline', '')
|
hi('TSUnderline', '', '', 'underline', '')
|
||||||
|
hi('TSStrike', c.orange, '', 'italic', '')
|
||||||
hi('TSTitle', c.dark_blue, '', 'bold', '')
|
hi('TSTitle', c.dark_blue, '', 'bold', '')
|
||||||
hi('TSLiteral', c.fg, '', '', '')
|
hi('TSLiteral', c.green, '', 'italic', '')
|
||||||
hi('TSURI', c.green, '', 'underline', '')
|
hi('TSURI', c.green, '', 'underline', '')
|
||||||
|
|
||||||
cmd('hi! link TSComment Comment')
|
cmd('hi! link TSComment Comment')
|
||||||
|
@ -286,7 +288,7 @@ function M.highlight_plugins()
|
||||||
hi('CmpItemAbbr', c.fg, '', '', '')
|
hi('CmpItemAbbr', c.fg, '', '', '')
|
||||||
hi('CmpItemAbbrMatch', c.yellow, '', '', '')
|
hi('CmpItemAbbrMatch', c.yellow, '', '', '')
|
||||||
hi('CmpItemAbbrMatchFuzzy', c.yellow, '', '', '')
|
hi('CmpItemAbbrMatchFuzzy', c.yellow, '', '', '')
|
||||||
hi('CmpItemKind', c.orange, '', '', '')
|
hi('CmpItemKind', c.green, '', '', '')
|
||||||
hi('CmpItemMenu', c.blue, '', '', '')
|
hi('CmpItemMenu', c.blue, '', '', '')
|
||||||
|
|
||||||
-- LuaSnip
|
-- LuaSnip
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
---
|
||||||
- name: Create config directory
|
- name: Create config directory
|
||||||
file:
|
file:
|
||||||
path: ~/.config/nvim
|
path: ~/.config/nvim
|
||||||
|
@ -5,7 +6,7 @@
|
||||||
|
|
||||||
- name: Copy config
|
- name: Copy config
|
||||||
copy:
|
copy:
|
||||||
src: "{{ ansible_env.PWD }}/roles/nvim/files/{{ item }}"
|
src: '{{ item }}'
|
||||||
dest: ~/.config/nvim
|
dest: ~/.config/nvim
|
||||||
force: yes
|
force: yes
|
||||||
loop:
|
loop:
|
||||||
|
@ -16,9 +17,15 @@
|
||||||
- asynctasks.ini
|
- asynctasks.ini
|
||||||
- init.lua
|
- init.lua
|
||||||
|
|
||||||
|
- name: Copy options.lua
|
||||||
|
template:
|
||||||
|
src: options.j2
|
||||||
|
dest: ~/.config/nvim/lua/options.lua
|
||||||
|
force: yes
|
||||||
|
|
||||||
- name: Copy helper scripts
|
- name: Copy helper scripts
|
||||||
copy:
|
copy:
|
||||||
src: "{{ ansible_env.PWD }}/roles/nvim/files/scripts"
|
src: scripts
|
||||||
dest: ~/.config/nvim
|
dest: ~/.config/nvim
|
||||||
mode: u+x
|
mode: u+x
|
||||||
force: yes
|
force: yes
|
||||||
|
|
|
@ -25,9 +25,10 @@ end
|
||||||
|
|
||||||
function M.load_options()
|
function M.load_options()
|
||||||
-- This is the same as `:colorscheme nord/onedark`
|
-- This is the same as `:colorscheme nord/onedark`
|
||||||
vim.g.colors_name = 'nord'
|
vim.g.colors_name = '{{ theme }}'
|
||||||
-- Leader key
|
-- Leader key
|
||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
|
vim.g.maplocalleader = ','
|
||||||
-- Python path
|
-- Python path
|
||||||
vim.g.python3_host_prog = '/usr/bin/python3'
|
vim.g.python3_host_prog = '/usr/bin/python3'
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
- name: Check theme name
|
||||||
|
fail:
|
||||||
|
msg: Theme needs to be 'nord' or 'onedark'
|
||||||
|
when: theme != 'nord' and theme != 'onedark'
|
||||||
|
|
||||||
|
- name: Create color variables
|
||||||
|
template:
|
||||||
|
src: palette.j2
|
||||||
|
dest: '{{ ansible_env.PWD }}/palette.yml'
|
||||||
|
force: yes
|
|
@ -0,0 +1,42 @@
|
||||||
|
---
|
||||||
|
{% if theme == 'nord' %}
|
||||||
|
# Terminal colors
|
||||||
|
foreground: '#d8dee9'
|
||||||
|
background: '#2e3440'
|
||||||
|
color0: '#3b4252'
|
||||||
|
color1: '#bf616a'
|
||||||
|
color2: '#a3be8c'
|
||||||
|
color3: '#ebcb8b'
|
||||||
|
color4: '#81a1c1'
|
||||||
|
color5: '#b48ead'
|
||||||
|
color6: '#88c0d0'
|
||||||
|
color7: '#e5e9f0'
|
||||||
|
color8: '#4c566a'
|
||||||
|
color9: '#bf616a'
|
||||||
|
color10: '#a3be8c'
|
||||||
|
color11: '#ebcb8b'
|
||||||
|
color12: '#81a1c1'
|
||||||
|
color13: '#b48ead'
|
||||||
|
color14: '#8fbcbb'
|
||||||
|
color15: '#eceff4'
|
||||||
|
{% elif theme == 'onedark' %}
|
||||||
|
# Terminal colors
|
||||||
|
foreground: '#abb2bf'
|
||||||
|
background: '#282c34'
|
||||||
|
color0: '#3e4452'
|
||||||
|
color1: '#be5046'
|
||||||
|
color2: '#98c379'
|
||||||
|
color3: '#d19a66'
|
||||||
|
color4: '#61afef'
|
||||||
|
color5: '#c678dd'
|
||||||
|
color6: '#56b6c2'
|
||||||
|
color7: '#abb2bf'
|
||||||
|
color8: '#4b5263'
|
||||||
|
color9: '#e06c75'
|
||||||
|
color10: '#98c379'
|
||||||
|
color11: '#e5c07b'
|
||||||
|
color12: '#61afef'
|
||||||
|
color13: '#c678dd'
|
||||||
|
color14: '#56b6c2'
|
||||||
|
color15: '#bbc2cf'
|
||||||
|
{% endif %}
|
|
@ -0,0 +1,18 @@
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# Install stuff
|
||||||
|
RUN apk --no-cache add \
|
||||||
|
sudo ansible git neovim fish bash
|
||||||
|
|
||||||
|
# Assure correct permission on /tmp
|
||||||
|
RUN chmod 1777 /tmp
|
||||||
|
|
||||||
|
# Create a test user
|
||||||
|
RUN adduser -h /home/kawaii -s /usr/bin/fish -D -G wheel kawaii \
|
||||||
|
&& echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel
|
||||||
|
|
||||||
|
# Enter testing environment
|
||||||
|
USER kawaii
|
||||||
|
WORKDIR /home/kawaii
|
||||||
|
COPY ../hosts .
|
||||||
|
CMD ["/usr/bin/fish"]
|
Loading…
Reference in New Issue