nix: Start on vim plugins

This commit is contained in:
Geoffrey Frogeye 2023-10-29 12:15:56 +01:00
parent e45d3df5cd
commit a521dd4221
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
13 changed files with 80 additions and 151 deletions

View file

@ -1,37 +1,3 @@
- name: Set vim variants to use
set_fact:
vim_variants:
- vim
- nvim
# TODO vim-minimal for bsh
# TODO Select those in a clever way
- name: Create vim configuration directory
file:
state: directory
path: "{{ ansible_user_dir }}/.config/{{ item }}"
mode: "u=rwx,g=rx,o=rx"
loop: "{{ vim_variants }}"
- name: Install vim-plug
get_url:
url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
dest: "{{ ansible_user_dir }}/.config/vim/plug.vim"
mode: "u=rw,g=r,o=r"
- name: Install loader
template:
src: loader.j2
dest: "{{ ansible_user_dir }}/.config/vim/loader.vim"
mode: "u=rw,g=r,o=r"
- name: Install theme
template:
src: theme.j2
dest: "{{ ansible_user_dir }}/.config/vim/theme.vim"
mode: "u=rw,g=r,o=r"
tags:
- color
- name: Configure vim plugin list - name: Configure vim plugin list
template: template:

View file

@ -1,6 +0,0 @@
if has('nvim')
let $MYVIMRC="~/.config/nvim/init.vim"
else
let $MYVIMRC="~/.config/vim/init.vim"
endif
source $MYVIMRC

View file

@ -8,11 +8,9 @@
{%- endmacro -%} {%- endmacro -%}
" Visuals " Visuals
{{ use_plugin('base16') }}
{{ use_plugin('devicons') }} {{ use_plugin('devicons') }}
{% if variant == 'nvim' %} {% if variant == 'nvim' %}
{{ use_plugin('specs') }} {{ use_plugin('specs') }}
{{ use_plugin('scrollview') }}
{% endif %} {% endif %}
" Theme " Theme
@ -20,7 +18,6 @@ source ~/.config/vim/theme.vim
" Status/tab lines " Status/tab lines
{% if variant == 'nvim' %} {% if variant == 'nvim' %}
{{ use_plugin('barbar') }}
{{ use_plugin('feline') }} {{ use_plugin('feline') }}
{% else %} {% else %}
{{ use_plugin('airline') }} {{ use_plugin('airline') }}

View file

@ -1,21 +0,0 @@
{{ add_source('romgrk/barbar.nvim') -}}
" Move to previous/next
nmap <silent> <C-H> :BufferPrevious<CR>
nmap <silent> <C-L> :BufferNext<CR>
" Re-order to previous/next
nmap <silent> <Space><C-H> :BufferMovePrevious<CR>
nmap <silent> <Space><C-L> :BufferMoveNext<CR>
" Goto buffer in position...
nmap <silent> <C-1> :BufferGoto 1<CR>
nmap <silent> <C-2> :BufferGoto 2<CR>
nmap <silent> <C-3> :BufferGoto 3<CR>
nmap <silent> <C-4> :BufferGoto 4<CR>
nmap <silent> <C-5> :BufferGoto 5<CR>
nmap <silent> <C-6> :BufferGoto 6<CR>
nmap <silent> <C-7> :BufferGoto 7<CR>
nmap <silent> <C-8> :BufferGoto 8<CR>
nmap <silent> <C-0> :BufferGoto 0<CR>
nmap <silent> <C-0> :BufferLast<CR>
nmap <silent> gb :BufferPick<CR>

View file

@ -1,7 +0,0 @@
{% if variant == 'nvim' %}
{# Beware, doesn't work without RGB colors #}
{{ add_source('RRethy/nvim-base16') -}}
{% else %}
{{ add_source('chriskempson/base16-vim') -}}
{% endif %}

View file

@ -1,2 +0,0 @@
{# Customisable status line #}
{{ add_source('dstein64/nvim-scrollview') -}}

View file

@ -2,8 +2,6 @@
{{ add_source('edluffy/specs.nvim') -}} {{ add_source('edluffy/specs.nvim') -}}
lua << EOF lua << EOF
require('specs').setup{ require('specs').setup{
show_jumps = true,
min_jump = 5,
popup = { popup = {
delay_ms = 0, -- delay before popup displays delay_ms = 0, -- delay before popup displays
inc_ms = 10, -- time increments used for fade/resize effects inc_ms = 10, -- time increments used for fade/resize effects
@ -13,9 +11,5 @@ require('specs').setup{
fader = require('specs').pulse_fader, fader = require('specs').pulse_fader,
resizer = require('specs').shrink_resizer resizer = require('specs').shrink_resizer
}, },
ignore_filetypes = {},
ignore_buftypes = {
nofile = true,
},
} }
EOF EOF

View file

@ -1 +0,0 @@
colorscheme base16-{{ base16_scheme }}

View file

@ -11,12 +11,14 @@
enableSyntaxHighlighting = true; enableSyntaxHighlighting = true;
# syntaxHighlighting.enable = true; # 23.11 syntax # syntaxHighlighting.enable = true; # 23.11 syntax
}; };
neovim = { # neovim = {
enable = true; # enable = true;
defaultEditor = true; # defaultEditor = true;
vimAlias = true; # vimAlias = true;
viAlias = true; # viAlias = true;
}; # vimdiffAlias = true;
# };
# FIXME Still want this despite using nixvim
gpg = { gpg = {
enable = true; enable = true;
homedir = "${config.xdg.dataHome}/gnupg"; homedir = "${config.xdg.dataHome}/gnupg";
@ -87,6 +89,7 @@
borgbackup borgbackup
# cleanup # cleanup
ncdu
jdupes jdupes
duperemove duperemove
optipng optipng

View file

@ -6,5 +6,6 @@
./dev.nix ./dev.nix
./extra.nix ./extra.nix
./style.nix ./style.nix
./vim.nix
]; ];
} }

