mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
Merge remote-tracking branch 'refs/remotes/origin/master'
This commit is contained in:
commit
8bad9ebc9b
20 changed files with 588 additions and 239 deletions
43
.config/ipython/profile_default/ipython_config.py
Normal file
43
.config/ipython/profile_default/ipython_config.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
c.TerminalIPythonApp.display_banner = True
|
||||
c.TerminalInteractiveShell.editing_mode = 'vi'
|
||||
c.TerminalInteractiveShell.confirm_exit = False
|
||||
|
||||
# Source: https://ipython.readthedocs.io/en/stable/config/details.html#keyboard-shortcuts
|
||||
def custom_return(shell):
|
||||
|
||||
"""This function is required by the API. It takes a reference to
|
||||
the shell, which is the same thing `get_ipython()` evaluates to.
|
||||
This function must return a function that handles each keypress
|
||||
event. That function, named `handle` here, references `shell`
|
||||
by closure."""
|
||||
|
||||
def handle(event):
|
||||
|
||||
"""This function is called each time `Enter` is pressed,
|
||||
and takes a reference to a Prompt Toolkit event object.
|
||||
If the current input starts with a bang or modulo, then
|
||||
the input is executed, otherwise a newline is entered,
|
||||
followed by any spaces needed to auto-indent."""
|
||||
|
||||
# set up a few handy references to nested items...
|
||||
|
||||
buffer = event.current_buffer
|
||||
document = buffer.document
|
||||
text = document.text
|
||||
|
||||
if text.startswith('!') or text.startswith('%'): # execute the input...
|
||||
|
||||
buffer.accept_action.validate_and_handle(event.cli, buffer)
|
||||
|
||||
else: # insert a newline with auto-indentation...
|
||||
|
||||
if document.line_count > 1: text = text[:document.cursor_position]
|
||||
indent = shell.check_complete(text)[1]
|
||||
buffer.insert_text('\n' + indent)
|
||||
|
||||
# if you just wanted a plain newline without any indentation, you
|
||||
# could use `buffer.insert_text('\n')` instead of the lines above
|
||||
|
||||
return handle
|
||||
|
||||
c.TerminalInteractiveShell.handle_return = custom_return
|
||||
69
.config/ipython/profile_default/starup/keymap.py
Normal file
69
.config/ipython/profile_default/starup/keymap.py
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
from prompt_toolkit.key_binding import KeyBindings
|
||||
from prompt_toolkit.key_binding.vi_state import InputMode
|
||||
from prompt_toolkit.filters import Condition
|
||||
from IPython import get_ipython
|
||||
|
||||
ip = get_ipython()
|
||||
key_bindings = KeyBindings()
|
||||
|
||||
@Condition
|
||||
def in_navigation_mode():
|
||||
return ip.pt_app.app.vi_state.input_mode == InputMode.NAVIGATION
|
||||
|
||||
# colemak keymap hnei
|
||||
@key_bindings.add("n", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Move cursor down by visual line"
|
||||
event.current_buffer.auto_down(count=event.arg)
|
||||
|
||||
@key_bindings.add("e", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Move cursor up by visual line"
|
||||
event.current_buffer.auto_up(count=event.arg)
|
||||
|
||||
@key_bindings.add("i", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Move cursor right"
|
||||
event.current_buffer.cursor_right(count=event.arg)
|
||||
|
||||
# Insert with 'l' and 'L'
|
||||
@key_bindings.add("l", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Enter insert mode (similar position to 'i' in Colemak)"
|
||||
event.app.vi_state.input_mode = InputMode.INSERT
|
||||
|
||||
@key_bindings.add("L", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Enter insert mode at the beginning of the line"
|
||||
event.current_buffer.cursor_position += event.current_buffer.document.get_start_of_line_position()
|
||||
|
||||
# Ne[k]st
|
||||
@key_bindings.add("k", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Find next match"
|
||||
event.current_buffer.forward_search()
|
||||
|
||||
@key_bindings.add("K", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Find previous match"
|
||||
event.current_buffer.reverse_search()
|
||||
|
||||
# [J]ump
|
||||
@key_bindings.add("j", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Move to end of next word"
|
||||
event.current_buffer.cursor_right_word()
|
||||
|
||||
@key_bindings.add("J", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Move to end of next word with capital E"
|
||||
event.current_buffer.cursor_right_word(end=True)
|
||||
|
||||
# Yank to end of line with 'Y'
|
||||
@key_bindings.add("Y", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Yank to the end of the line"
|
||||
text_to_yank = event.current_buffer.document.text_after_cursor
|
||||
event.app.clipboard.set_text(text_to_yank)
|
||||
|
||||
ip.pt_app.key_bindings = key_bindings
|
||||
10
.config/ipython/profile_default/starup/magic_ps.py
Normal file
10
.config/ipython/profile_default/starup/magic_ps.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
from IPython.core.magic import register_line_magic
|
||||
|
||||
@register_line_magic
|
||||
def ps(cmd):
|
||||
output = get_ipython().getoutput(f"powershell -Command {cmd}")
|
||||
# If no variable is assigned to the output, print it
|
||||
if get_ipython().last_execution_result is None:
|
||||
print("\n".join(output))
|
||||
else:
|
||||
return "\n".join(output)
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# $XDG_CONFIG_HOME/lesskey -- less options
|
||||
# ln -sf $DOTFILES/.config/lesskey $XDG_CONFIG_HOME/lesskey
|
||||
# Ne
|
||||
# work for less -V > 582, for mac, use brew install less to override the system less
|
||||
|
||||
# Format: key action
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
# export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc
|
||||
# ===========================================================
|
||||
# $XDG_CONFIG_HOME/npm/npmrc
|
||||
# ln -s $DOTFILES/.config/npm/npmrc $NPM_CONFIG_USERCONFIG
|
||||
# New-Item -ItemType SymbolicLink -Path $env:NPM_CONFIG_USERCONFIG -Value $env:DOTFILES/.config/npm/npmrc
|
||||
# registry=https://registry.npmmirror.com
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ return {
|
|||
opts = {
|
||||
workspaces = {
|
||||
{
|
||||
name = "All",
|
||||
name = "Obsidian",
|
||||
path = "~/Obsidian",
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,8 +1,20 @@
|
|||
# $XDG_CONFIG_HOME/tmux/tmux.conf
|
||||
# ln -sf $DOTFILES/.config/tmux/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf
|
||||
|
||||
# Prefix
|
||||
# -----------------
|
||||
set-option -g prefix C-x
|
||||
set-option -g prefix C-a
|
||||
unbind C-b
|
||||
bind C-x send-prefix
|
||||
bind C-a send-prefix
|
||||
|
||||
# Options
|
||||
set-option -g mouse on
|
||||
set-option -g default-terminal "screen-256color"
|
||||
set-option -g allow-rename on
|
||||
set-option -g alternate-screen on
|
||||
set-option -g visual-activity on
|
||||
set-option -g pane-border-style fg=colour244
|
||||
set-option -g pane-activity-border-style fg=colour239
|
||||
|
||||
# Index
|
||||
# -----------------
|
||||
|
|
@ -15,7 +27,7 @@ set -g history-limit 4096
|
|||
|
||||
# Reload Config
|
||||
# -----------------
|
||||
bind r source-file ~/.tmux.conf \; display "Reloaded Config"
|
||||
bind r source-file ~/.config/tmux/tmux.conf \; display "Reloaded Config"
|
||||
|
||||
# Vi Mode
|
||||
# -----------------
|
||||
|
|
@ -32,6 +44,18 @@ bind h select-pane -L
|
|||
bind n select-pane -D
|
||||
bind e select-pane -U
|
||||
bind i select-pane -R
|
||||
bind -r H resize-pane -L 5
|
||||
bind -r N resize-pane -D 5
|
||||
bind -r E resize-pane -U 5
|
||||
bind -r I resize-pane -R 5
|
||||
bind C-h select-window -t :-
|
||||
bind C-l select-window -t :+
|
||||
bind ` resize-pane -Z
|
||||
|
||||
|
||||
|
||||
# Status Bar
|
||||
# -----------------
|
||||
set -g status-position top
|
||||
set-option -g status-bg black
|
||||
set-option -g status-fg white
|
||||
set-option -g status-left '#[fg=green][#S] '
|
||||
setw -g window-status-current-format '#[fg=colour236,bg=colour39] #I #W '
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ set incsearch
|
|||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
set number
|
||||
set relativenumber
|
||||
|
||||
" XDG Directory Specifications
|
||||
" Reference to https://jorenar.com/blog/vim-xdg
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue