commit 2645dfced03467e32b440888abef9c28150a4c66
parent bc9123f63efbf0f2fab8a2557065c83196644ecf
Author: Benjamin Paul <bpaul848@gmail.com>
Date: Thu, 20 May 2021 19:52:31 +1000
fzf stuff
Diffstat:
4 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/home/home.nix b/home/home.nix
@@ -31,6 +31,7 @@
home.packages = [
# packages
pkgs.ccls
+ pkgs.fzf
pkgs.gcc
pkgs.i3lock-color
pkgs.tree-sitter
diff --git a/home/modules/neovim/default.nix b/home/modules/neovim/default.nix
@@ -49,6 +49,7 @@ with lib;
'';
plugins = [
{ plugin = pkgs.vimPlugins.vim-nix; }
+ { plugin = pkgs.vimPlugins.fzfWrapper; }
{ plugin = pkgs.vimPlugins.idris2-vim; }
{ plugin = config.neovim.colourSchemePackage; config = "colorscheme ${config.neovim.colourScheme}"; }
{ plugin = pkgs.vimPlugins.nvim-lspconfig; }
diff --git a/home/modules/neovim/init.lua b/home/modules/neovim/init.lua
@@ -54,6 +54,9 @@ vim.api.nvim_set_keymap('n', '<leader>x', '$x',
-- Make leader+f fix the spelling of the current word
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>',
+ { noremap = true, silent = true })
-- Make Shift-Delete do nothing (my keyboard is weird so I press it a lot)
vim.api.nvim_set_keymap('i', '<S-Del>', '', { noremap = true, silent = true })
@@ -62,6 +65,13 @@ vim.api.nvim_set_keymap('i', '<S-Del>', '', { noremap = true, silent = true })
vim.wo.colorcolumn = vim.wo.colorcolumn .. '+' .. 1
for i = 2,255 do vim.wo.colorcolumn = vim.wo.colorcolumn .. ',+' .. i end
+-- Funky commands
+
+-- Command that opens fzf for colour schemes
+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
+
-- LSP
require('lspconfig').ccls.setup{}
diff --git a/home/modules/zsh.nix b/home/modules/zsh.nix
@@ -47,9 +47,35 @@ in
TERMINAL = "alacritty";
};
- # initExtra = ''
- # . ~/.nix-profile/etc/profile.d/nix.sh
- # '';
+ initExtra = ''
+ #. ~/.nix-profile/etc/profile.d/nix.sh
+
+ # From the fzf wiki
+ fd() {
+ local dir
+ dir=$(find ''${1:-.} -path '*/\.*' -prune \
+ -o -type d -print 2> /dev/null | fzf-tmux -r +m) &&
+ cd "$dir"
+ }
+
+ fh() {
+ eval $(history -n | fzf-tmux -r +m)
+ }
+
+ fmv() {
+ local dir
+ dir=$(find ''${2:-.} -path '*/\.*' -prune \
+ -o -type d -print 2> /dev/null | fzf-tmux -r +m) &&
+ mv $1 "$dir"
+ }
+
+ fcp() {
+ local dir
+ dir=$(find ''${2:-.} -path '*/\.*' -prune \
+ -o -type d -print 2> /dev/null | fzf-tmux -r +m) &&
+ cp $1 "$dir"
+ }
+ '';
plugins = [
{