View file

@ -9,12 +9,23 @@ in
imports = [ (import stylix).homeManagerModules.stylix ]; imports = [ (import stylix).homeManagerModules.stylix ];
stylix = { stylix = {
# FIXME Changeable at runtime
base16Scheme = "${pkgs.base16-schemes}/share/themes/solarized-dark.yaml"; base16Scheme = "${pkgs.base16-schemes}/share/themes/solarized-dark.yaml";
image = builtins.fetchurl { image = builtins.fetchurl {
url = "https://get.wallhere.com/photo/sunlight-abstract-minimalism-green-simple-circle-light-leaf-wave-material-line-wing-computer-wallpaper-font-close-up-macro-photography-124350.png"; url = "https://get.wallhere.com/photo/sunlight-abstract-minimalism-green-simple-circle-light-leaf-wave-material-line-wing-computer-wallpaper-font-close-up-macro-photography-124350.png";
sha256 = "sha256:1zfq3f3v34i45mi72pkfqphm8kbhczsg260xjfl6dbydy91d7y93"; sha256 = "sha256:1zfq3f3v34i45mi72pkfqphm8kbhczsg260xjfl6dbydy91d7y93";
}; };
# FIXME This doesn't work # FIXME This doesn't work
# fonts.monospace = {
# package = pkgs.nerdfonts;
# name = "DejaVu Sans Mono Nerd Font";
# };
# FIXME We want this, but now we get weird kerning in Alacritty...
# Something I've seen before and probably already fixed,
# maybe something in Alacritty config, which is not imported yet?
targets.vim.enable = false; # FIXME Not compatible with nixvim for now (there's a MR)
}; };
# Fix https://nix-community.github.io/home-manager/index.html#_why_do_i_get_an_error_message_about_literal_ca_desrt_dconf_literal_or_literal_dconf_service_literal # Fix https://nix-community.github.io/home-manager/index.html#_why_do_i_get_an_error_message_about_literal_ca_desrt_dconf_literal_or_literal_dconf_service_literal

59
config/nix/hm/vim.nix Normal file
View file

@ -0,0 +1,59 @@
{ pkgs, lib, ... }:
let
nixvim = import (builtins.fetchGit {
url = "https://github.com/nix-community/nixvim";
ref = "nixos-23.05";
});
in
{
imports = [
nixvim.homeManagerModules.nixvim
];
programs.nixvim = {
enable = true;
colorschemes.base16 = {
# FIXME Dynamic... or use stylix
enable = true;
colorscheme = "solarized-light";
};
plugins = {
# Catches attention when cursor changed position
# TODO Unmapped, do I still want to use it?
specs = {
enable = true;
min_jump = 5;
};
# Tabline
barbar.enable = true;
};
extraPlugins = with pkgs.vimPlugins; [
nvim-scrollview
];
# 23.11: Use keymaps, seems better
maps = {
# barbar
normal."<C-H>" = { action = "<Cmd>BufferPrevious<CR>"; silent = true; };
normal."<C-L>" = { action = "<Cmd>BufferNext<CR>"; silent = true; };
# TODO https://www.reddit.com/r/neovim/comments/mbj8m5/how_to_setup_ctrlshiftkey_mappings_in_neovim_and/
normal."<Space><C-H>" = { action = "<Cmd>BufferMovePrevious<CR>"; silent = true; };
normal."<Space><C-L>" = { action = "<Cmd>BufferMoveNext<CR>"; silent = true; };
# TODO gotos don't work
normal."<C-1>" = { action = "<Cmd>BufferGoto 1<CR>"; silent = true; };
normal."<C-2>" = { action = "<Cmd>BufferGoto 2<CR>"; silent = true; };
normal."<C-3>" = { action = "<Cmd>BufferGoto 3<CR>"; silent = true; };
normal."<C-4>" = { action = "<Cmd>BufferGoto 4<CR>"; silent = true; };
normal."<C-5>" = { action = "<Cmd>BufferGoto 5<CR>"; silent = true; };
normal."<C-6>" = { action = "<Cmd>BufferGoto 6<CR>"; silent = true; };
normal."<C-7>" = { action = "<Cmd>BufferGoto 7<CR>"; silent = true; };
normal."<C-8>" = { action = "<Cmd>BufferGoto 8<CR>"; silent = true; };
normal."<C-9>" = { action = "<Cmd>BufferGoto 9<CR>"; silent = true; };
normal."<C-0>" = { action = "<Cmd>BufferLast<CR>"; silent = true; };
normal."gb" = { action = "<Cmd>BufferPick<CR>"; silent = true; };
# TODO Other useful options?
};
};
}

