Coder Social home page Coder Social logo

fzf-marks's Introduction

Hello, world!

I am a researcher (Inria Starting Faculty Position) in the MATHERIALS group, a joint research team of Inria and École des Ponts ParisTech. My research focus within MATHERIALS is on the development and analysis of efficient and robust sampling methods in high dimensions, particularly for applications related to statistical inverse problems and computational statistical physics.

Most of the scientific software I wrote for my research is available on this Github page. This includes

  • A Python library for Fourier/Hermite spectral methods;

  • A library of Python scripts implementing interacting particle methods for Bayesian inverse problems;

  • A FreeFem++ code for the Cahn-Hilliard equation;

  • A Julia code for calculating the effective diffusion coefficient associated with standard Langevin dynamics, using a variance reduction approach based on control variates.

My GitHub stats

fzf-marks's People

Contributors

3ximus avatar aaronjensen avatar akinomyoga avatar awerebea avatar brendanfalk avatar cdlm avatar cibinmathew avatar crisidev avatar dguo avatar joshuacrewe avatar leonb avatar marsoft avatar michaelmior avatar molovo avatar orestisfl avatar thiagotalma avatar thomd avatar urbainvaes avatar yuzhy8701 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fzf-marks's Issues

(Feature Request) Open marked files with default $EDITOR

Hi, first of all.... this is amazing, THANK YOU!!!
When I saw this initially, I thought, as it can mark files as well as directories, that pressing ENTER on a file would open the file just as it does a directory, but it appears that it just navigates to the file's directory instead.
I think it would be alot nicer to open any mark, not just directories, otherwise marking files is not needed, we can already just mark the directory instead which is better.
For example: I marked my 'zshrc' & 'bashrc' when I could've just marked '/etc' instead which gives me access to both files through one shortcut.

My feauture request would make FZM's file marking a very valuable feature!
FZM could default to: default $EDITOR (if set)
If not: look for 'nano' & 'vi/vim' as both of these editors are pre-installed in most distros now unless...
a variable for us to set like: "FZM_EDITOR" to let us pick our own, this could serve an extra purpose also! adding this means we could fill up FZM with all of our project's files and have them open in vim, but still have my default editor set as micro for opening normal txt/rc/configs when outside of FZM.
Thank you again.

Dup marks

Can't reproduce but sometimes plugin give dup mark when trying to use its functions.

Provide more CLI commands

Hi, first off, thanks for a fantastic tool, I've used it with great joy for some 1-2 years!

Many many years ago, like 10-13 or so, I started using bashmarks which provide some very neat one-letter shell commands like g mark, s mark etc.

Through the years I've used different shell bookmarks tools like jump & cd-bookmark and I've always kept the original bashmark-style commands by creating similar aliases to the other bookmarking tools, as they are so convenient!

fzf-marks stared a new area of bookmarking, with the interactive menu. When searching for a bookmark I don't know the exact name of, the the fzf interactive menu is perfect! When I know the exact name, it's often easier and faster to use a direct command.

Thus I've used aliases & functions also with fzf-marks, in the style of Bashmarks. This is what I have in my shell startup file:

alias g='fzm'                   # Jump to mark (provided as argument)
alias s='mark'                  # Save current dir as mark (provided as argument)
alias e="vi $FZF_MARKS_FILE"    # Edit bookmarks file. 
alias l="sort $FZF_MARKS_FILE"  # List all bookmarks

_fzf_marks_delete() {
  local mark="$1"
  
  if ! grep -q "^$mark : " $FZF_MARKS_FILE; then
	  echo "$mark is not in the bookmarks" >&2
	  return 2
  fi
  sed -i.bak -e "/^${mark} : /d" "$FZF_MARKS_FILE" && rm "$FZF_MARKS_FILE.bak"
}
alias d='_fzf_marks_delete'  # Delete mark (provided as arg)

_fzf_marks_print() {
  local mark="$1"
  
  if ! grep -q "^$mark : " $FZF_MARKS_FILE; then
	  echo "$mark is not in the bookmarks" >&2
	  return 2
  fi
	  grep "^$mark :" $FZF_MARKS_FILE | awk '{print $3}'
  }
alias p='_fzf_marks_print'  # Print a mark (provided as arg)

This works, but it would be neat if there was built-in support by this tool to do operations like edit, list and delete a mark!

Note: I'm not requesting that this tool should adopt the bashmark-style command names like g, s etc., that I can always create myself, but a requst to provide some switches or subcommands to fzfm or mark to do this. Maybe mark -d abookmark could delete a bookmark named abookmark for example.

front end to fzm

Hi, thanks for fzf-marks, I use it all the time.

I have wrapped it up in something that makes it more practical for me and maybe makes it more practical for other.

Let me know if something isn't clear.

