diff --git a/config/automatrop/roles/vim/templates/pluginlist.j2 b/config/automatrop/roles/vim/templates/pluginlist.j2 index 1203064..1706c64 100644 --- a/config/automatrop/roles/vim/templates/pluginlist.j2 +++ b/config/automatrop/roles/vim/templates/pluginlist.j2 @@ -16,20 +16,6 @@ " Theme source ~/.config/vim/theme.vim -" Status/tab lines -{% if variant == 'nvim' %} -{{ use_plugin('feline') }} -{% else %} -{{ use_plugin('airline') }} -{% endif %} - -" Goto utilities -{% if variant == 'nvim' %} -{{ use_plugin('telescope') }} -{% else %} -{{ use_plugin('fzf') }} -{% endif %} - " Search/replace {{ use_plugin('abolish') }} {{ use_plugin('easy_align') }} diff --git a/config/automatrop/roles/vim/templates/plugins/airline.j2 b/config/automatrop/roles/vim/templates/plugins/airline.j2 deleted file mode 100644 index db93f55..0000000 --- a/config/automatrop/roles/vim/templates/plugins/airline.j2 +++ /dev/null @@ -1,15 +0,0 @@ -{{ add_source('vim-airline/vim-airline') -}} -{{ add_source('vim-airline/vim-airline-themes') -}} -set noshowmode -set laststatus=2 -let g:airline_powerline_fonts = 1 -{% if variant != 'nvim' %} -let g:airline#extensions#tabline#enabled = 1 -{% endif %} - -let g:airline_section_a = airline#section#create(['mode']) -let g:airline_section_b = airline#section#create(['branch', 'hunks']) -" let g:airline_section_z = airline#section#create(['%B', '@', '%l', ':', '%c']) - -let airline#extensions#languageclient#error_symbol = '✖ ' -let airline#extensions#languageclient#warning_symbol = '⚠ ' diff --git a/config/automatrop/roles/vim/templates/plugins/fzf.j2 b/config/automatrop/roles/vim/templates/plugins/fzf.j2 deleted file mode 100644 index 08815c7..0000000 --- a/config/automatrop/roles/vim/templates/plugins/fzf.j2 +++ /dev/null @@ -1,36 +0,0 @@ -{# Fuzzy matching for all kind of stuff #} -{{ add_source('junegunn/fzf', {'do': './install --bin'}) }} -{{ add_source('junegunn/fzf.vim') -}} -let g:fzf_layout = { 'down': '~40%' } -let g:fzf_colors = -\ { 'fg': ['fg', 'Normal'], - \ 'bg': ['bg', 'Normal'], - \ 'hl': ['fg', 'Comment'], - \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], - \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], - \ 'hl+': ['fg', 'Statement'], - \ 'info': ['fg', 'PreProc'], - \ 'border': ['fg', 'Ignore'], - \ 'prompt': ['fg', 'Conditional'], - \ 'pointer': ['fg', 'Exception'], - \ 'marker': ['fg', 'Keyword'], - \ 'spinner': ['fg', 'Label'], - \ 'header': ['fg', 'Comment'] } - -let g:fzf_command_prefix = 'Fzf' -nmap gF :FzfFiles -nmap gf :FzfGFiles -nmap gb :FzfBuffers -nmap gL :FzfLines -nmap gl :FzfBLines -nmap gT :FzfTags -nmap gt :FzfBTags -nmap gm :FzfMarks -nmap gw :FzfWindows -nmap gh :FzfHistory -nmap gH :FzfHistory: -nmap gS :FzfHistory/ -nmap gs :FzfSnippets - -" TODO `gd` → go to tag matching selected word, or show a list with that -" of tags pre-filtered with that word diff --git a/config/automatrop/roles/vim/templates/plugins/telescope.j2 b/config/automatrop/roles/vim/templates/plugins/telescope.j2 deleted file mode 100644 index c8424ca..0000000 --- a/config/automatrop/roles/vim/templates/plugins/telescope.j2 +++ /dev/null @@ -1,52 +0,0 @@ -{{ add_source('nvim-telescope/telescope.nvim') -}} -{# Dependencies #} -{{ add_source('nvim-lua/popup.nvim') -}} -{{ add_source('nvim-lua/plenary.nvim') -}} -{# Extensions #} -{{ add_source('nvim-telescope/telescope-fzf-native.nvim', {'do': 'make'}) -}} - -noremap gF Telescope find_files -noremap gf Telescope git_files -noremap gB Telescope buffers -noremap gl Telescope current_buffer_fuzzy_find -noremap gL Telescope live_grep -noremap gT Telescope tags -noremap gt Telescope treesitter -noremap gm Telescope marks -noremap gh Telescope oldfiles -noremap gH Telescope command_history -noremap gS Telescope search_history -noremap gC Telescope commands -noremap gr Telescope lsp_references -noremap ga Telescope lsp_code_actions -vnoremap ga Telescope lsp_range_code_actions -noremap ge Telescope lsp_document_diagnostics -noremap gE Telescope lsp_workspace_diagnostics -noremap gd Telescope lsp_definitions -noremap gs Telescope lsp_document_symbols - -lua << EOF -require('telescope').setup{ - defaults = { - vimgrep_arguments = { - 'rg', - '--color=never', - '--no-heading', - '--with-filename', - '--line-number', - '--column', - '--smart-case' - }, - }, - extensions = { - fzf = { - fuzzy = true, -- false will only do exact matching - override_generic_sorter = true, -- override the generic sorter - override_file_sorter = true, -- override the file sorter - case_mode = "smart_case", -- or "ignore_case" or "respect_case" - -- the default case_mode is "smart_case" - } - } -} -require('telescope').load_extension('fzf') -EOF diff --git a/config/nix/hm/dev.nix b/config/nix/hm/dev.nix index 1e68ef8..7e9f634 100644 --- a/config/nix/hm/dev.nix +++ b/config/nix/hm/dev.nix @@ -20,7 +20,6 @@ jq universal-ctags highlight - ripgrep # For nvim's :Telescope live_grep zeal-qt6 # Offline documentation # Docker diff --git a/config/nix/hm/vim.nix b/config/nix/hm/vim.nix index 4106e72..90189db 100644 --- a/config/nix/hm/vim.nix +++ b/config/nix/hm/vim.nix @@ -28,10 +28,59 @@ in # Tabline barbar.enable = true; + + # Go to whatever + telescope = { + enable = true; + # FIXME Crashes nvim on startup, complaining about some keymap + # keymaps = { + # gF = "find_files"; + # gf = "git_files"; + # gB = "buffers"; + # gl = "current_buffer_fuzzy_find"; + # gL = "live_grep"; + # gT = "tags"; + # gt = "treesitter"; + # gm = "marks"; + # gh = "oldfiles"; + # gH = "command_history"; + # gS = "search_history"; + # gC = "commands"; + # gr = "lsp_references"; + # ga = "lsp_code_actions"; + # ge = "lsp_document_diagnostics"; + # gE = "lsp_workspace_diagnostics"; + # gd = "lsp_definitions"; + # gs = "lsp_document_symbols"; + # }; + defaults = { + vimgrep_arguments = [ + "${pkgs.ripgrep}/bin/rg" + "--color=never" + "--no-heading" + "--with-filename" + "--line-number" + "--column" + "--smart-case" + ]; + }; + extensions.fzf-native = { + enable = true; + caseMode = "smart_case"; + fuzzy = true; + overrideFileSorter = true; + overrideGenericSorter = true; + }; + }; }; extraPlugins = with pkgs.vimPlugins; [ nvim-scrollview + + # Status line + feline-nvim # TODO Abandonned. Maybe use lualine? ]; + extraConfigLua = "${builtins.readFile ./vim/feline.lua}"; + # 23.11: Use keymaps, seems better maps = { # barbar diff --git a/config/automatrop/roles/vim/templates/plugins/feline.j2 b/config/nix/hm/vim/feline.lua similarity index 84% rename from config/automatrop/roles/vim/templates/plugins/feline.j2 rename to config/nix/hm/vim/feline.lua index aa49c02..2b5d8fe 100644 --- a/config/automatrop/roles/vim/templates/plugins/feline.j2 +++ b/config/nix/hm/vim/feline.lua @@ -1,32 +1,33 @@ -{# Customisable status line #} -{{ add_source('famiu/feline.nvim') -}} -set noshowmode -set laststatus=2 -lua << EOF -local base16_colors = require('base16-colorscheme').colors +vim.cmd([[ + set noshowmode + set laststatus=2 +]]) +-- local base16_colors = require('base16-colorscheme').colors +-- FIXME Color setting doesn't work, see ./feline_test.vim for a reproducible use case +-- that works on Arch but not on Nix (with Plug stuff removed) local vi_mode_utils = require('feline.providers.vi_mode') local lsp = require('feline.providers.lsp') require('feline').setup({ - default_bg = 'base01', - default_fg = 'base04', - theme = { - base00 = base16_colors.base00, - base01 = base16_colors.base01, - base02 = base16_colors.base02, - base03 = base16_colors.base03, - base04 = base16_colors.base04, - base05 = base16_colors.base05, - base06 = base16_colors.base06, - base07 = base16_colors.base07, - base08 = base16_colors.base08, - base09 = base16_colors.base09, - base0A = base16_colors.base0A, - base0B = base16_colors.base0B, - base0C = base16_colors.base0C, - base0D = base16_colors.base0D, - base0E = base16_colors.base0E, - base0F = base16_colors.base0F, - }, + -- default_bg = 'base01', + -- default_fg = 'base04', + -- theme = { + -- base00 = base16_colors.base00, + -- base01 = base16_colors.base01, + -- base02 = base16_colors.base02, + -- base03 = base16_colors.base03, + -- base04 = base16_colors.base04, + -- base05 = base16_colors.base05, + -- base06 = base16_colors.base06, + -- base07 = base16_colors.base07, + -- base08 = base16_colors.base08, + -- base09 = base16_colors.base09, + -- base0A = base16_colors.base0A, + -- base0B = base16_colors.base0B, + -- base0C = base16_colors.base0C, + -- base0D = base16_colors.base0D, + -- base0E = base16_colors.base0E, + -- base0F = base16_colors.base0F, + -- }, components = { active = { { @@ -164,4 +165,3 @@ require('feline').setup({ }, } }) -EOF diff --git a/config/nix/hm/vim/feline_test.vim b/config/nix/hm/vim/feline_test.vim new file mode 100644 index 0000000..7ddb1cd --- /dev/null +++ b/config/nix/hm/vim/feline_test.vim @@ -0,0 +1,9 @@ +source ~/.config/vim/plug.vim +call plug#begin('~/.cache/nvim/plugged') +Plug 'RRethy/nvim-base16' +call plug#end() + +colorscheme base16-solarized-dark +lua << EOF +a = require('base16-colorscheme').colors.base00 +EOF