commit b52879b07853a20593da714162be1dd6856dc8c6
parent a36dc27c53be39d2b066aefba7dbf59570fce6d0
Author: benjamin paul <bpaul@bpaul.xyz>
Date: Sat, 31 Jul 2021 10:18:39 +1000
telescope colourscheme
Diffstat:
3 files changed, 53 insertions(+), 3 deletions(-)
diff --git a/home/modules/dev/neovim/default.nix b/home/modules/dev/neovim/default.nix
@@ -69,10 +69,15 @@ in
{ plugin = mattn-calendar-vim; }
{ plugin = nvim-compe; config = luaConfig ./compe.lua; }
{ plugin = nvim-lspconfig; }
- { plugin = nvim-treesitter; config = "lua require'nvim-treesitter.configs'.setup{highlight={enable=true}}"; }
- { plugin = telescope-nvim; }
+ { plugin = pkgs.vimPlugins.nvim-treesitter.withPlugins (_: pkgs.tree-sitter.allGrammars); config = "lua require'nvim-treesitter.configs'.setup{highlight={enable=true}}"; }
+ { plugin = telescope-nvim; config = luaConfig ./telescope.lua; }
+ { plugin = telescope-bibtex-nvim; }
+ { plugin = telescope-cheat-nvim; }
+ { plugin = telescope-frecency-nvim; }
{ plugin = telescope-symbols-nvim; }
+ { plugin = telescope-fzy-native-nvim; }
{ plugin = plenary-nvim; }
+ { plugin = popup-nvim; }
{ plugin = vim-dispatch; }
{ plugin = vim-nix; }
{ plugin = vim-polyglot; }
diff --git a/home/modules/dev/neovim/init.lua b/home/modules/dev/neovim/init.lua
@@ -57,7 +57,7 @@ vim.api.nvim_set_keymap('n', '<leader>x', '$x',
vim.api.nvim_set_keymap('n', '<leader>f', '1z=',
{ noremap = true, silent = true })
-- Make leader+C open the colour scheme menu
-vim.api.nvim_set_keymap('n', '<leader>C', ':lua colourscheme()<CR>',
+vim.api.nvim_set_keymap('n', '<leader>C', ':Telescope colorscheme<CR>',
{ noremap = true, silent = true })
-- Make Shift-Delete do nothing (my keyboard is weird so I press it a lot)
@@ -71,6 +71,7 @@ for i = 2,255 do vim.wo.colorcolumn = vim.wo.colorcolumn .. ',+' .. i end
vim.api.nvim_command('command! W w')
-- Command that opens fzf for colour schemes
+-- This is obsolete because I use telescope now
function colourscheme()
vim.api.nvim_eval('fzf#run(fzf#wrap({"source":luaeval("{'..string.gsub(vim.api.nvim_eval("globpath(&rtp, 'colors/*.vim')") .. '\n','.-/colors/(.-).vim\n',"'%1',")..'}"),"sink":"colorscheme"}))')
end
diff --git a/home/modules/dev/neovim/telescope.lua b/home/modules/dev/neovim/telescope.lua
@@ -0,0 +1,44 @@
+require('telescope').setup{
+ defaults = {
+ vimgrep_arguments = {
+ 'rg',
+ '--color=never',
+ '--no-heading',
+ '--with-filename',
+ '--line-number',
+ '--column',
+ '--smart-case'
+ },
+ prompt_prefix = "> ",
+ selection_caret = "> ",
+ entry_prefix = " ",
+ initial_mode = "insert",
+ selection_strategy = "reset",
+ sorting_strategy = "descending",
+ layout_strategy = "horizontal",
+ layout_config = {
+ horizontal = {
+ mirror = false,
+ },
+ vertical = {
+ mirror = false,
+ },
+ },
+ file_sorter = require'telescope.sorters'.get_fuzzy_file,
+ file_ignore_patterns = {},
+ generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter,
+ winblend = 0,
+ border = {},
+ borderchars = { '─', '│', '─', '│', '╭', '╮', '╯', '╰' },
+ color_devicons = true,
+ use_less = true,
+ path_display = {},
+ set_env = { ['COLORTERM'] = 'truecolor' }, -- default = nil,
+ file_previewer = require'telescope.previewers'.vim_buffer_cat.new,
+ grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new,
+ qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new,
+
+ -- Developer configurations: Not meant for general override
+ buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker
+ }
+}