From 89fde95b1d211aba5902cd73e8650ffaf4f12520 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Wed, 4 Sep 2019 14:48:48 +0300 Subject: [PATCH 01/39] persistent folds --- vim/vimrc.vim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vim/vimrc.vim b/vim/vimrc.vim index 53559b651..d15ad9f13 100644 --- a/vim/vimrc.vim +++ b/vim/vimrc.vim @@ -96,3 +96,10 @@ " Fix for: https://github.com/fatih/vim-go/issues/1509 filetype plugin indent on + +" persistent folds +augroup AutoSaveFolds + autocmd! + autocmd BufWinLeave * mkview + autocmd BufWinEnter * silent loadview +augroup END From 2961c7da5bd73da9868f0802bad8710fe58080f1 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Wed, 4 Sep 2019 14:49:23 +0300 Subject: [PATCH 02/39] Update tmux.conf --- tmux/tmux.conf | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 85ddc1bfb..2cc79e823 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -6,6 +6,14 @@ set -g focus-events on set-option -g allow-rename off # Enable mouse mode (tmux 2.1 and above) +set -g mode-keys vi +bind-key -T copy-mode-vi 'v' send-keys -X begin-selection +# bind-key -T copy-mode-vi 'y' send-keys -X copy-selection +bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -sel clip -i' +# bind-key -T vi-copy y copy-pipe "xclip -selection clipoard -i" +# For binding 'Enter' to copy and not leave selection mode +bind-key -T copy-mode-vi Enter send-keys -X copy-pipe 'xclip -sel clip -i' '\;' send -X clear-selection + set -g mouse on # http://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/ @@ -15,7 +23,7 @@ set -g mouse on # panes set -g pane-border-style fg=black -set -g pane-active-border fg=brightred +# set -g pane-active-border fg=brightred ## Status bar design # status line From 943627cdfd8c2873fdfd526ecdea2a1aac205733 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Wed, 4 Sep 2019 14:49:57 +0300 Subject: [PATCH 03/39] Update tmux-keybindings.conf --- tmux/tmux-keybindings.conf | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tmux/tmux-keybindings.conf b/tmux/tmux-keybindings.conf index 72ff8db38..7d4cd93da 100644 --- a/tmux/tmux-keybindings.conf +++ b/tmux/tmux-keybindings.conf @@ -24,7 +24,6 @@ unbind [ bind Escape copy-mode unbind p bind p paste-buffer -bind-key -Tcopy-mode-vi 'v' send -X begin-selection -bind-key -Tcopy-mode-vi 'y' send -X copy-pipe "~/dotfiles/utils/copy" - -setw -g mode-keys vi +#bind-key -Tcopy-mode-vi 'v' send -X begin-selection +#bind-key -Tcopy-mode-vi 'y' send -X copy-pipe "~/dotfiles/utils/copy" +#setw -g mode-keys vi From 5350ea4878a50e329b44acac2a06649707946068 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Wed, 4 Sep 2019 14:50:42 +0300 Subject: [PATCH 04/39] Update vimrc.vim --- vim/vimrc.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/vimrc.vim b/vim/vimrc.vim index d15ad9f13..5019e7f42 100644 --- a/vim/vimrc.vim +++ b/vim/vimrc.vim @@ -44,7 +44,7 @@ " Language Specific " Tabs - so ~/dotfiles/vim/sleuth.vim + source ~/dotfiles/vim/sleuth.vim " Typescript autocmd BufNewFile,BufRead *.ts set syntax=javascript From 5ceb40128dd4dafe575c660779e89454511fb4d6 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Mon, 28 Oct 2019 14:59:25 +0200 Subject: [PATCH 05/39] Update tmux.conf --- tmux/tmux.conf | 60 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 13 deletions(-) diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 2cc79e823..600aff6ab 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -1,19 +1,47 @@ +# source-file ~/dotfiles/tmux/tmux-keybindings.conf +# Prefix +unbind C-b +set -g prefix ` +bind ` send-prefix + +set -g history-limit 50000 + +# New window +unbind '"' +unbind % +bind | split-window -h -c "#{pane_current_path}" +bind - split-window -v -c "#{pane_current_path}" +bind c new-window -c "#{pane_current_path}" +set mode-style "fg=black,bg=white" + +# Easy Config Reloads +unbind r +bind r source-file ~/.tmux.conf; display-message "tmux.conf reloaded" + +# Direction +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + set -g default-terminal "screen-256color" -source-file ~/dotfiles/tmux/tmux-keybindings.conf set -g focus-events on -# don't rename windows automatically -set-option -g allow-rename off - -# Enable mouse mode (tmux 2.1 and above) +# Vim selection: +unbind [ +bind Escape copy-mode +unbind p +bind p paste-buffer +bind -n C-l send-keys C-l \; run 'sleep 0.1' \; clear set -g mode-keys vi bind-key -T copy-mode-vi 'v' send-keys -X begin-selection -# bind-key -T copy-mode-vi 'y' send-keys -X copy-selection bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -sel clip -i' -# bind-key -T vi-copy y copy-pipe "xclip -selection clipoard -i" -# For binding 'Enter' to copy and not leave selection mode +# binding 'Enter' to copy and not leave selection mode bind-key -T copy-mode-vi Enter send-keys -X copy-pipe 'xclip -sel clip -i' '\;' send -X clear-selection +# don't rename windows automatically +set-option -g allow-rename off + set -g mouse on # http://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/ @@ -39,6 +67,10 @@ set -g message-style bg=yellow set -g message-command-style fg=blue set -g message-command-style bg=black +# Use shift + arrow key to move between windows in a session +bind -n S-Left previous-window +bind -n S-Right next-window + #window mode setw -g mode-style bg=colour6 setw -g mode-style fg=colour0 @@ -79,17 +111,19 @@ setw -g mode-style bg=colour238 set -g pane-border-style bg=colour235 set -g pane-border-style fg=colour238 set -g pane-active-border-style bg=colour236 -set -g pane-active-border-style fg=colour51 +set -g pane-active-border-style fg=colour7 # } # The statusbar { -set -g status-position bottom -set -g status-style bg=colour234 -set -g status-style fg=colour137 +#set -g status-position bottom +#set -g status-style bg=colour234 +#set -g status-style fg=colour137 set -g status-style dim set -g status-left '' -set -g status-right '#[fg=colour233,bg=colour245,bold] %A %-I:%M #[fg=colour255,bg=colour000] #(whoami)@#H' +set -g status-right '#(iwgetid -r) #[fg=colour7] %b %d %H:%M #[fg=colour4] #(upower -i /org/freedesktop/UPower/devices/DisplayDevice | grep percentage | cut -d" " -f15)' + + set -g status-right-length 50 set -g status-left-length 20 From 756e04aaec05fdb24fea7ae0539b45e910e79d4d Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Tue, 5 Nov 2019 16:44:46 +0200 Subject: [PATCH 06/39] terminal opacity --- tmux/tmux.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 600aff6ab..6cacab4fa 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -149,3 +149,5 @@ set -g message-style fg=colour232 set -g message-style bg=colour166 # } + +bind t command-prompt -p "Enter Opacity %" "run \"xprop -id $(xprop -root _NET_ACTIVE_WINDOW | cut -d ' ' -f 5) -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY $(printf 0x%x $((0xffffffff * %% / 100)))\"" From 91ca6f06258675669b68f655d3a87d8f193fb28f Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Tue, 5 Nov 2019 17:01:40 +0200 Subject: [PATCH 07/39] Delete tmux-keybindings.conf --- tmux/tmux-keybindings.conf | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 tmux/tmux-keybindings.conf diff --git a/tmux/tmux-keybindings.conf b/tmux/tmux-keybindings.conf deleted file mode 100644 index 7d4cd93da..000000000 --- a/tmux/tmux-keybindings.conf +++ /dev/null @@ -1,29 +0,0 @@ -# Prefix -unbind C-b -set -g prefix ` -bind ` send-prefix - -# New window -unbind '"' -unbind % -bind '"' split-window -c "#{pane_current_path}" -bind v split-window -h -c "#{pane_current_path}" -bind c new-window -c "#{pane_current_path}" - -# Easy Config Reloads -bind r source-file ~/.tmux.conf - -# Direction -bind h select-pane -L -bind j select-pane -D -bind k select-pane -U -bind l select-pane -R - -# Vim selection: -unbind [ -bind Escape copy-mode -unbind p -bind p paste-buffer -#bind-key -Tcopy-mode-vi 'v' send -X begin-selection -#bind-key -Tcopy-mode-vi 'y' send -X copy-pipe "~/dotfiles/utils/copy" -#setw -g mode-keys vi From 70aa6a22b39d40d33851596a32dbe79dfb66e9db Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Tue, 5 Nov 2019 17:03:49 +0200 Subject: [PATCH 08/39] terminal opacity prompt --- tmux/tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 6cacab4fa..e9d224522 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -1,4 +1,3 @@ -# source-file ~/dotfiles/tmux/tmux-keybindings.conf # Prefix unbind C-b set -g prefix ` @@ -150,4 +149,5 @@ set -g message-style bg=colour166 # } +# prompt for terminal opacity percentage, 100 = not transparent bind t command-prompt -p "Enter Opacity %" "run \"xprop -id $(xprop -root _NET_ACTIVE_WINDOW | cut -d ' ' -f 5) -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY $(printf 0x%x $((0xffffffff * %% / 100)))\"" From ab36c982c1d5dfccd5b77f7c934c2f1df4334f47 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Wed, 6 Nov 2019 15:20:53 +0200 Subject: [PATCH 09/39] Rename deploy to deploy.sh --- deploy => deploy.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename deploy => deploy.sh (100%) diff --git a/deploy b/deploy.sh similarity index 100% rename from deploy rename to deploy.sh From c23731b3b2fd9e6f858a69750219bb915bc9789e Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Wed, 6 Nov 2019 15:22:43 +0200 Subject: [PATCH 10/39] add fzf --- deploy.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deploy.sh b/deploy.sh index 13e48d429..3c70998ed 100755 --- a/deploy.sh +++ b/deploy.sh @@ -97,5 +97,8 @@ printf "source '$HOME/dotfiles/zsh/zshrc_manager.sh'" > ~/.zshrc printf "so $HOME/dotfiles/vim/vimrc.vim" > ~/.vimrc printf "source-file $HOME/dotfiles/tmux/tmux.conf" > ~/.tmux.conf +git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf +~/.fzf/install + echo echo "Please log out and log back in for default shell to be initialized." From d88a7962e73719e7dfd608f35dbcc3d66cea5c94 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Wed, 6 Nov 2019 15:26:06 +0200 Subject: [PATCH 11/39] fzf browser history --- deploy.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/deploy.sh b/deploy.sh index 3c70998ed..82898351d 100755 --- a/deploy.sh +++ b/deploy.sh @@ -99,6 +99,27 @@ printf "source-file $HOME/dotfiles/tmux/tmux.conf" > ~/.tmux.conf git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf ~/.fzf/install +# TODO add to .bashrc fzf related snippets +c() { + local cols sep google_history open + cols=$(( COLUMNS / 3 )) + sep='{::}' + + if [ "$(uname)" = "Darwin" ]; then + google_history="$HOME/Library/Application Support/Google/Chrome/Default/History" + open=open + else + google_history="$HOME/.config/google-chrome/Default/History" + open=xdg-open + fi + cp -f "$google_history" /tmp/h + sqlite3 -separator $sep /tmp/h \ + "select substr(title, 1, $cols), url + from urls order by last_visit_time desc" | + awk -F $sep '{printf "%-'$cols's \x1b[36m%s\x1b[m\n", $1, $2}' | + fzf --ansi --multi | sed 's#.*\(https*://\)#\1#' | xargs $open > /dev/null 2> /dev/null +} + echo echo "Please log out and log back in for default shell to be initialized." From e8488feb87a6456e6cd204fbb440166f8c532076 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Fri, 8 Nov 2019 22:56:51 +0200 Subject: [PATCH 12/39] man page split view --- vim/vimrc.vim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/vim/vimrc.vim b/vim/vimrc.vim index 5019e7f42..a002d3606 100644 --- a/vim/vimrc.vim +++ b/vim/vimrc.vim @@ -103,3 +103,19 @@ augroup AutoSaveFolds autocmd BufWinLeave * mkview autocmd BufWinEnter * silent loadview augroup END + +" Opens man page in split window, "ZQ" to close +fun! ReadMan() + " Assign current word under cursor to a script variable: + let s:man_word = expand('') + " Open a new window: + :exe ":wincmd n" + " Read in the manpage for man_word (col -b is for formatting): + :exe ":r!man " . s:man_word . " | col -b" + " Goto first line... + :exe ":goto" + " and delete it: + :exe ":delete" +endfun +" Map the K key to the ReadMan function: +map K :call ReadMan() From b78fb48993b0878504d6502a79556f79cba3b71e Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Mon, 18 Nov 2019 10:16:39 -0500 Subject: [PATCH 13/39] Update vimrc.vim --- vim/vimrc.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vim/vimrc.vim b/vim/vimrc.vim index a002d3606..2f981b277 100644 --- a/vim/vimrc.vim +++ b/vim/vimrc.vim @@ -2,8 +2,8 @@ syntax on let mapleader="," set autoindent - set tabstop=4 - set shiftwidth=4 + set tabstop=2 + set shiftwidth=2 set dir=/tmp/ set relativenumber set number @@ -11,7 +11,7 @@ autocmd Filetype html setlocal sw=2 expandtab autocmd Filetype javascript setlocal sw=4 expandtab - set cursorline + inoremap jk hi Cursor ctermfg=White ctermbg=Yellow cterm=bold guifg=white guibg=yellow gui=bold set hlsearch From 0ad27baad7114daac5221f8cbf5aeae6dce1bf40 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Mon, 18 Nov 2019 10:19:51 -0500 Subject: [PATCH 14/39] Update deploy.sh --- deploy.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deploy.sh b/deploy.sh index 82898351d..b763a9610 100755 --- a/deploy.sh +++ b/deploy.sh @@ -76,6 +76,10 @@ check_for_software vim echo check_for_software tmux echo +check_for_software git +echo +check_for_software xclip +echo check_default_shell From 95d1092a748f4b62894a8ca7a8007cf90bc6c6af Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Mon, 18 Nov 2019 10:21:32 -0500 Subject: [PATCH 15/39] Delete copy --- utils/copy | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100755 utils/copy diff --git a/utils/copy b/utils/copy deleted file mode 100755 index dfdf61fa2..000000000 --- a/utils/copy +++ /dev/null @@ -1,14 +0,0 @@ -if [[ $OSTYPE == darwin* ]]; then - pbcopy -elif [[ $OSTYPE == cygwin* ]]; then - cat > /dev/clipboard -else - if (( $+commands[xclip] )); then - xclip -in -selection clipboard - elif (( $+commands[xsel] )); then - xsel --clipboard --input - else - print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 - return 1 - fi -fi From 53f26c774070f971d7c0531e535c2a7d0958e2f3 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Mon, 18 Nov 2019 10:27:37 -0500 Subject: [PATCH 16/39] Update tmux.conf --- tmux/tmux.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tmux/tmux.conf b/tmux/tmux.conf index e9d224522..339bd0d59 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -11,11 +11,11 @@ unbind % bind | split-window -h -c "#{pane_current_path}" bind - split-window -v -c "#{pane_current_path}" bind c new-window -c "#{pane_current_path}" -set mode-style "fg=black,bg=white" +set -g mode-style "fg=black,bg=white" # Easy Config Reloads unbind r -bind r source-file ~/.tmux.conf; display-message "tmux.conf reloaded" +bind r source-file ~/.tmux.conf\; display-message "tmux.conf reloaded" # Direction bind h select-pane -L From 6ba9e8bb6a0b17d3c5203d0ec96387804fe946ad Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Mon, 18 Nov 2019 10:29:50 -0500 Subject: [PATCH 17/39] Delete README.md --- README.md | 95 ------------------------------------------------------- 1 file changed, 95 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index 7f08c298f..000000000 --- a/README.md +++ /dev/null @@ -1,95 +0,0 @@ -# Awesome Dotfiles - -Simple, but extensive customization of ZSH, TMUX, and Vim. - -[![VideoWalkthrough](https://img.youtube.com/vi/UgDz_9i2nwc/0.jpg)](https://www.youtube.com/watch?v=UgDz_9i2nwc) - -## Setup Options - -There's 3 ways in which you can use this, depending on how much you think you'll be customizing. - -One of the key features is that this implementation stays in sync across all your machines. So depending on how much you'd like to customize your configuration, you have a few options: - -* Little Customization: Just clone this repo and jump to [Installation](#installation). -* Mild Customization: [Fork]() this repo, and clone your own fork. Keep an eye on this repo for bugfixes and other improvements that you'd like to incorporate into your fork. Then jump to [Installation](#installation). -* Most Customization: Building your own dotfiles from scratch! Read through these docs, watch the video above, star this repo, and create your own dotfiles! You can add this repository as a [git module](https://git-scm.com/book/en/v2/Git-Tools-Submodules) and source the parts you like. - -If you're unsure, just read the docs, watch the video, clone this repository, and jump to [Installation](#installation). - -## Installation - -Once the repo is cloned, execute the deploy script: -``` -./deploy -``` - -This script guides you through the following: - -1. Checks to see if you have zsh, tmux, and vim installed. -2. Installs them using your default package manager if you don't have some of them installed. -3. Checks to see if your default shell is zsh. -4. Sets zsh to your default shell. -5. Backs up your old configuration files. - -Pretty convenient for configuring new servers. - -# Summary of Changes - -## Basic runtime opperations - -All default dotfiles (`.zshrc`, `.vimrc`, etc) source something within the dotfiles repository. This helps separate changes that are synced across all your machines with system specific changes. - -Upon launching a new shell, the first thing that's evaulated is `zshrc_manager.sh`. This script first launches tmux. Then once zsh logs in, within tmux, it updates the dotfiles repository, and sources the changes. - -## [Zsh](https://en.wikipedia.org/wiki/Z_shell) - -* `cd` has been reassigned to `cd` and `ls`. Every time you navigate to a new directory, it will display the content of that directory. -* `v` has been aliased too: `vim -p`. This let's you open multiple files in vim as tabs. - -### Prompt - -The prompt takes on the form: - -``` -[plugin, plugin, ...]: -``` - -Each plugin is sensitive to where you are and what you're doing, they reveal themselves when it's contextually relevant. Plugins include: - -* `PWD plugin`: always present, tells you where you are. Always the first plugin. -* `Status code plugin`: appears anytime a program returns with a non-zero status code. Tells you what status code the program completed with. -* `Git plugin`: appears when you're in a git repository. Tells you what branch you're on, and how many files have been changed since the last commit. -* `Sudo plugin`: tells you when you can sudo without a password. Or when you're logged in as root. -* `Time plugin`: appears when a program took more than 1s to execute. Tells you how long it took to execute. -* `PID plugin`: appears when you background a task. Tells you what the PID of the task is. - -### Keybindings -| Key Stroke | What It Does | -|------------|--------------| -| Ctrl-H | Runs ``cd ~/`` | -| Ctrl-K | Runs ``cd ..`` | -| Ctrl-G | Runs ``git add -A; git commit -v && git push`` | -| Ctrl-V | Runs ``fc``. Takes last command and puts it in a vim buffer. | -| Ctrl-S | Adds ``sudo`` to the beginning of the buffer. | -| Ctrl-L | Runs ``ls``. | -| Ctrl-O | Equivalent to hitting ``Enter``. | -| Ctrl-P | Equivalent to pressing ``Up Arrow``. | - -### Plugins - -* [zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions): Searches your history while you type and provides suggestions. -* [zsh-syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting/tree/ad522a091429ba180c930f84b2a023b40de4dbcc): Provides fish style syntax highlighting for zsh. -* [ohmyzsh](https://github.com/robbyrussell/oh-my-zsh/tree/291e96dcd034750fbe7473482508c08833b168e3): Borrowed things like tab completion, fixing ls, tmux's vi-mode plugin. -* [vimode-zsh](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/vi-mode) allows you to hit `esc` and navigate the current buffer using vim movement keys. - -## [Vim](https://en.wikipedia.org/wiki/Vim_(text_editor)) - -* Leader key has ben remapped to `,` - -## [Tmux](https://en.wikipedia.org/wiki/Tmux) - -* Ctrl-B has been remapped to the backtick character (`). If you want to type the actual backtick character (`) itself, just hit the key twice. -* `%` has been remapped to `v`. -* Use vim movement keys for moving between panes. -* Copy buffer is coppied to xclip. -* Status bar tells you date, time, user, and hostname. Especially useful with nested ssh sessions. From 6f2e84eacd25685ede624d6353e9242c213e051b Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Mon, 18 Nov 2019 10:33:17 -0500 Subject: [PATCH 18/39] Update deploy.sh --- deploy.sh | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index b763a9610..acfcff961 100755 --- a/deploy.sh +++ b/deploy.sh @@ -103,7 +103,9 @@ printf "source-file $HOME/dotfiles/tmux/tmux.conf" > ~/.tmux.conf git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf ~/.fzf/install -# TODO add to .bashrc fzf related snippets + +########################################### +# TODO add to .bashrc c() { local cols sep google_history open cols=$(( COLUMNS / 3 )) @@ -125,5 +127,30 @@ c() { } +man-find() { + f=$(fd . $MANPATH/man${1:-1} -t f -x echo {/.} | fzf) && man $f +} +fman() { + man -k . | fzf --prompt='Man> ' | awk '{print $1}' | xargs -r man +} + +export PS1="\t \w\[$(tput sgr0)\]\$ " + +[ -f ~/.fzf.bash ] && source ~/.fzf.bash + +export VISUAL=vim +export EDITOR="$VISUAL" + +alias ll='ls -alF' + +shopt -s checkwinsize + +alias rand_console='tr -cd "[:alnum:]" < /dev/urandom | fold -w`tput cols`' + +########################################### + + +# TODO download mitmproxy + echo echo "Please log out and log back in for default shell to be initialized." From 47a7a5ab1640c3253444e9c75df44b86022c59a4 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Mon, 18 Nov 2019 10:34:02 -0500 Subject: [PATCH 19/39] Update deploy.sh --- deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index acfcff961..eacad5269 100755 --- a/deploy.sh +++ b/deploy.sh @@ -150,7 +150,7 @@ alias rand_console='tr -cd "[:alnum:]" < /dev/urandom | fold -w`tput cols`' ########################################### -# TODO download mitmproxy +# TODO download mitmproxy, chrome.. JEB & IDA, apktools, docker.. echo echo "Please log out and log back in for default shell to be initialized." From d37c4931c5ec4038cf4fe905da2fca745fb39135 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Tue, 19 Nov 2019 12:14:31 +0200 Subject: [PATCH 20/39] add deps --- deploy.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/deploy.sh b/deploy.sh index eacad5269..f6da1b381 100755 --- a/deploy.sh +++ b/deploy.sh @@ -79,6 +79,7 @@ echo check_for_software git echo check_for_software xclip +# TODO apt install cmake gcc libssl-dev libwebsockets-dev pkg-config echo check_default_shell From 6b1d881852ce9135fc35c134180912b7538fbf7b Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Thu, 21 Nov 2019 17:40:51 +0200 Subject: [PATCH 21/39] Update vimrc.vim --- vim/vimrc.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/vim/vimrc.vim b/vim/vimrc.vim index 2f981b277..de7cc5dfb 100644 --- a/vim/vimrc.vim +++ b/vim/vimrc.vim @@ -7,6 +7,7 @@ set dir=/tmp/ set relativenumber set number + set clipboard=unnamedplus autocmd Filetype html setlocal sw=2 expandtab autocmd Filetype javascript setlocal sw=4 expandtab From 8d8c870ec862e8318d7875ec4826f7b5ae5ad085 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Thu, 21 Nov 2019 17:41:13 +0200 Subject: [PATCH 22/39] Update vimrc.vim --- vim/vimrc.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/vimrc.vim b/vim/vimrc.vim index de7cc5dfb..8ebd8f4ed 100644 --- a/vim/vimrc.vim +++ b/vim/vimrc.vim @@ -7,7 +7,7 @@ set dir=/tmp/ set relativenumber set number - set clipboard=unnamedplus + set clipboard=unnamedplus autocmd Filetype html setlocal sw=2 expandtab autocmd Filetype javascript setlocal sw=4 expandtab From 3c88e709989e19efd1907009f1bc072c5aaaab6a Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Thu, 21 Nov 2019 17:42:12 +0200 Subject: [PATCH 23/39] add vim with +xterm_clipboard --- deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index f6da1b381..a546866f4 100755 --- a/deploy.sh +++ b/deploy.sh @@ -79,7 +79,7 @@ echo check_for_software git echo check_for_software xclip -# TODO apt install cmake gcc libssl-dev libwebsockets-dev pkg-config +# TODO apt install vim-gnome cmake gcc libssl-dev libwebsockets-dev pkg-config echo check_default_shell From e7458083d71b3ba36ac56f1d754c871b23fde1b8 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Tue, 17 Dec 2019 12:21:55 +0200 Subject: [PATCH 24/39] netrw configuration --- vim/vimrc.vim | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/vim/vimrc.vim b/vim/vimrc.vim index 8ebd8f4ed..12186cbfc 100644 --- a/vim/vimrc.vim +++ b/vim/vimrc.vim @@ -120,3 +120,40 @@ fun! ReadMan() endfun " Map the K key to the ReadMan function: map K :call ReadMan() + +autocmd BufNewFile,BufRead *.json set ft=javascript +autocmd BufNewFile,BufRead *.jsonc set ft=javascript + +"########################################################### +"# Autocorrect Dictionary # +"########################################################### +abbr ture true +abbr flase false + +"########################################################### +"# Set Default Search highlighting ON (Off commented out) # +"########################################################### +:set hlsearch +:set incsearch + +"Map F6 to toggle on and off the baner +nmap I + +"# to change the way netrw shows the files and directorys +"let g:netrw_liststyle= 0 " Default view (directory name/file name) +"let g:netrw_liststyle= 1 " Show time and size +"let g:netrw_liststyle= 2 " Shows listing in 2 columns +let g:netrw_liststyle= 3 " show the tree listing + +"# Set the split windows to always be equal and open splits to the right +let g:netrw_winsize = 0 " set default window size to be always equal +let g:netrw_preview = 1 " open splits to the right + +" Per default, netrw leaves unmodified buffers open. This autocommand +" deletes netrw's buffer once it's hidden (using ':q;, for example) +autocmd FileType netrw setl bufhidden=delete " or use :qa! + +"These next three lines are for the fuzzy search: +set nocompatible "Limit search to your project +set path+=** "Search all subdirectories and recursively +set wildmenu "Shows multiple matches on one line From b5939ada1f76d2bdaf546bf49e38ba8ee72d1089 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Tue, 7 Apr 2020 11:24:23 +0300 Subject: [PATCH 25/39] vimrc search highlight change --- vim/vimrc.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/vim/vimrc.vim b/vim/vimrc.vim index 12186cbfc..599433152 100644 --- a/vim/vimrc.vim +++ b/vim/vimrc.vim @@ -14,6 +14,7 @@ inoremap jk hi Cursor ctermfg=White ctermbg=Yellow cterm=bold guifg=white guibg=yellow gui=bold + hi Search cterm=NONE ctermfg=yellow ctermbg=NONE set hlsearch nnoremap :nohl:echo "Search Cleared" From 4ed5c74a9f32e7926125066ed162617715258c56 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Mon, 18 May 2020 13:44:22 +0300 Subject: [PATCH 26/39] add vimdiff colorscheme --- vim/vimrc.vim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vim/vimrc.vim b/vim/vimrc.vim index 599433152..bbe91d9db 100644 --- a/vim/vimrc.vim +++ b/vim/vimrc.vim @@ -158,3 +158,11 @@ autocmd FileType netrw setl bufhidden=delete " or use :qa! set nocompatible "Limit search to your project set path+=** "Search all subdirectories and recursively set wildmenu "Shows multiple matches on one line + + +" curl -fLo ~/.vim/colors/molokai.vim --create-dirs https://raw.githubusercontent.com/tomasr/molokai/master/colors/molokai.vim +" curl -fLo ~/.vim/colors/github.vim --create-dirs https://raw.githubusercontent.com/endel/vim-github-colorscheme/master/colors/github.vim +if &diff +" colorscheme github + colorscheme molokai +endif From d5b1e4dd4d2c7574e865ab79eebcc1d411972f50 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Mon, 22 Jun 2020 17:08:21 +0300 Subject: [PATCH 27/39] Create bashrc.sh --- bashrc.sh | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 bashrc.sh diff --git a/bashrc.sh b/bashrc.sh new file mode 100644 index 000000000..20a89bc5f --- /dev/null +++ b/bashrc.sh @@ -0,0 +1,56 @@ +export VISUAL=vim +export EDITOR="$VISUAL" + +shopt -s checkwinsize + +alias rand_console='tr -cd "[:alnum:]" < /dev/urandom | fold -w`tput cols`' + +c() { + local cols sep google_history open + cols=$(( COLUMNS / 3 )) + sep='{::}' + + if [ "$(uname)" = "Darwin" ]; then + google_history="$HOME/Library/Application Support/Google/Chrome/Default/History" + open=open + else + google_history="$HOME/.config/google-chrome/Default/History" + open=xdg-open + fi + cp -f "$google_history" /tmp/h + sqlite3 -separator $sep /tmp/h \ + "select substr(title, 1, $cols), url + from urls order by last_visit_time desc" | + awk -F $sep '{printf "%-'$cols's \x1b[36m%s\x1b[m\n", $1, $2}' | + fzf --ansi --multi | sed 's#.*\(https*://\)#\1#' | xargs $open > /dev/null 2> /dev/null +} + +man-find() { + f=$(fd . $MANPATH/man${1:-1} -t f -x echo {/.} | fzf) && man $f +} +fman() { + man -k . | fzf --prompt='Man> ' | awk '{print $1}' | xargs -r man +} + + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# Add an "alert" alias for long running commands. Use like so: +# sleep 10; alert +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' + + + From 8dc8f4040702ea7db360b47825e2a65aa4d864b9 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Sun, 28 Jun 2020 12:52:49 +0300 Subject: [PATCH 28/39] search word under cursor and open QuickFix --- vim/vimrc.vim | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/vim/vimrc.vim b/vim/vimrc.vim index bbe91d9db..a96d8c6f1 100644 --- a/vim/vimrc.vim +++ b/vim/vimrc.vim @@ -100,11 +100,11 @@ filetype plugin indent on " persistent folds -augroup AutoSaveFolds - autocmd! - autocmd BufWinLeave * mkview - autocmd BufWinEnter * silent loadview -augroup END +" augroup AutoSaveFolds +" autocmd! +" autocmd BufWinLeave * mkview +" autocmd BufWinEnter * silent loadview +" augroup END " Opens man page in split window, "ZQ" to close fun! ReadMan() @@ -166,3 +166,5 @@ if &diff " colorscheme github colorscheme molokai endif + +nnoremap :vim // % \| !:copen From 296f82427190672710925201d5969cce34c6656e Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Mon, 20 Jul 2020 17:27:48 +0300 Subject: [PATCH 29/39] Create hotkeys.py --- misc/ida/hotkeys.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 misc/ida/hotkeys.py diff --git a/misc/ida/hotkeys.py b/misc/ida/hotkeys.py new file mode 100644 index 000000000..ab73a8c5a --- /dev/null +++ b/misc/ida/hotkeys.py @@ -0,0 +1,15 @@ +import webbrowser +import ida_kernwin as kw + + +def google_highlighted(): + """gets textual representation of currently selected identifier + from any current IDA view, opens a new browser tab and googles for it + cerdit: https://github.com/patois + """ + + r = kw.get_highlight(kw.get_current_viewer()) + if r: + webbrowser.open("https://google.com/search?q=%s" % r[0],new=2) + +kw.add_hotkey("Ctrl-Shift-F", google_highlighted) From 872c1a8cc5bb95959bb707c97d5c0b03df5305f5 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Thu, 3 Sep 2020 15:47:14 +0300 Subject: [PATCH 30/39] add vim smali syntax --- bashrc.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bashrc.sh b/bashrc.sh index 20a89bc5f..8ac5ba417 100644 --- a/bashrc.sh +++ b/bashrc.sh @@ -53,4 +53,8 @@ shopt -s checkwinsize alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' +# vim smali syntax +echo au BufRead,BufNewFile *.smali set filetype=smali >> ~/.vim/filetype.vim + && mkdir ~/.vim/syntax && cd $_ && wget http://codetastrophe.com/smali.vim + From 3b7db0a8c1f66d68ec216ea8fa596b6de5af482c Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Sun, 1 Nov 2020 22:25:44 +0200 Subject: [PATCH 31/39] add language & wifi to status bar --- tmux/tmux.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 339bd0d59..cb7d1993a 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -88,6 +88,7 @@ setw -g window-status-style reverse # Info on left (I don't have a session display for now) set -g status-left '' +set -g status-right '#(iwgetid -r) #[fg=colour7] %b %d %H:%M #[fg=colour9]#{?#(xset -q | grep LED | cut -c63),בע,En} #[fg=colour11] #(upower -i /org/freedesktop/UPower/devices/DisplayDevice | grep percentage | cut -d" " -f15)' # loud or quiet? set-option -g visual-activity off From 6aedaf599e09717f1ab6de67266d5d6c237f2f02 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Mon, 2 Nov 2020 14:12:05 +0200 Subject: [PATCH 32/39] google search & translate shortcuts --- tmux/tmux.conf | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tmux/tmux.conf b/tmux/tmux.conf index cb7d1993a..487d40fe6 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -88,7 +88,6 @@ setw -g window-status-style reverse # Info on left (I don't have a session display for now) set -g status-left '' -set -g status-right '#(iwgetid -r) #[fg=colour7] %b %d %H:%M #[fg=colour9]#{?#(xset -q | grep LED | cut -c63),בע,En} #[fg=colour11] #(upower -i /org/freedesktop/UPower/devices/DisplayDevice | grep percentage | cut -d" " -f15)' # loud or quiet? set-option -g visual-activity off @@ -121,7 +120,7 @@ set -g pane-active-border-style fg=colour7 #set -g status-style fg=colour137 set -g status-style dim set -g status-left '' -set -g status-right '#(iwgetid -r) #[fg=colour7] %b %d %H:%M #[fg=colour4] #(upower -i /org/freedesktop/UPower/devices/DisplayDevice | grep percentage | cut -d" " -f15)' +set -g status-right '#(iwgetid -r) #[fg=colour7]%a %-d%b%H:%M #[fg=colour9]#{?#(xset -q | grep LED | cut -c63),בע,En} #[fg=colour11]#(upower -i /org/freedesktop/UPower/devices/DisplayDevice | grep percentage | cut -d" " -f15)' set -g status-right-length 50 @@ -152,3 +151,21 @@ set -g message-style bg=colour166 # prompt for terminal opacity percentage, 100 = not transparent bind t command-prompt -p "Enter Opacity %" "run \"xprop -id $(xprop -root _NET_ACTIVE_WINDOW | cut -d ' ' -f 5) -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY $(printf 0x%x $((0xffffffff * %% / 100)))\"" +# google search & translate +bind g command-prompt -p "Google > " "run \"google-chrome '? %%' \"" +bind T command-prompt -p "Google > " "run \"google-chrome 'https://translate.google.com/?q=%%&lang=he' \"" + + +# List of plugins +# run-shell ~/dotfiles/tmux/tmux-fingers/tmux-fingers.tmux +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'tmux-plugins/tmux-resurrect' +set -g @plugin 'tmux-plugins/tmux-continuum' +set -g @continuum-restore 'on' +# set -g @plugin 'fcsonline/tmux-thumbs' +set -g @plugin 'Morantron/tmux-fingers' + + +# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) +run -b '~/.tmux/plugins/tpm/tpm' From b7351cae9f13a223368cfe737562a9a630159ad0 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Sun, 31 Jan 2021 16:13:41 +0200 Subject: [PATCH 33/39] switch proxy, disable terminal pause --- bashrc.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bashrc.sh b/bashrc.sh index 8ac5ba417..27ac833a2 100644 --- a/bashrc.sh +++ b/bashrc.sh @@ -5,6 +5,7 @@ shopt -s checkwinsize alias rand_console='tr -cd "[:alnum:]" < /dev/urandom | fold -w`tput cols`' +# fuzzy search in chrome history c() { local cols sep google_history open cols=$(( COLUMNS / 3 )) @@ -32,7 +33,6 @@ fman() { man -k . | fzf --prompt='Man> ' | awk '{print $1}' | xargs -r man } - # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options HISTCONTROL=ignoreboth @@ -52,9 +52,12 @@ shopt -s checkwinsize # sleep 10; alert alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' - # vim smali syntax echo au BufRead,BufNewFile *.smali set filetype=smali >> ~/.vim/filetype.vim && mkdir ~/.vim/syntax && cd $_ && wget http://codetastrophe.com/smali.vim +alias switch_proxy='sudo systemctl reload tor.service && curl -s -x socks5h://localhost:9050 ifconfig.me && echo' + +# Disable Ctrl+S (Pause) and Ctrl+Q (continue) shortcuts, I use Ctrl+S to save inside Vim +stty -ixon From 6b9ed2bf02d9e1600210f3d7bc701e53ecf5b983 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Sun, 31 Jan 2021 16:16:20 +0200 Subject: [PATCH 34/39] Update vimrc.vim --- vim/vimrc.vim | 421 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 275 insertions(+), 146 deletions(-) diff --git a/vim/vimrc.vim b/vim/vimrc.vim index a96d8c6f1..d4f0a6273 100644 --- a/vim/vimrc.vim +++ b/vim/vimrc.vim @@ -1,110 +1,248 @@ -" General Vim settings - syntax on - let mapleader="," - set autoindent - set tabstop=2 - set shiftwidth=2 - set dir=/tmp/ - set relativenumber - set number - set clipboard=unnamedplus - - autocmd Filetype html setlocal sw=2 expandtab - autocmd Filetype javascript setlocal sw=4 expandtab - - inoremap jk - hi Cursor ctermfg=White ctermbg=Yellow cterm=bold guifg=white guibg=yellow gui=bold - hi Search cterm=NONE ctermfg=yellow ctermbg=NONE - - set hlsearch - nnoremap :nohl:echo "Search Cleared" - nnoremap :set norelativenumber:set nonumber:echo "Line numbers turned off." - nnoremap :set relativenumber:set number:echo "Line numbers turned on." - - nnoremap n nzzzv - nnoremap N Nzzzv - - nnoremap H 0 - nnoremap L $ - nnoremap J G - nnoremap K gg - - map % - - set backspace=indent,eol,start - - nnoremap za - nnoremap z zMzvzz - - nnoremap vv 0v$ - - set listchars=tab:\|\ - nnoremap :set list! - set pastetoggle= - set mouse=a - set incsearch - -" Language Specific - " Tabs - source ~/dotfiles/vim/sleuth.vim - - " Typescript - autocmd BufNewFile,BufRead *.ts set syntax=javascript - autocmd BufNewFile,BufRead *.tsx set syntax=javascript - - " Markup - inoremap < I<A>yypa/O - - -" File and Window Management - inoremap w :w - nnoremap w :w - - inoremap q :q - nnoremap q :q - - inoremap x :x - nnoremap x :x - - nnoremap e :Ex - nnoremap t :tabnew:Ex - nnoremap v :vsplit:w:Ex - nnoremap s :split:w:Ex - -" Return to the same line you left off at - augroup line_return - au! - au BufReadPost * - \ if line("'\"") > 0 && line("'\"") <= line("$") | - \ execute 'normal! g`"zvzz' | - \ endif - augroup END - -" Auto load - " Triger `autoread` when files changes on disk - " https://unix.stackexchange.com/questions/149209/refresh-changed-content-of-file-opened-in-vim/383044#383044 - " https://vi.stackexchange.com/questions/13692/prevent-focusgained-autocmd-running-in-command-line-editing-mode - autocmd FocusGained,BufEnter,CursorHold,CursorHoldI * if mode() != 'c' | checktime | endif - set autoread - " Notification after file change - " https://vi.stackexchange.com/questions/13091/autocmd-event-for-autoread - autocmd FileChangedShellPost * - \ echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None - -" Future stuff - "Swap line - "Insert blank below and above - -" Fix for: https://github.com/fatih/vim-go/issues/1509 +" plugins +let need_to_install_plugins = 0 +if empty(glob('~/.vim/autoload/plug.vim')) + silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + let need_to_install_plugins = 1 +endif + +call plug#begin() +Plug 'tpope/vim-sensible' +" Plug 'itchyny/lightline.vim' +Plug 'joshdick/onedark.vim' +Plug 'albertorestifo/github.vim' +Plug 'ap/vim-buftabline' +Plug 'airblade/vim-gitgutter' +Plug 'preservim/nerdtree' +Plug 'jistr/vim-nerdtree-tabs' +Plug 'Xuyuanp/nerdtree-git-plugin' +Plug 'jiangmiao/auto-pairs' +Plug 'dense-analysis/ale' +Plug 'majutsushi/tagbar' +Plug 'vim-scripts/indentpython.vim' +Plug 'lepture/vim-jinja' +Plug 'pangloss/vim-javascript' +"Plug 'alvan/vim-closetag' +Plug 'maxmellon/vim-jsx-pretty' +call plug#end() filetype plugin indent on +syntax on -" persistent folds -" augroup AutoSaveFolds -" autocmd! -" autocmd BufWinLeave * mkview -" autocmd BufWinEnter * silent loadview -" augroup END +if need_to_install_plugins == 1 + echo "Installing plugins..." + silent! PlugInstall + echo "Done!" + q +endif + +" change to =2 to show the status bar +set laststatus=0 + +" enable 256 colors +set t_Co=256 +"set t_ut= + +" turn on line numbering +set number +set relativenumber +set dir=/tmp/ +set clipboard=unnamedplus + +" sane text files +set fileformat=unix +set encoding=utf-8 +set fileencoding=utf-8 + +hi Cursor ctermfg=White ctermbg=Yellow cterm=bold guifg=white guibg=yellow gui=bold +hi Search cterm=NONE ctermfg=yellow ctermbg=NONE +set hlsearch +nnoremap :nohl:echo "Search Cleared" +nnoremap :set norelativenumber:set nonumber:echo "Line numbers turned off." +nnoremap :set relativenumber:set number:echo "Line numbers turned on." + +" Save +" Ctrl-S is pause in most OS terminals, add "stty -ixon" to ~/.bashrc to +" disable or Ctrl-Q to continue +nnoremap :w! +vnoremap :w! +inoremap :w! + +" sane editing +set showtabline=0 +set tabstop=2 +set shiftwidth=2 +set softtabstop=2 +set colorcolumn=120 +set expandtab +set scrolloff=5 +set backspace=indent,eol,start +set viminfo='25,\"50,n~/.viminfo +autocmd FileType html setlocal tabstop=2 shiftwidth=2 softtabstop=2 +autocmd FileType css setlocal tabstop=2 shiftwidth=2 softtabstop=2 +autocmd FileType javascript setlocal tabstop=2 shiftwidth=2 softtabstop=2 +set noincsearch + +" hit jk fast to exit mode +inoremap jk + +" auto-pairs +au FileType python let b:AutoPairs = AutoPairsDefine({"f'" : "'", "r'" : "'", "b'" : "'"}) + +" word movement +imap bi +nmap b +imap wi +nmap w + +" indent/unindent with tab/shift-tab +nmap >> +nmap << +imap < >gv +vmap m :call ToggleMouse() +function ToggleMouse() + if g:is_mouse_enabled == 1 + echo "Mouse OFF" + set mouse= + let g:is_mouse_enabled = 0 + else + echo "Mouse ON" + set mouse=a + let g:is_mouse_enabled = 1 + endif +endfunction + +" color scheme +syntax on +" onedark.vim override: Don't set a background color when running in a terminal; +" just use the terminal's background color +" `gui` is the hex color code used in GUI mode/nvim true-color mode +" `cterm` is the color code used in 256-color mode +" `cterm16` is the color code used in 16-color mode +if (has("autocmd") && !has("gui_running")) + augroup colorset + autocmd! + let s:white = { "gui": "#ABB2BF", "cterm": "145", "cterm16" : "7" } + " autocmd ColorScheme * call onedark#set_highlight("Normal", { "fg": s:white }) " `bg` will not be styled since there is no `bg` setting + augroup END +endif +colorscheme onedark + +filetype on +filetype plugin indent on + +" " lightline +" set noshowmode +" let g:lightline = { 'colorscheme': 'onedark' } + +" code folding +set foldmethod=manual +set foldlevel=99 + +" wrap toggle +setlocal nowrap +noremap w :call ToggleWrap() +function ToggleWrap() + if &wrap + echo "Wrap OFF" + setlocal nowrap + set virtualedit=all + silent! nunmap + silent! nunmap + silent! nunmap + silent! nunmap + silent! iunmap + silent! iunmap + silent! iunmap + silent! iunmap + else + echo "Wrap ON" + setlocal wrap linebreak nolist + set virtualedit= + setlocal display+=lastline + noremap gk + noremap gj + noremap g + noremap g + inoremap gk + inoremap gj + inoremap g + inoremap g + endif +endfunction + +" Making sure spacebar doesn't have any mapping beforehand +nnoremap +let mapleader=" " +" move through split windows +nmap :wincmd k +nmap :wincmd j +nmap :wincmd h +nmap :wincmd l + +" move through buffers +nmap [ :bp! +nmap ] :bn! +" close buf +nmap x :bpbd# + +" restore place in file from previous session +autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif + +" file browser +let NERDTreeIgnore = ['\.pyc$', '__pycache__'] +let NERDTreeMinimalUI = 1 +let g:nerdtree_open = 0 +map n :call NERDTreeToggle() +function NERDTreeToggle() + NERDTreeTabsToggle + if g:nerdtree_open == 1 + let g:nerdtree_open = 0 + else + let g:nerdtree_open = 1 + wincmd p + endif +endfunction + +function! StartUp() + if 0 == argc() + NERDTree + end +endfunction +autocmd VimEnter * call StartUp() + +" ale +map (ale_next_wrap) +map (ale_previous_wrap) + +" tags +" sudo apt-get install autoconf && https://askubuntu.com/a/836521/804628 +map t :TagbarToggle +let g:tagbar_width = max([25, winwidth(0) / 5]) + +" copy, cut and paste +vmap "+y +vmap "+c +vmap c"+p +imap "+pa + +" disable autoindent when pasting text +" source: https://coderwall.com/p/if9mda/automatically-set-paste-mode-in-vim-when-pasting-in-insert-mode +let &t_SI .= "\[?2004h" +let &t_EI .= "\[?2004l" + +function! XTermPasteBegin() + set pastetoggle=[201~ + set paste + return "" +endfunction + +inoremap [200~ XTermPasteBegin() " Opens man page in split window, "ZQ" to close fun! ReadMan() @@ -122,49 +260,40 @@ endfun " Map the K key to the ReadMan function: map K :call ReadMan() -autocmd BufNewFile,BufRead *.json set ft=javascript -autocmd BufNewFile,BufRead *.jsonc set ft=javascript - -"########################################################### -"# Autocorrect Dictionary # -"########################################################### -abbr ture true -abbr flase false - -"########################################################### -"# Set Default Search highlighting ON (Off commented out) # -"########################################################### -:set hlsearch -:set incsearch - -"Map F6 to toggle on and off the baner -nmap I - -"# to change the way netrw shows the files and directorys -"let g:netrw_liststyle= 0 " Default view (directory name/file name) -"let g:netrw_liststyle= 1 " Show time and size -"let g:netrw_liststyle= 2 " Shows listing in 2 columns -let g:netrw_liststyle= 3 " show the tree listing - -"# Set the split windows to always be equal and open splits to the right -let g:netrw_winsize = 0 " set default window size to be always equal -let g:netrw_preview = 1 " open splits to the right - -" Per default, netrw leaves unmodified buffers open. This autocommand -" deletes netrw's buffer once it's hidden (using ':q;, for example) -autocmd FileType netrw setl bufhidden=delete " or use :qa! - -"These next three lines are for the fuzzy search: -set nocompatible "Limit search to your project -set path+=** "Search all subdirectories and recursively -set wildmenu "Shows multiple matches on one line - +" Map Ctrl+f to open current word search box +nnoremap :vim // % \| !:copen -" curl -fLo ~/.vim/colors/molokai.vim --create-dirs https://raw.githubusercontent.com/tomasr/molokai/master/colors/molokai.vim -" curl -fLo ~/.vim/colors/github.vim --create-dirs https://raw.githubusercontent.com/endel/vim-github-colorscheme/master/colors/github.vim +" Set vimdiff colorscheme to github like if &diff -" colorscheme github - colorscheme molokai + colorscheme github endif -nnoremap :vim // % \| !:copen +" One of the most annoying things about vim for me was that I frequently typed :W instead of :w. +" This is happens because the colon needs a shift, w doesn't. +" I would add 'q:' but it used for command history https://coderwall.com/p/sqteyg/vim-tip-command-history-buffer +command WQ wq +command Wq wq +command W w +command Q q + + + +""""""""""""""""""""""""""""""""""" +" Share via paste.rs +" Visual select and :Share +" Add .extension to url to format code +" Example: .markdown +""""""""""""""""""""""""""""""""" +function! s:share() range + let n = @n + silent! normal gv"ny + let out = system("echo '" . @n . "' | curl --silent --data-binary @- https://paste.rs") + let @n = n + normal `> + put ='' + put ='Share:' + put =out + " also copy to clipboard? + let @+ = out +endfunction +command! -range Share :call s:share() From cd2732f521d93ff5d3691105c453530caa45b2ea Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Sun, 31 Jan 2021 16:18:30 +0200 Subject: [PATCH 35/39] start windows and panes at 1, not 0 --- tmux/tmux.conf | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 487d40fe6..22a7127da 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -5,6 +5,11 @@ bind ` send-prefix set -g history-limit 50000 +# Start windows and panes at 1, not 0 +set -g base-index 1 +set -g pane-base-index 1 +set -g renumber-windows on + # New window unbind '"' unbind % @@ -15,7 +20,7 @@ set -g mode-style "fg=black,bg=white" # Easy Config Reloads unbind r -bind r source-file ~/.tmux.conf\; display-message "tmux.conf reloaded" +bind r source-file ~/.tmux.conf\; display-message "Tmux config reloaded" # Direction bind h select-pane -L @@ -165,7 +170,7 @@ set -g @plugin 'tmux-plugins/tmux-continuum' set -g @continuum-restore 'on' # set -g @plugin 'fcsonline/tmux-thumbs' set -g @plugin 'Morantron/tmux-fingers' - +# set -g @plugin 'odedlaz/tmux-onedark-theme' # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) run -b '~/.tmux/plugins/tpm/tpm' From c4517ee15cf29b1ac682fff8f8745841ef57e916 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Wed, 7 Apr 2021 00:42:06 +0300 Subject: [PATCH 36/39] Create zshrc --- m/zshrc | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 m/zshrc diff --git a/m/zshrc b/m/zshrc new file mode 100644 index 000000000..97c2a9f06 --- /dev/null +++ b/m/zshrc @@ -0,0 +1,53 @@ +export CLICOLOR=1 + +export VISUAL=vim +export EDITOR="$VISUAL" + +# don't put duplicate lines or lines starting with space in the history. See bash(1) for more options +HISTCONTROL=ignoreboth +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 +setopt inc_append_history # To save every command before it is executed +setopt share_history # setopt inc_append_history + +export PS1="\t \w\[$(tput sgr0)\]\$ " + + +alias ll='ls -alF' +alias l='ls -alF' + + +# fuzzy search in chrome history +c() { + local cols sep google_history open + cols=$(( COLUMNS / 3 )) + sep='{::}' + + if [ "$(uname)" = "Darwin" ]; then + google_history="$HOME/Library/Application Support/Google/Chrome/Default/History" + open=open + else + google_history="$HOME/.config/google-chrome/Default/History" + open=xdg-open + fi + cp -f "$google_history" /tmp/h + sqlite3 -separator $sep /tmp/h \ + "select substr(title, 1, $cols), url + from urls order by last_visit_time desc" | + awk -F $sep '{printf "%-'$cols's \x1b[36m%s\x1b[m\n", $1, $2}' | + fzf --ansi --multi | sed 's#.*\(https*://\)#\1#' | xargs $open > /dev/null 2> /dev/null +} + + +man-find() { + f=$(fd . $MANPATH/man${1:-1} -t f -x echo {/.} | fzf) && man $f +} +fman() { + man -k . | fzf --prompt='Man> ' | awk '{print $1}' | xargs -r man +} + +# Disable Ctrl+S (Pause) and Ctrl+Q (continue) shortcuts, I use Ctrl+S to save inside Vim +stty -ixon + + From 8675bba3b2d0b33816cde68d9103b58c0dff46fd Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Wed, 7 Apr 2021 00:42:57 +0300 Subject: [PATCH 37/39] Create tmux.conf --- m/tmux.conf | 191 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 m/tmux.conf diff --git a/m/tmux.conf b/m/tmux.conf new file mode 100644 index 000000000..c680c4d1f --- /dev/null +++ b/m/tmux.conf @@ -0,0 +1,191 @@ +# set-environment -g PATH "/usr/local/bin:/bin:/usr/bin" +# Prefix +unbind C-b +set -g prefix § +bind § send-prefix + +# Speed up escape key to speed up vim. +set -sg escape-time 1 +set -g set-titles on +set -g set-titles-string "#T" +# set -g set-titles-string "#{session_name} - #{host}" +set -g terminal-overrides 'xterm*:smcup@:rmcup@' +set -g history-limit 10000 + +# Start windows and panes at 1, not 0 +set -g base-index 1 +set -g pane-base-index 1 +set -g renumber-windows on + +# New window +unbind '"' +unbind % +bind | split-window -h -c "#{pane_current_path}" +bind - split-window -v -c "#{pane_current_path}" +bind c new-window -c "#{pane_current_path}" +set -g mode-style "fg=black,bg=white" + +# Resize the current pane using Prefix+Shift+[H/J/K/L] +bind -r J resize-pane -D 5 +bind -r K resize-pane -U 5 +bind -r H resize-pane -L 5 +bind -r L resize-pane -R 5 + +# Easy Config Reloads +unbind r +bind r source-file ~/.tmux.conf\; display-message "Tmux config reloaded" + +# Direction +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +set -g default-terminal "screen-256color" +set -g default-terminal "tmux-256color" + +set -g focus-events on + +# Use vi keys. +setw -g mode-keys vi +bind -T copy-mode-vi Escape send cancel + +unbind p +bind p paste-buffer +bind -T copy-mode-vi v send -X begin-selection +bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy" +# binding 'Enter' to copy and not leave selection mode +bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy" send -X clear-selection + +# don't rename windows automatically +set-option -g allow-rename off + +# Enable mouse support. +set -g mouse on +set -g focus-events on + +# http://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/ +###################### +### DESIGN CHANGES ### +###################### + +# panes +set -g pane-border-style fg=black +# set -g pane-active-border fg=brightred + +## Status bar design +# status line +# set -g status-utf8 on +set -g status-justify left +set -g status-style bg=default +set -g status-style fg=colour12 +set -g status-interval 2 + +# messaging +set -g message-style fg=black +set -g message-style bg=yellow +set -g message-command-style fg=blue +set -g message-command-style bg=black + +# Use shift + arrow key to move between windows in a session +bind -n S-Left previous-window +bind -n S-Right next-window + +#window mode +setw -g mode-style bg=colour6 +setw -g mode-style fg=colour0 + +# window status +setw -g window-status-format " #F#I:#W#F " +setw -g window-status-current-format " #F#I:#W#F " +setw -g window-status-format "#[fg=magenta]#[bg=black] #I #[bg=cyan]#[fg=colour8] #W " +setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W " +setw -g window-status-current-style bg=colour0 +setw -g window-status-current-style fg=colour11 +setw -g window-status-current-style dim +setw -g window-status-style bg=green +setw -g window-status-style fg=black +setw -g window-status-style reverse + +# Info on left (I don't have a session display for now) +set -g status-left '' + +# loud or quiet? +set-option -g visual-activity off +set-option -g visual-bell off +set-option -g visual-silence off +set-window-option -g monitor-activity off +set-option -g bell-action none + +set -g default-terminal "screen-256color" + +# The modes { +setw -g clock-mode-colour colour135 +setw -g mode-style bold +setw -g mode-style fg=colour196 +setw -g mode-style bg=colour238 + +# } +# The panes { + +set -g pane-border-style bg=colour235 +set -g pane-border-style fg=colour238 +set -g pane-active-border-style bg=colour236 +set -g pane-active-border-style fg=colour7 + +# } +# The statusbar { + +#set -g status-position bottom +#set -g status-style bg=colour234 +#set -g status-style fg=colour137 +set -g status-style dim +set -g status-left '' +set -g status-right '#(iwgetid -r) #[fg=colour7]%a %-d%b%H:%M #[fg=colour9]#{?#(xset -q | grep LED | cut -c63),בע,En} #[fg=colour11]#(upower -i /org/freedesktop/UPower/devices/DisplayDevice | grep percentage | cut -d" " -f15)' + + +set -g status-right-length 50 +set -g status-left-length 20 + +setw -g window-status-current-style fg=colour81 +setw -g window-status-current-style bg=colour238 +setw -g window-status-current-style bold +setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F ' + +setw -g window-status-style fg=colour138 +setw -g window-status-style bg=colour235 +setw -g window-status-style none +setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F ' + +setw -g window-status-bell-style bold +setw -g window-status-bell-style fg=colour255 +setw -g window-status-bell-style bg=colour1 + +# } +# The messages { + +set -g message-style bold +set -g message-style fg=colour232 +set -g message-style bg=colour166 + +# } + +bind T command-prompt -p "Google > " "run \"open -a 'Google Chrome' 'https://translate.google.com/?lang=he&sl=auto&tl=iw&text=%%&op=translate' \"" +# TODO fix for OSX +# prompt for terminal opacity percentage, 100 = not transparent +bind t command-prompt -p "Enter Opacity %" "run \"xprop -id $(xprop -root _NET_ACTIVE_WINDOW | cut -d ' ' -f 5) -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY $(printf 0x%x $((0xffffffff * %% / 100)))\"" +# google search & translate +bind g command-prompt -p "Google > " "run \"chrome '? %%' \"" + + +# List of plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'tmux-plugins/tmux-resurrect' +set -g @plugin 'tmux-plugins/tmux-continuum' +set -g @continuum-restore 'on' +# set -g @plugin 'fcsonline/tmux-thumbs' +set -g @plugin 'Morantron/tmux-fingers' +# set -g @plugin 'odedlaz/tmux-onedark-theme' +# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) +run -b '~/.tmux/plugins/tpm/tpm' From 80dfe5003d7136fd1653e75d655605dfa4cbab57 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Wed, 7 Apr 2021 00:43:21 +0300 Subject: [PATCH 38/39] Create vimrc.vim --- m/vimrc.vim | 303 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 303 insertions(+) create mode 100644 m/vimrc.vim diff --git a/m/vimrc.vim b/m/vimrc.vim new file mode 100644 index 000000000..ddec24f01 --- /dev/null +++ b/m/vimrc.vim @@ -0,0 +1,303 @@ +" plugins +let need_to_install_plugins = 0 +if empty(glob('~/.vim/autoload/plug.vim')) + silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + let need_to_install_plugins = 1 +endif + +call plug#begin() +Plug 'tpope/vim-sensible' +" Plug 'itchyny/lightline.vim' +Plug 'joshdick/onedark.vim' +Plug 'albertorestifo/github.vim' +Plug 'ap/vim-buftabline' +Plug 'airblade/vim-gitgutter' +Plug 'preservim/nerdtree' +Plug 'jistr/vim-nerdtree-tabs' +Plug 'Xuyuanp/nerdtree-git-plugin' +Plug 'jiangmiao/auto-pairs' +Plug 'dense-analysis/ale' +Plug 'majutsushi/tagbar' +Plug 'vim-scripts/indentpython.vim' +Plug 'lepture/vim-jinja' +Plug 'pangloss/vim-javascript' +"Plug 'alvan/vim-closetag' +Plug 'maxmellon/vim-jsx-pretty' +call plug#end() + +filetype plugin indent on +syntax on + +if need_to_install_plugins == 1 + echo "Installing plugins..." + silent! PlugInstall + echo "Done!" + q +endif + +" change to =2 to show the status bar +set laststatus=0 + +" enable 256 colors +set t_Co=256 +"set t_ut= + +" turn on line numbering +set number +set relativenumber +set dir=/tmp/ +if system('uname -s') == "Darwin\n" + set clipboard=unnamed "OSX +else + set clipboard=unnamedplus "Linux +endif + +" sane text files +set fileformat=unix +set encoding=utf-8 +set fileencoding=utf-8 + +hi Cursor ctermfg=White ctermbg=Yellow cterm=bold guifg=white guibg=yellow gui=bold +hi Search cterm=NONE ctermfg=yellow ctermbg=NONE +set hlsearch +nnoremap :nohl:echo "Search Cleared" +nnoremap :set norelativenumber:set nonumber:echo "Line numbers turned off." +nnoremap :set relativenumber:set number:echo "Line numbers turned on." + +" Save +" Ctrl-S is pause in most OS terminals, add "stty -ixon" to ~/.bashrc to +" disable or Ctrl-Q to continue +nnoremap :w! +vnoremap :w! +inoremap :w! + +" sane editing +set showtabline=0 +set tabstop=2 +set shiftwidth=2 +set softtabstop=2 +set colorcolumn=120 +set expandtab +set scrolloff=5 +set backspace=indent,eol,start +set viminfo='25,\"50,n~/.viminfo +autocmd FileType html setlocal tabstop=2 shiftwidth=2 softtabstop=2 +autocmd FileType css setlocal tabstop=2 shiftwidth=2 softtabstop=2 +autocmd FileType javascript setlocal tabstop=2 shiftwidth=2 softtabstop=2 +set noincsearch + +" hit jk fast to exit mode +inoremap jk + +" auto-pairs +au FileType python let b:AutoPairs = AutoPairsDefine({"f'" : "'", "r'" : "'", "b'" : "'"}) + +" word movement +imap bi +nmap b +imap wi +nmap w + +" indent/unindent with tab/shift-tab +nmap >> +nmap << +imap < >gv +vmap m :call ToggleMouse() +function ToggleMouse() + if g:is_mouse_enabled == 1 + echo "Mouse OFF" + set mouse= + let g:is_mouse_enabled = 0 + else + echo "Mouse ON" + set mouse=a + let g:is_mouse_enabled = 1 + endif +endfunction + +" color scheme +syntax on +" onedark.vim override: Don't set a background color when running in a terminal; +" just use the terminal's background color +" `gui` is the hex color code used in GUI mode/nvim true-color mode +" `cterm` is the color code used in 256-color mode +" `cterm16` is the color code used in 16-color mode +if (has("autocmd") && !has("gui_running")) + augroup colorset + autocmd! + let s:white = { "gui": "#ABB2BF", "cterm": "145", "cterm16" : "7" } + " autocmd ColorScheme * call onedark#set_highlight("Normal", { "fg": s:white }) " `bg` will not be styled since there is no `bg` setting + augroup END +endif +colorscheme onedark + +filetype on +filetype plugin indent on + +" " lightline +" set noshowmode +" let g:lightline = { 'colorscheme': 'onedark' } + +" code folding +set foldmethod=manual +set foldlevel=99 + +" wrap toggle +setlocal nowrap +noremap w :call ToggleWrap() +function ToggleWrap() + if &wrap + echo "Wrap OFF" + setlocal nowrap + set virtualedit=all + silent! nunmap + silent! nunmap + silent! nunmap + silent! nunmap + silent! iunmap + silent! iunmap + silent! iunmap + silent! iunmap + else + echo "Wrap ON" + setlocal wrap linebreak nolist + set virtualedit= + setlocal display+=lastline + noremap gk + noremap gj + noremap g + noremap g + inoremap gk + inoremap gj + inoremap g + inoremap g + endif +endfunction + +" Making sure spacebar doesn't have any mapping beforehand +nnoremap +let mapleader=" " +" move through split windows +nmap :wincmd k +nmap :wincmd j +nmap :wincmd h +nmap :wincmd l + +" move through buffers +nmap [ :bp! +nmap ] :bn! +" close buf +nmap x :bpbd# + +" restore place in file from previous session +autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif + +" file browser +let NERDTreeIgnore = ['\.pyc$', '__pycache__'] +let NERDTreeMinimalUI = 1 +let g:nerdtree_open = 0 +map n :call NERDTreeToggle() +function NERDTreeToggle() + NERDTreeTabsToggle + if g:nerdtree_open == 1 + let g:nerdtree_open = 0 + else + let g:nerdtree_open = 1 + wincmd p + endif +endfunction + +function! StartUp() + if 0 == argc() + NERDTree + end +endfunction +autocmd VimEnter * call StartUp() + +" ale +map (ale_next_wrap) +"map (ale_previous_wrap) + +" tags +" sudo apt-get install autoconf && https://askubuntu.com/a/836521/804628 +map t :TagbarToggle +let g:tagbar_width = max([25, winwidth(0) / 5]) + +" copy, cut and paste +vmap "+y +vmap "+c +vmap c"+p +imap "+pa + +" disable autoindent when pasting text +" source: https://coderwall.com/p/if9mda/automatically-set-paste-mode-in-vim-when-pasting-in-insert-mode +let &t_SI .= "\[?2004h" +let &t_EI .= "\[?2004l" + +function! XTermPasteBegin() + set pastetoggle=[201~ + set paste + return "" +endfunction + +inoremap [200~ XTermPasteBegin() + +" Opens man page in split window, "ZQ" to close +fun! ReadMan() + " Assign current word under cursor to a script variable: + let s:man_word = expand('') + " Open a new window: + :exe ":wincmd n" + " Read in the manpage for man_word (col -b is for formatting): + :exe ":r!man " . s:man_word . " | col -b" + " Goto first line... + :exe ":goto" + " and delete it: + :exe ":delete" +endfun +" Map the K key to the ReadMan function: +map K :call ReadMan() + +" Map Ctrl+f to open current word search box +nnoremap :vim // % \| !:copen + +" Set vimdiff colorscheme to github like +if &diff + colorscheme github +endif + +" One of the most annoying things about vim for me was that I frequently typed :W instead of :w. +" This is happens because the colon needs a shift, w doesn't. +" I would add 'q:' but it used for command history https://coderwall.com/p/sqteyg/vim-tip-command-history-buffer +command WQ wq +command Wq wq +command W w +command Q q + + + +""""""""""""""""""""""""""""""""""" +" Share via paste.rs +" Visual select and :Share +" Add .extension to url to format code +" Example: .markdown +""""""""""""""""""""""""""""""""" +function! s:share() range + let n = @n + silent! normal gv"ny + let out = system("echo '" . @n . "' | curl --silent --data-binary @- https://paste.rs") + let @n = n + normal `> + put ='' + put ='Share:' + put =out + " also copy to clipboard? + let @+ = out +endfunction +command! -range Share :call s:share() From a7fcdb7b58e315150a589f6ad6c5978ccf2836c1 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Wed, 7 Apr 2021 00:45:49 +0300 Subject: [PATCH 39/39] Create inputrc --- m/inputrc | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 m/inputrc diff --git a/m/inputrc b/m/inputrc new file mode 100644 index 000000000..b1ac5da58 --- /dev/null +++ b/m/inputrc @@ -0,0 +1,40 @@ +# Make tab autocomplete regardless of filename case. +set completion-ignore-case on + +# List all matches in case multiple possible completions are possible. +set show-all-if-ambiguous on + +# Immediately add a trailing slash when autocompleting symlinks to directories. +set mark-symlinked-directories on + +# Use the text that has already been typed as the prefix for searching through +# commands (i.e. more intelligent Up/Down behavior) +#"\e[B": history-search-forward +#"\e[A": history-search-backward + +# Do not autocomplete hidden files unless the pattern explicitly begins with a dot +set match-hidden-files off + +# Show all autocomplete results at once +set page-completions off + +# If there are more than 200 possible completions for a word, ask to show them all +set completion-query-items 200 + +# Show extra file information when completing, like `ls -F` does +set visible-stats on + +# Be more intelligent when autocompleting by also looking at the text after +# the cursor. For example, when the current line is "cd ~/src/mozil", and +# the cursor is on the "z", pressing Tab will not autocomplete it to "cd +# ~/src/mozillail", but to "cd ~/src/mozilla". (This is supported by the +# Readline used by Bash 4.) +set skip-completed-text on + +# Allow UTF-8 input and output, instead of showing stuff like $'\0123\0456' +set input-meta on +set output-meta on +set convert-meta off + +# Use Alt/Meta + Delete to delete the preceding word +#"\e[3;3~": kill-word