summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShubham Saini <pryr@pryr.xyz>2022-05-27 22:21:38 +0000
committerShubham Saini <pryr@pryr.xyz>2022-05-27 22:21:38 +0000
commitd4066c231818cb3e8c97d961d0eb89e83180a0d8 (patch)
treeeeb5a34a8cfb04d9b766979a0e49113a6bd76925
parent2ce4fbab0eee785d915d8f347186065299ab05e0 (diff)
added lf
-rw-r--r--lf/.config/lf/lfrc103
-rwxr-xr-xnvim/.config/nvim/init.vim2
2 files changed, 105 insertions, 0 deletions
diff --git a/lf/.config/lf/lfrc b/lf/.config/lf/lfrc
new file mode 100644
index 0000000..d10983c
--- /dev/null
+++ b/lf/.config/lf/lfrc
@@ -0,0 +1,103 @@
1# interpreter for shell commands
2set shell sh
3
4# set '-eu' options for shell commands
5# These options are used to have safer shell commands. Option '-e' is used to
6# exit on error and option '-u' is used to give error for unset variables.
7# Option '-f' disables pathname expansion which can be useful when $f, $fs, and
8# $fx variables contain names with '*' or '?' characters. However, this option
9# is used selectively within individual commands as it can be limiting at
10# times.
11set shellopts '-eu'
12
13# set internal field separator (IFS) to "\n" for shell commands
14# This is useful to automatically split file names in $fs and $fx properly
15# since default file separator used in these variables (i.e. 'filesep' option)
16# is newline. You need to consider the values of these options and create your
17# commands accordingly.
18set ifs "\n"
19
20# leave some space at the top and the bottom of the screen
21set scrolloff 10
22
23# use enter for shell commands
24map <enter> shell
25
26# show hidden files
27map . set hidden!
28
29# execute current file (must be executable)
30map x $$f
31map X !$f
32
33# dedicated keys for file opener actions
34map o &mimeopen $f
35map O $mimeopen --ask $f
36
37# define a custom 'open' command
38# This command is called when current file is not a directory. You may want to
39# use either file extensions and/or mime types here. Below uses an editor for
40# text files and a file opener for the rest.
41cmd open ${{
42 test -L $f && f=$(readlink -f $f)
43 case $(file --mime-type $f -b) in
44 text/*) $EDITOR $fx;;
45 *) for f in $fx; do setsid $OPENER $f > /dev/null 2> /dev/null & done;;
46 esac
47}}
48
49# define a custom 'rename' command without prompt for overwrite
50# cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1
51# map r push :rename<space>
52
53# make sure trash folder exists
54# %mkdir -p ~/.trash
55
56# move current file or selected files to trash folder
57# (also see 'man mv' for backup/overwrite options)
58cmd trash %set -f; mv $fx ~/.trash
59
60# define a custom 'delete' command
61# cmd delete ${{
62# set -f
63# printf "$fx\n"
64# printf "delete?[y/n]"
65# read ans
66# [ "$ans" = "y" ] && rm -rf $fx
67# }}
68
69# use '<delete>' key for either 'trash' or 'delete' command
70# map <delete> trash
71# map <delete> delete
72
73# extract the current file with the right command
74# (xkcd link: https://xkcd.com/1168/)
75cmd extract ${{
76 set -f
77 case $f in
78 *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;;
79 *.tar.gz|*.tgz) tar xzvf $f;;
80 *.tar.xz|*.txz) tar xJvf $f;;
81 *.zip) unzip $f;;
82 *.rar) unrar x $f;;
83 *.7z) 7z x $f;;
84 esac
85}}
86
87# compress current file or selected files with tar and gunzip
88cmd tar ${{
89 set -f
90 mkdir $1
91 cp -r $fx $1
92 tar czf $1.tar.gz $1
93 rm -rf $1
94}}
95
96# compress current file or selected files with zip
97cmd zip ${{
98 set -f
99 mkdir $1
100 cp -r $fx $1
101 zip -r $1.zip $1
102 rm -rf $1
103}}
diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim
index ff1a0c5..2d40555 100755
--- a/nvim/.config/nvim/init.vim
+++ b/nvim/.config/nvim/init.vim
@@ -1,6 +1,8 @@
1" vimplug 1" vimplug
2call plug#begin() 2call plug#begin()
3Plug 'neoclide/coc.nvim', {'branch': 'release'} 3Plug 'neoclide/coc.nvim', {'branch': 'release'}
4Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
5Plug 'junegunn/fzf.vim'
4Plug 'Shougo/deol.nvim' 6Plug 'Shougo/deol.nvim'
5Plug 'ap/vim-css-color' 7Plug 'ap/vim-css-color'
6Plug 'tpope/vim-eunuch' 8Plug 'tpope/vim-eunuch'