Fix FZF
This commit is contained in:
@ -32,7 +32,7 @@ require("trouble").setup({
|
|||||||
},
|
},
|
||||||
indent_lines = true, -- add an indent guide below the fold icons
|
indent_lines = true, -- add an indent guide below the fold icons
|
||||||
auto_open = false, -- automatically open the list when you have diagnostics
|
auto_open = false, -- automatically open the list when you have diagnostics
|
||||||
auto_close = false, -- automatically close the list when you have no diagnostics
|
auto_close = true, -- automatically close the list when you have no diagnostics
|
||||||
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
|
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
|
||||||
auto_fold = false, -- automatically fold a file trouble list at creation
|
auto_fold = false, -- automatically fold a file trouble list at creation
|
||||||
auto_jump = { "lsp_definitions" }, -- for the given modes, automatically jump if there is only a single result
|
auto_jump = { "lsp_definitions" }, -- for the given modes, automatically jump if there is only a single result
|
||||||
@ -48,9 +48,12 @@ require("trouble").setup({
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- Mappings
|
-- Mappings
|
||||||
vim.api.nvim_set_keymap("n", "gr", "<Cmd>Trouble lsp_references<CR>", { silent = true, noremap = true })
|
local opts = { noremap = true, silent = true }
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>xx", "<Cmd>Trouble<CR>", { silent = true, noremap = true })
|
vim.api.nvim_set_keymap("n", "gr", "<Cmd>Trouble lsp_references<CR>", opts)
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>xw", "<Cmd>Trouble workspace_diagnostics<CR>", { silent = true, noremap = true })
|
vim.api.nvim_set_keymap("n", "<Leader>xx", "<Cmd>Trouble<CR>", opts)
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>xd", "<Cmd>Trouble document_diagnostics<CR>", { silent = true, noremap = true })
|
vim.api.nvim_set_keymap("n", "<Leader>xw", "<Cmd>Trouble workspace_diagnostics<CR>", opts)
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>xl", "<Cmd>Trouble loclist<CR>", { silent = true, noremap = true })
|
vim.api.nvim_set_keymap("n", "<Leader>xd", "<Cmd>Trouble document_diagnostics<CR>", opts)
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>xq", "<Cmd>Trouble quickfix<CR>", { silent = true, noremap = true })
|
vim.api.nvim_set_keymap("n", "<Leader>xl", "<Cmd>Trouble loclist<CR>", opts)
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>xq", "<Cmd>Trouble quickfix<CR>", opts)
|
||||||
|
vim.api.nvim_set_keymap("n", "[g", "<cmd>lua vim.diagnostic.goto_prev()<CR>", opts)
|
||||||
|
vim.api.nvim_set_keymap("n", "]g", "<cmd>lua vim.diagnostic.goto_next()<CR>", opts)
|
||||||
|
@ -164,13 +164,11 @@ local on_attach = function(client, bufnr)
|
|||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>tab split | lua vim.lsp.buf.definition()<CR>", opts)
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>tab split | lua vim.lsp.buf.definition()<CR>", opts)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts) -- diagnostics controls references
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "grf", "<cmd>lua vim.lsp.buf.references()<CR>", opts) -- diagnostics controls references
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "i", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
vim.api.nvim_buf_set_keymap(bufnr, "i", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||||
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gt", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "gt", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "[g", "<cmd>lua vim.diagnostic.goto_prev()<CR>", opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "]g", "<cmd>lua vim.diagnostic.goto_next()<CR>", opts)
|
|
||||||
|
|
||||||
vim.api.nvim_command("augroup LSP")
|
vim.api.nvim_command("augroup LSP")
|
||||||
vim.api.nvim_command("autocmd!")
|
vim.api.nvim_command("autocmd!")
|
||||||
|
@ -2,24 +2,6 @@
|
|||||||
|
|
||||||
export FZF_SOURCE="${HOME}/fzf-relevant-files.zsh"
|
export FZF_SOURCE="${HOME}/fzf-relevant-files.zsh"
|
||||||
|
|
||||||
# General fzf settings.
|
|
||||||
export FZF_DEFAULT_OPTS=" \
|
|
||||||
--inline-info \
|
|
||||||
--reverse \
|
|
||||||
--exact \
|
|
||||||
--color=fg+:#F8F8F8,bg+:#515559,pointer:#F8F8F8,marker:226 \
|
|
||||||
--bind=ctrl-e:select-all+accept \
|
|
||||||
--bind=ctrl-d:half-page-down \
|
|
||||||
--bind=ctrl-e:half-page-up
|
|
||||||
--bind=ctrl-t:toggle+down
|
|
||||||
--bind=ctrl-b:toggle+up
|
|
||||||
--bind=ctrl-g:select-all+accept \
|
|
||||||
"
|
|
||||||
# Preview code with pygmentize.
|
|
||||||
# export FZF_CS_PREVIEW_COMMAND="python /google/src/files/head/depot/google3/third_party/py/pygments/google/google_pygmentize.py -f terminal16m -O style=native"
|
|
||||||
# Preview highlight: foreground: RG(248, 248, 248) = #F8F8F8, background: RGB(81, 85, 89) = #515559.
|
|
||||||
export FZF_CS_PREVIEW_HIGHLIGHT="\x1b[38;2;248;248;248m\x1b[48;2;81;85;89m"
|
|
||||||
|
|
||||||
function create_fzf_command() {
|
function create_fzf_command() {
|
||||||
rg --files $(${FZF_SOURCE})
|
rg --files $(${FZF_SOURCE})
|
||||||
}
|
}
|
||||||
@ -36,50 +18,57 @@ _find_fig_workspaces() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_find_blaze_targets() {
|
_find_blaze_targets() {
|
||||||
# Our tool outputs space-separated directories of interest. Conver these to a
|
# Our tool outputs space-separated directories of interest. Convert these to a
|
||||||
# list, which we'll refer to later.
|
# list, which we'll refer to later.
|
||||||
local pkg
|
local pkg
|
||||||
local cleandir
|
local cleandir
|
||||||
local DIRS=( $(${FZF_SOURCE}) )
|
local DIRS=( $(${FZF_SOURCE}) )
|
||||||
# for dir in "${DIRS[@]}"; do
|
local is_first_iteration=1
|
||||||
# echo "$dir"
|
local query=""
|
||||||
# done
|
|
||||||
for dir in "${DIRS[@]}"; do
|
for dir in "${DIRS[@]}"; do
|
||||||
# Here we want:
|
# Here we want:
|
||||||
# .* - match all targets
|
# .* - match all targets
|
||||||
# //foo/bar/baz/... - the blaze package we're searching under
|
# //foo/bar/baz/... - the blaze package we're searching under
|
||||||
# We do a trailing '&' so that we run all of these in parallel.
|
# Strip any leading // and trailing /. This allows more flexibility in how
|
||||||
|
# people want to define their targets in their FZF_SOURCE file.
|
||||||
|
# Finally we will append each directory's query together with a "+" which
|
||||||
|
# allows us to query all targets with a single blaze query call.
|
||||||
|
if ((is_first_iteration)); then
|
||||||
|
is_first_iteration=0
|
||||||
|
else
|
||||||
|
query+=" + "
|
||||||
|
fi
|
||||||
|
cleandir=`echo $dir | sed 's:^//::; s:/$::'`
|
||||||
|
pkg="//${cleandir}/..."
|
||||||
|
query+="filter(.*, ${pkg})"
|
||||||
|
done
|
||||||
|
|
||||||
# We shunt 2>/dev/null to silence its info output, which for some reason
|
# We shunt 2>/dev/null to silence its info output, which for some reason
|
||||||
# comes out on stderr. This isn't ideal, because we'll swallow real errors.
|
# comes out on stderr. This isn't ideal, because we'll swallow real errors.
|
||||||
# Looking at `blaze help query`, I can't find any options to turn this off.
|
# Looking at `blaze help query`, I can't find any options to turn this off.
|
||||||
# `--logging=0` doesn't do it; `--show_loading_progress=false` doesn't do
|
# `--logging=0` doesn't do it; `--show_loading_progress=false` doesn't do
|
||||||
# it.
|
# it.
|
||||||
# Strip any leading // and trailing /. This allows more flexibility in how
|
# --keep_going is required in case any of the pkgs have no subtargets, if not
|
||||||
# people want to define their targets in their FZF_SOURCE file.
|
# provided the query will exit before evaluating other pkgs.
|
||||||
cleandir=`echo $dir | sed 's/^\/\///; s/\/$//'`
|
blaze query --keep_going "${query}" 2> /dev/null
|
||||||
pkg="//${cleandir}/..."
|
|
||||||
blaze query "filter(.*, ${pkg})" 2>/dev/null &
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# fzf completion for blaze targets beneath the current directory. eg:
|
# fzf completion for blaze targets beneath the current directory. Works on
|
||||||
|
# programs that use the blaze CLI eg:
|
||||||
#
|
#
|
||||||
# blaze build **<TAB>
|
# blaze build **<TAB>
|
||||||
|
# rabbit build **<TAB>
|
||||||
|
# iblaze build **<TAB>
|
||||||
#
|
#
|
||||||
# Syntax for this style of completion is taken from:
|
# Syntax for this style of completion is taken from:
|
||||||
# https://github.com/junegunn/fzf/wiki/Examples-(completion)#writing-custom-fuzzy-completion
|
# https://github.com/junegunn/fzf/wiki/Examples-(completion)#writing-custom-fuzzy-completion
|
||||||
_fzf_complete_blaze() {
|
_fzf_complete_blaze() {
|
||||||
_fzf_complete "" "$@" < <(_find_blaze_targets)
|
_fzf_complete "" "$@" < <(_find_blaze_targets)
|
||||||
}
|
}
|
||||||
|
alias _fzf_complete_rabbit="_fzf_complete_blaze"
|
||||||
# fzf completion for rabbit targets beneath the current directory. eg:
|
alias _fzf_complete_iblaze="_fzf_complete_blaze"
|
||||||
#
|
|
||||||
# rabbit test **<TAB>
|
|
||||||
#
|
|
||||||
_fzf_complete_rabbit() {
|
|
||||||
_fzf_complete "" "$@" < <(_find_blaze_targets)
|
|
||||||
}
|
|
||||||
|
|
||||||
_fzf_complete_hgd() {
|
_fzf_complete_hgd() {
|
||||||
_fzf_complete "" "$@" < <(_find_fig_workspaces)
|
_fzf_complete "" "$@" < <(_find_fig_workspaces)
|
||||||
@ -233,7 +222,7 @@ awk -v match_prefix=${match_prefix} ' { for (i = 1; i <= NF; i++) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# CTRL-F - Paste the selected flags into the command line. Copied from CTRL-T
|
# CTRL-Q - Paste the selected flags into the command line. Copied from CTRL-T
|
||||||
# bindings shown here:
|
# bindings shown here:
|
||||||
# https://github.com/junegunn/fzf/blob/master/shell/key-bindings.zsh
|
# https://github.com/junegunn/fzf/blob/master/shell/key-bindings.zsh
|
||||||
__flagsel() {
|
__flagsel() {
|
||||||
@ -271,3 +260,5 @@ fzf-flag-widget() {
|
|||||||
}
|
}
|
||||||
zle -N fzf-flag-widget
|
zle -N fzf-flag-widget
|
||||||
bindkey '^F' fzf-flag-widget
|
bindkey '^F' fzf-flag-widget
|
||||||
|
bindkey '^T' fzf-file-widget
|
||||||
|
bindkey '^R' fzf-history-widget
|
||||||
|
@ -11,7 +11,6 @@ export EDITOR='nvim'
|
|||||||
|
|
||||||
HISTCONTROL=ignoreboth
|
HISTCONTROL=ignoreboth
|
||||||
|
|
||||||
|
|
||||||
export DEVKITPRO=/opt/devkitpro
|
export DEVKITPRO=/opt/devkitpro
|
||||||
export DEVKITARM=${DEVKITPRO}/devkitARM
|
export DEVKITARM=${DEVKITPRO}/devkitARM
|
||||||
export DEVKITPPC=${DEVKITPRO}/devkitPPC
|
export DEVKITPPC=${DEVKITPRO}/devkitPPC
|
||||||
|
@ -36,24 +36,12 @@ fi
|
|||||||
|
|
||||||
# Install fzf-query
|
# Install fzf-query
|
||||||
export PATH="${PATH}:/google/bin/releases/editor-devtools"
|
export PATH="${PATH}:/google/bin/releases/editor-devtools"
|
||||||
# General fzf settings.
|
|
||||||
export FZF_DEFAULT_OPTS=" \
|
|
||||||
--inline-info \
|
|
||||||
--reverse \
|
|
||||||
--color=fg+:#F8F8F8,bg+:#515559,pointer:#F8F8F8,marker:226 \
|
|
||||||
--bind=ctrl-e:select-all+accept \
|
|
||||||
--bind=ctrl-d:half-page-down \
|
|
||||||
--bind=ctrl-e:half-page-up
|
|
||||||
--bind=ctrl-t:toggle+down
|
|
||||||
--bind=ctrl-b:toggle+up
|
|
||||||
--bind=ctrl-g:select-all+accept \
|
|
||||||
"
|
|
||||||
# Preview code with pygmentize.
|
# Preview code with pygmentize.
|
||||||
export FZF_CS_PREVIEW_COMMAND="python third_party/py/pygments/google/google_pygmentize.py -f terminal16m -O style=native"
|
export FZF_CS_PREVIEW_COMMAND="python third_party/py/pygments/google/google_pygmentize.py -f terminal16m -O style=native"
|
||||||
# Preview highlight: foreground: RG(248, 248, 248) = #F8F8F8, background: RGB(81, 85, 89) = #515559.
|
# Preview highlight: foreground: RG(248, 248, 248) = #F8F8F8, background: RGB(81, 85, 89) = #515559.
|
||||||
export FZF_CS_PREVIEW_HIGHLIGHT="\x1b[38;2;248;248;248m\x1b[48;2;81;85;89m"
|
export FZF_CS_PREVIEW_HIGHLIGHT="\x1b[38;2;248;248;248m\x1b[48;2;81;85;89m"
|
||||||
|
|
||||||
source ~/fzf-at-google.zsh
|
|
||||||
source ~/g3path.zsh
|
source ~/g3path.zsh
|
||||||
source /etc/bash_completion.d/hgd
|
source /etc/bash_completion.d/hgd
|
||||||
|
|
||||||
@ -77,3 +65,5 @@ alias hgd='source /google/src/head/depot/google3/experimental/fig_contrib/hgshor
|
|||||||
|
|
||||||
export ACID_STARTUP_SCRIPT_PATH=~/acid_startup.sh
|
export ACID_STARTUP_SCRIPT_PATH=~/acid_startup.sh
|
||||||
export PATH=$PATH:/usr/local/google/home/cnieves/.local/binexport PATH=$PATH:/usr/local/google/home/cnieves/.local/bin
|
export PATH=$PATH:/usr/local/google/home/cnieves/.local/binexport PATH=$PATH:/usr/local/google/home/cnieves/.local/bin
|
||||||
|
|
||||||
|
source ~/fzf-at-google.zsh
|
||||||
|
@ -21,7 +21,7 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]
|
|||||||
fi
|
fi
|
||||||
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
||||||
# [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
# [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
||||||
# plugins=(zsh-autosuggestions zsh-syntax-highlighting)
|
plugins=(zsh-autosuggestions zsh-syntax-highlighting)
|
||||||
|
|
||||||
ZSH_THEME=powerlevel10k/powerlevel10k
|
ZSH_THEME=powerlevel10k/powerlevel10k
|
||||||
DISABLE_AUTO_TITLE=true
|
DISABLE_AUTO_TITLE=true
|
||||||
@ -30,7 +30,6 @@ bindkey "^A" beginning-of-line
|
|||||||
bindkey "^E" end-of-line
|
bindkey "^E" end-of-line
|
||||||
bindkey "^K" kill-line
|
bindkey "^K" kill-line
|
||||||
bindkey "^L" clear-screen
|
bindkey "^L" clear-screen
|
||||||
bindkey "^R" history-incremental-search-backward
|
|
||||||
bindkey "^U" kill-whole-line
|
bindkey "^U" kill-whole-line
|
||||||
bindkey "^W" backward-kill-word
|
bindkey "^W" backward-kill-word
|
||||||
bindkey "^Y" yank
|
bindkey "^Y" yank
|
||||||
@ -247,8 +246,8 @@ zstyle :bracketed-paste-magic paste-finish pastefinish
|
|||||||
# "transport endpoint is not connected" errors
|
# "transport endpoint is not connected" errors
|
||||||
autoload -Uz add-zsh-hook
|
autoload -Uz add-zsh-hook
|
||||||
|
|
||||||
export FZF_DEFAULT_OPTS="--preview 'echo {}' --preview-window down:3:wrap --bind ?:toggle-preview"
|
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
||||||
|
|
||||||
source ~/.bash_profile
|
|
||||||
export ZSH="$HOME/.oh-my-zsh"
|
export ZSH="$HOME/.oh-my-zsh"
|
||||||
source $ZSH/oh-my-zsh.sh
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
|
source ~/.bash_profile
|
||||||
|
Reference in New Issue
Block a user