View file

@ -1,65 +0,0 @@
partial alphanumeric_keys
xkb_symbols "qwerty-fr"
{
include "us(basic)"
include "level3(ralt_switch)"
include "keypad(oss)"
name[Group1]= "US keyboard with french symbols - AltGr combination";
key <TLDE> { [ grave, asciitilde, dead_grave, dead_tilde ] };
key <AE01> { [ 1, exclam, onesuperior, exclamdown ] };
key <AE02> { [ 2, at, twosuperior, dead_doubleacute ] };
key <AE03> { [ 3, numbersign, ecircumflex, Ecircumflex ] };
key <AE04> { [ 4, dollar, EuroSign, dead_currency ] }; // FIXME: dead_currency has a different mapping than the one we want for qwerty-fr. Need to define a custom dead key instead. See Windows layout for dead key definition.
key <AE05> { [ 5, percent, dead_macron, dead_abovedot ] };
key <AE06> { [ 6, asciicircum, dead_circumflex, dead_caron ] };
key <AE07> { [ 7, ampersand, ucircumflex, Ucircumflex ] };
key <AE08> { [ 8, asterisk, icircumflex, Icircumflex ] };
key <AE09> { [ 9, parenleft, ocircumflex, Ocircumflex ] };
key <AE10> { [ 0, parenright, oslash, Oslash ] };
key <AE11> { [ minus, underscore, endash, emdash ] };
key <AE12> { [ equal, plus, notequal, approxeq ] };
key <AD01> { [ q, Q, acircumflex, Acircumflex ] };
key <AD02> { [ w, W, eacute, Eacute ] };
key <AD03> { [ e, E, egrave, Egrave ] };
key <AD04> { [ r, R, registered, copyright ] };
key <AD05> { [ t, T, thorn, THORN ] };
key <AD06> { [ y, Y, dead_invertedbreve, dead_breve ] };
key <AD07> { [ u, U, ugrave, Ugrave ] };
key <AD08> { [ i, I, igrave, Igrave ] };
key <AD09> { [ o, O, ograve, Ograve ] };
key <AD10> { [ p, P, oe, OE ] };
key <AD11> { [ bracketleft, braceleft, guillemotleft, leftdoublequotemark ] };
key <AD12> { [ bracketright, braceright, guillemotright, rightdoublequotemark ] };
key <AC01> { [ a, A, agrave, Agrave ] };
key <AC02> { [ s, S, ae, AE ] };
key <AC03> { [ d, D, ediaeresis, Ediaeresis ] };
key <AC04> { [ f, F, VoidSymbol, VoidSymbol ] };
key <AC05> { [ g, G, dead_greek, VoidSymbol ] }; // FIXME: dead_greek has a different mapping than the one we want for qwerty-fr. Need to define a custom dead key instead. See Windows layout for dead key definition.
key <AC06> { [ h, H, ydiaeresis, Ydiaeresis ] };
key <AC07> { [ j, J, udiaeresis, Udiaeresis ] };
key <AC08> { [ k, K, idiaeresis, Idiaeresis ] };
key <AC09> { [ l, L, odiaeresis, Odiaeresis ] };
key <AC10> { [ semicolon, colon, dead_acute, dead_abovering ] };
key <AC11> { [ apostrophe, quotedbl, dead_grave, dead_diaeresis ] };
key <BKSL> { [ backslash, bar, VoidSymbol, doublelowquotemark ] }; // „
key <LSGT> { [ less, greater, lessthanequal, greaterthanequal ] };
key <AB01> { [ z, Z, adiaeresis, Adiaeresis ] };
key <AB02> { [ x, X, multiply, division ] };
key <AB03> { [ c, C, ccedilla, Ccedilla ] };
key <AB04> { [ v, V, VoidSymbol, VoidSymbol ] };
key <AB05> { [ b, B, ssharp, U1E9E ] }; // ß, ẞ (capital)
key <AB06> { [ n, N, ntilde, Ntilde ] };
key <AB07> { [ m, M, VoidSymbol, VoidSymbol ] };
key <AB08> { [ comma, less, dead_cedilla, dead_ogonek ] };
key <AB09> { [ period, greater, periodcentered, ellipsis ] }; // ., >, ·, …
key <AB10> { [ slash, question, rightsinglequotemark, questiondown ] }; // /, ?, , ¿
key <SPCE> { [ space, space, nobreakspace, 0x100202F ] }; // espace insécable fine
};