cdm ()
{
if [[ ${#@} == 0 || ${#@} -gt 1 ]] ; then
fzm
else
matches=$(cat $FZF_MARKS_FILE | awk '{print $1}' | grep "$1" | wc -l)

if [[ $matches == 0 ]] ; then
	fzm
elif [[ $matches -gt 1 ]] ; then
	directory=$(_color_marks <<< $(perl -ane '$F[0] =~ /'$1'/ and print $_' $FZF_MARKS_FILE) | fzf --ansi --height 50% --reverse) 
	[[ $? == 0 ]] && cd $(echo "$directory" | awk '{print $3}')
else
	directory=$(perl -ane '$F[0] =~ /'$1'/ and print $F[2]' $FZF_MARKS_FILE) 
	[[ -n "directory" ]] && cd "$directory" || fzm "$1"
fi

fi
}

_cdm_completion()
{
COMPREPLY=( $( compgen -W "$(cat $FZF_MARKS_FILE | awk '{print $1}' | ([[ -n $2 ]] && grep $2 || cat | tr '
' ' '))" -- ${COMP_WORDS[$COMP_CWORD]} ))
}

readlink -f is not portable

The use of readlink -f at

fname=$(readlink -f "${FZF_MARKS_FILE}")
relies on the GNU implementation and is broken with the BSD readlink available by default on macOS, whose man page says:

     -f format
             Display information using the specified format.  See the FORMATS section for a description of valid formats.

GNU readlink is available but it will probably be named greadlink (as installed via Brew)

[Feature Request] Option to direct cd bookmark in case of exact match

Hey,

first thank you for this cool plugin!

As I just started to use it I already noticed a part of my workflow from a previous shell plugin manager that did not translate well to fzf-marks for me. If I type $ fzm abc and there are many bookmarks who's bookmark name matches abc, it's completely reasonable to open up the FZF selector window (current behaviour).

However in the case it's already an exact match of a bookmark, that is I have a bookmark with name abc, I would expect that I directly cd to that bookmark instead of showing suggestions for other partial matches.

This is important to be able to work fast in the shell. If I know that I want to go to bookmark abc, then $ fzm abc should be enough to take me there. Currently the window will pop up on a exact name match and I need to press enter to go there.

As this is maybe not the behaviour that everyone desires, I would propose that we introduce a new opt-in configuration option:

Config Default Description
FZF_MARKS_JUMP_EXACT_MATCH false With fzm, cd to bookmark directly if the optional-initial-query is an exact match for a bookmark

could not delete multiple marks, and not showing delete marks

Thanks for this handy plugin. I found it is not possible to delete multiple marks, only one is deleted.
And it do not show the deleted paths after the message " The following mark has been deleted ".

I installed the plugin with fisher, fish version v3.4.1, fzf v0.27.2. Thanks!

keybinding disable

I have remapped the key binding for fzm to ^k , which works fine for me, but I noticed that ^g is still active.

Is there a way to completely disable the ^g key mapping completely?

The last 3 lines of output are cut off

Issue

I have a script which runs ls every time the directory is changed. When I jump to a mark by pressing <C-g>, the last 3 lines of ls are cut off (as well as a part of the prompt).

Screenshots

fzf_issue1
fzf_issue2
fzf_issue3
Sorry for huge screenshots ¯\_(ツ)_/¯

cd hooks aren't triggered after jumping

For example, if you use direnv you have to hit enter once on the empty prompt before it catches that you changed directory. I'm not sure if I've got something wrong in my setup or if this is just a side effect of how fzf-marks actually changes directories...

Fish shell plugin is currently broken

❯ fish -v
fish, version 3.1.0
❯ ~/.config/fish/functions/fzf-marks.plugin.fish (line 1): Invalid redirection target:
_color_marks < $FZF_MARKS_FILE | $FZF_MARKS_COMMAND \
             ^
in command substitution
        called on line 93 of file ~/.config/fish/functions/fzf-marks.plugin.fish
in function 'fzm'
~/.config/fish/functions/fzf-marks.plugin.fish: Unknown error while evaluating command substitution

Adding bash install instructions

Using bash shell it wasn't obvious on how to get it to work based on current instructions.
I think the readme could benefit from something like along this lines:

git clone https://github.com/urbainvaes/fzf-marks.git
cd fzf-marks
source fzf-marks.plugin.bash # can be put in  
# make it start up on log:
echo "source $PWD/fzf-marks.plugin.bash" >> ~/.profile

Anyway, really nice piece of software!

(feature request) Inserting marked directory in cmd rather than jump to it

First of all, thanks again for fzm, using it daily!

One thing that could be a nice improvement is placing a selected dir into the command line rather than jumping to it.
I.e. say just want to list the content of a marked dir, being on the shell, typying ls hitting ctrl-G to fire up fzm,
I could imagine there to be an additional option to just copy the marked dir to the shell. Ending up in ls myselecteddir on the cmd.

I could have look to implement it myself if you don't have time etc, but would have to get proficient first.

Naivly, I'd imagine to create a new function similar to the jump function, but instead of cd pasting the dir on the cmd:

cd "${jumpdir}" || return

I.e. instead of cd using echo, which doesn't quite work, but I wouldn't know to make it work, maybe I'm just missing the right command..

fzf-marks.plugin.zsh:177 command not found: compdef

Seems that after last month update I keep getting: 😱 🙈

~/.cache/zsh/plugs/fzf-marks/fzf-marks.plugin.zsh:177: command not found: compdef

compdef _fzm fzm

I do not really know what is going on because I've got zsh's completion system activated in my zshrc file:

autoload -Uz compinit
compinit

and after spawning shell the compdef command is available?

btw. I appreciate your work! thx 💚

Use case with tmux - add new window based on marks

I'd like share with you guys little script that I use on a daily basis. It spawns new tmux's window based on mark entries. I hope someone find this useful. 👀 🙏 🎉

#!/usr/bin/env bash
# Author: qaraluch - 07.2020 - MIT
# Add new window to the tmux session
# based on fzf-marks entries
readonly _pName=$(basename $0)
IFS=$'\n' readonly fzfMarksEntry=("$(cat ${FZF_MARKS_FILE} | fzf-tmux --exit-0)")
readonly name=$(awk -F':' '{print $1}' <<< "$fzfMarksEntry" | sed 's/[ \t]\?//g')
readonly path=$(awk -F':' '{print $2}' <<< "$fzfMarksEntry" | sed 's/[ \t]\?//g')
if [[ -d "$path" ]]; then
  tmux new-window -d -n "${name}" -c "${path}"
else
  echo "[ ${_pName} ] Destination dir for new tmux window seems does not exist... :o"
fi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.