From 5acfc464dce1e4889b0b301744daee71ba1f4d5c Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Fri, 21 Jan 2022 10:37:04 -0600 Subject: [PATCH] refactor fzf.zsh WIP wip: add whitespace that isn't tidy.nvim --- .../nvim/lua/keybindings.lua | 1 + home/private_dot_config/nvim/lua/plugins.lua | 41 ++++++++++--- home/private_dot_config/nvim/lua/settings.lua | 2 + system/fzf.zsh | 61 +++++++++++-------- 4 files changed, 71 insertions(+), 34 deletions(-) diff --git a/home/private_dot_config/nvim/lua/keybindings.lua b/home/private_dot_config/nvim/lua/keybindings.lua index 4b5e426..6938725 100644 --- a/home/private_dot_config/nvim/lua/keybindings.lua +++ b/home/private_dot_config/nvim/lua/keybindings.lua @@ -11,3 +11,4 @@ end map('i','jk','',{noremap=true}) map('v','jk','',{noremap=true}) + diff --git a/home/private_dot_config/nvim/lua/plugins.lua b/home/private_dot_config/nvim/lua/plugins.lua index 36e7fd9..b3a6dcc 100644 --- a/home/private_dot_config/nvim/lua/plugins.lua +++ b/home/private_dot_config/nvim/lua/plugins.lua @@ -1,11 +1,11 @@ -- LOAD THE PLUGINS -- install packer on the fly -local fn = vim.fn -local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' -if fn.empty(fn.glob(install_path)) > 0 then - Packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) -end +-- local fn = vim.Fn +-- local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' +-- if fn.empty(fn.glob(install_path)) > 0 then +-- packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) +-- end -- @@ -13,6 +13,7 @@ return require('packer').startup(function(use) use 'wbthomason/packer.nvim' use 'preservim/NERDTree' + use { 'goolord/alpha-nvim', requires = { 'kyazdani42/nvim-web-devicons' }, @@ -20,19 +21,40 @@ return require('packer').startup(function(use) require'alpha'.setup(require'alpha.themes.startify'.opts) end } + use { 'airblade/vim-gitgutter', - config = function () + config = function() local cmd = vim.cmd cmd [[highlight! link SignColumn LineNr]] end } use { - 'neoclide/coc.nvim', - branch='release' + 'norcalli/nvim-colorizer.lua', + conifg = function() + require'colorizer'.setup() + end + } + + use { + "folke/which-key.nvim", + config = function() + require("which-key").setup() + end } + + use { + "ntpeters/vim-better-whitespace", + config = function() + local cmd = vim.cmd + cmd [[ let g:strip_whitespace_on_save = 1 ]] + end +} + + + -- style use 'Mofiqul/dracula.nvim' -- language specific plugins @@ -46,8 +68,7 @@ return require('packer').startup(function(use) -- toml use 'cespare/vim-toml' - if Packer_bootstrap then + if packer_bootstrap then require('packer').sync() end end) - diff --git a/home/private_dot_config/nvim/lua/settings.lua b/home/private_dot_config/nvim/lua/settings.lua index 3d2ba53..e41674b 100644 --- a/home/private_dot_config/nvim/lua/settings.lua +++ b/home/private_dot_config/nvim/lua/settings.lua @@ -3,6 +3,8 @@ local o = vim.o local w = vim.wo local b = vim.bo +vim.g.mapleader = ' ' + b.autoindent = true b.expandtab = true b.softtabstop = 4 diff --git a/system/fzf.zsh b/system/fzf.zsh index d12d7e6..0cf5006 100644 --- a/system/fzf.zsh +++ b/system/fzf.zsh @@ -1,43 +1,56 @@ # Auto-completion # --------------- -[[ $- == *i* ]] && source "$HOME/.fzf/shell/completion.zsh" 2> /dev/null +[[ $- == *i* ]] && source "$HOME/.fzf/shell/completion.zsh" 2>/dev/null # Key bindings # ------------ source "$HOME/.fzf/shell/key-bindings.zsh" +FZF_COLORS=" +--color=dark +--color=fg:-1,bg:-1,hl:#5fff87,fg+:-1,bg+:-1,hl+:#ffaf5f +--color=info:#af87ff,prompt:#5fff87,pointer:#ff87d7,marker:#ff87d7,spinner:#ff87d7 +" +FZF_LAYOUT=" +--height=40% +--border=rounded +--margin=0,5,5% +--layout=reverse +" -# Configs -export FZF_DEFAULT_OPTS="--color=fg:#f8f8f2,bg:#282a36,hl:#bd93f9 - --color=fg+:#f8f8f2,bg+:#44475a,hl+:#bd93f9 - --color=info:#ffb86c,prompt:#50fa7b,pointer:#ff79c6 - --color=marker:#ff79c6,spinner:#ffb86c,header:#6272a4 - --layout=reverse --info=inline --border=horizontal - --min-height=25" - +export FZF_DEFAULT_OPTS=${FZF_COLORS}${FZF_LAYOUT} +export FZF_CTRL_GENERAL="--height=100% --margin=0,0,0" #adapted from https://github.com/zimfw/fzf/blob/master/init.zsh -if (( ${+commands[fd]} )); then - export FZF_DEFAULT_COMMAND="command fd --type file --exclude ".git/" --hidden --no-ignore" - _fzf_compgen_path() { - command fd --type file --exclude ".git/" --hidden --no-ignore "${1}" - } -elif (( ${+commands[rg]} )); then - export FZF_DEFAULT_COMMAND="command rg -uu -g '!.git' --files" - _fzf_compgen_path() { - command rg -uu -g '!.git' --files "${1}" - } +if [ -x "$(command -v fd)" ]; then + export FZF_DEFAULT_COMMAND="command fd --type file --exclude ".git/" --hidden --no-ignore" + _fzf_compgen_path() { + command fd --type file --exclude ".git/" --hidden --no-ignore "${1}" + } +elif [ -x "$(command -v rg)" ]; then + export FZF_DEFAULT_COMMAND="command rg -uu -g '!.git' --files" + _fzf_compgen_path() { + command rg -uu -g '!.git' --files "${1}" + } fi -if (( ${+commands[bat]} )); then - export FZF_CTRL_T_OPTS="--preview 'command bat --color=always --line-range :500 {}' ${FZF_CTRL_T_OPTS}" +if [ -x "$(command -v bat)" ]; then + export FZF_CTRL_T_OPTS=" + --preview 'command bat --style numbers --color=always --line-range :500 {}' + --preview-window up,70%,border-rounded + ${FZF_CTRL_GENERAL} + " fi -export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -200'" +export FZF_ALT_C_OPTS=" + --height 60% + --preview 'lsd --tree --color always --icon always {}' + --preview-window right,60%,border-rounded + " -if (( ${+FZF_DEFAULT_COMMAND} )) export FZF_CTRL_T_COMMAND=${FZF_DEFAULT_COMMAND} +# [[ -v FZF_CTRL_T_COMMAND ]] && && export FZF_CTRL_T_COMMAND=${FZF_DEFAULT_COMMAND} +[[ -z "$FZF_CTRL_T_COMMAND" ]] && export FZF_CTRL_T_COMMAND="${FZF_DEFAULT_COMMAND}" # fix spacing on fzf-tab to show max options zstyle ':fzf-tab:*' fzf-pad 4 -