From b1b8fb265ad4c46b458e03240ab3c942ae474d63 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Sat, 19 Jun 2021 02:52:16 +0430 Subject: so many things --- .config/broot/conf.hjson | 325 +++++++++++++++++++++++++++++++++++++++++++++ .config/ptpython/config.py | 198 +++++++++++++++++++++++++++ .config/ranger/rc.conf | 4 +- 3 files changed, 525 insertions(+), 2 deletions(-) create mode 100644 .config/broot/conf.hjson create mode 100644 .config/ptpython/config.py (limited to '.config') diff --git a/.config/broot/conf.hjson b/.config/broot/conf.hjson new file mode 100644 index 0000000..93c4fef --- /dev/null +++ b/.config/broot/conf.hjson @@ -0,0 +1,325 @@ + +############################################################### +# This configuration file lets you +# - define new commands +# - change the shortcut or triggering keys of built-in verbs +# - change the colors +# - set default values for flags +# - set special behaviors on specific paths +# - and more... +# +# Configuration documentation is available at +# https://dystroy.org/broot +# +# This file's format is Hjson ( https://hjson.github.io/ ). Some +# properties are commented out. To enable them, remove the `#`. +# +############################################################### +{ + + ############################################################### + # Default flags + # You can set up flags you want broot to start with by + # default, for example `default_flags="ihp"` if you usually want + # to see hidden and gitignored files and the permissions (then + # if you don't want the hidden files you can launch `br -H`) + # A popular flag is the `g` one which displays git related info. + # + # default_flags: + + ############################################################### + # Date/Time format + # If you want to change the format for date/time, uncomment the + # following line and change it according to + # https://docs.rs/chrono/0.4.11/chrono/format/strftime/index.html + # + # date_time_format: %Y/%m/%d %R + + ############################################################### + # "vim mode" + # + # + # modal: true + + ############################################################### + # Whether to mark the selected line with a triangle + # + # show_selection_mark: true + + ############################################################### + # Column order + # cols_order, if specified, must be a permutation of the following + # array. You should keep the name at the end as it has a variable + # length. + # + # cols_order: [ + # mark + # git + # size + # permission + # date + # count + # branch + # name + # ] + + ############################################################### + # True Colors + # If this parameter isn't set, broot tries to automatically + # determine whether true colors (24 bits) are available. + # As this process is unreliable, you may uncomment this setting + # and set it to false or true if you notice the colors in + # previewed images are too off. + # + # true_colors: false + + ############################################################### + # Icons + # If you want to display icons in broot, uncomment this line + # (see https://dystroy.org/broot/icons for installation and + # troubleshooting) + # + # icon_theme: vscode + + ############################################################### + # Special paths + # If some paths must be handled specially, uncomment (and change + # this section as per the examples) + # + # special_paths: { + # "/media/slow-backup-disk" : no-enter + # "/home/dys/useless" : hide + # "/home/dys/my-link-I-want-to-explore" : enter + # } + + + ############################################################### + # Search modes + # + # broot allows many search modes. + # A search mode is defined by + # - the way to search: fuzzy, exact, or a regular expression. + # - where to search: name, sub-path, or file content + # A search pattern may for example be "fuzzy name" (default), + # "regex content" or "exact path". + # + # The search mode is selected from its prefix. For example, if + # you type "abc", the default mode is "fuzzy name". If you type + # "/abc", the mode is "regex name". If you type "rp/abc", the mode + # is "regex path". + # + # This mapping may be modified. You may want to dedicate the + # empty prefix (the one which doesn't need a '/') to the + # search mode you use most often. The example below makes it + # easy to search on subpath rather than on the name. + # + # More information on + # https://dystroy.org/broot/input/#the-filtering-pattern + # + # search_modes: { + # : fuzzy path + # /: regex path + # } + + ############################################################### + # Verbs and shortcuts + # You can define your own commands which would be applied to + # the selection. + # You'll also find below verbs that you can customize or enable. + verbs: [ + + # Exemple 1: launching `tail -n` on the selected file (leaving broot) + # { + # name: tail_lines + # invocation: tl {lines_count} + # execution: "tail -f -n {lines_count} {file}" + # } + + # Exemple 2: creating a new file without leaving broot + # { + # name: touch + # invocation: touch {new_file} + # execution: "touch {directory}/{new_file}" + # leave_broot: false + # } + + # A standard recommended command for editing files, that you + # can customize. + # If $EDITOR isn't set on your computer, you should either set it using + # something similar to + # export EDITOR=nvim + # or just replace it with your editor of choice in the 'execution' + # pattern. + # If your editor is able to open a file on a specific line, use {line} + # so that you may jump directly at the right line from a preview. + # Example: + # execution: nvim +{line} {file} + { + invocation: edit + key: F2 + shortcut: e + execution: "$EDITOR +{line} {file}" + leave_broot: false + } + + # A convenient shortcut to create new text files in + # the current directory or below + { + invocation: create {subpath} + execution: "$EDITOR {directory}/{subpath}" + leave_broot: false + } + + { + invocation: git_diff + shortcut: gd + leave_broot: false + execution: "git difftool -y {file}" + } + + # This verb lets you launch a terminal on ctrl-T + # (on exit you'll be back in broot) + { + invocation: terminal + key: ctrl-t + execution: "$SHELL" + set_working_dir: true + leave_broot: false + } + + # Here's an example of a shorctut bringing you to your home directory + # { + # invocation: home + # key: ctrl-home + # execution: ":focus ~" + # } + + # A popular set of shorctuts for going up and down: + # + # { + # key: ctrl-k + # execution: ":line_up" + # } + # { + # key: ctrl-j + # execution: ":line_down" + # } + # { + # key: ctrl-u + # execution: ":page_up" + # } + # { + # key: ctrl-d + # execution: ":page_down" + # } + + # If you develop using git, you might like to often switch + # to the git status filter: + # { + # key: ctrl-g + # execution: ":toggle_git_status" + # } + + # You can reproduce the bindings of Norton Commander + # on copying or moving to the other panel: + # + # { + # key: F5 + # execution: ":copy_to_panel" + # } + # { + # key: F6 + # execution: ":move_to_panel" + # } + ] + + ############################################################### + # Skin + # If you want to change the colors of broot, + # uncomment the following bloc and start messing + # with the various values. + # A skin entry value is made of two parts separated with a '/': + # The first one is the skin for the active panel. + # The second one, optional, is the skin for non active panels. + ############################################################### + # + skin: { + default: gray(23) none / gray(20) none + tree: ansi(94) None / gray(3) None + file: gray(20) None / gray(15) None + directory: ansi(208) None Bold / ansi(172) None bold + exe: Cyan None + link: Magenta None + pruning: gray(12) None Italic + perm__: gray(5) None + perm_r: ansi(94) None + perm_w: ansi(132) None + perm_x: ansi(65) None + owner: ansi(138) None + group: ansi(131) None + count: ansi(136) gray(3) + dates: ansi(66) None + sparse: ansi(214) None + content_extract: ansi(29) None + content_match: ansi(34) None + git_branch: ansi(229) None + git_insertions: ansi(28) None + git_deletions: ansi(160) None + git_status_current: gray(5) None + git_status_modified: ansi(28) None + git_status_new: ansi(94) None Bold + git_status_ignored: gray(17) None + git_status_conflicted: ansi(88) None + git_status_other: ansi(88) None + selected_line: None gray(5) / None gray(4) + char_match: Yellow None + file_error: Red None + flag_label: gray(15) None + flag_value: ansi(208) None Bold + input: White None / gray(15) gray(2) + status_error: gray(22) ansi(124) + status_job: ansi(220) gray(5) + status_normal: gray(20) gray(3) / gray(2) gray(2) + status_italic: ansi(208) gray(3) / gray(2) gray(2) + status_bold: ansi(208) gray(3) Bold / gray(2) gray(2) + status_code: ansi(229) gray(3) / gray(2) gray(2) + status_ellipsis: gray(19) gray(1) / gray(2) gray(2) + purpose_normal: gray(20) gray(2) + purpose_italic: ansi(178) gray(2) + purpose_bold: ansi(178) gray(2) Bold + purpose_ellipsis: gray(20) gray(2) + scrollbar_track: gray(7) None / gray(4) None + scrollbar_thumb: gray(22) None / gray(14) None + help_paragraph: gray(20) None + help_bold: ansi(208) None Bold + help_italic: ansi(166) None + help_code: gray(21) gray(3) + help_headers: ansi(208) None + help_table_border: ansi(239) None + preview: gray(20) gray(1) / gray(18) gray(2) + preview_line_number: gray(12) gray(3) + preview_match: None ansi(29) + hex_null: gray(11) None + hex_ascii_graphic: gray(18) None + hex_ascii_whitespace: ansi(143) None + hex_ascii_other: ansi(215) None + hex_non_ascii: ansi(167) None + } + + # You may find explanations and other skins on + # https://dystroy.org/broot/skins + # for example a skin suitable for white backgrounds + + + ############################################################### + # File Extension Colors + # + # uncomment and modify the next section if you want to color + # file name depending on their extension + # + # ext_colors: { + # png: rgb(255, 128, 75) + # rs: yellow + # } + +} diff --git a/.config/ptpython/config.py b/.config/ptpython/config.py new file mode 100644 index 0000000..8f1e749 --- /dev/null +++ b/.config/ptpython/config.py @@ -0,0 +1,198 @@ +""" +Configuration example for ``ptpython``. + +Copy this file to $XDG_CONFIG_HOME/ptpython/config.py +On Linux, this is: ~/.config/ptpython/config.py +""" +from prompt_toolkit.filters import ViInsertMode +from prompt_toolkit.key_binding.key_processor import KeyPress +from prompt_toolkit.keys import Keys +from prompt_toolkit.styles import Style + +from ptpython.layout import CompletionVisualisation + +__all__ = ["configure"] + + +def configure(repl): + """ + Configuration method. This is called during the start-up of ptpython. + + :param repl: `PythonRepl` instance. + """ + # Show function signature (bool). + repl.show_signature = True + + # Show docstring (bool). + repl.show_docstring = False + + # Show the "[Meta+Enter] Execute" message when pressing [Enter] only + # inserts a newline instead of executing the code. + repl.show_meta_enter_message = True + + # Show completions. (NONE, POP_UP, MULTI_COLUMN or TOOLBAR) + repl.completion_visualisation = CompletionVisualisation.POP_UP + + # When CompletionVisualisation.POP_UP has been chosen, use this + # scroll_offset in the completion menu. + repl.completion_menu_scroll_offset = 0 + + # Show line numbers (when the input contains multiple lines.) + repl.show_line_numbers = True + + # Show status bar. + repl.show_status_bar = True + + # When the sidebar is visible, also show the help text. + repl.show_sidebar_help = True + + # Swap light/dark colors on or off + repl.swap_light_and_dark = True + + # Highlight matching parethesis. + repl.highlight_matching_parenthesis = True + + # Line wrapping. (Instead of horizontal scrolling.) + repl.wrap_lines = True + + # Mouse support. + repl.enable_mouse_support = False + + # Complete while typing. (Don't require tab before the + # completion menu is shown.) + repl.complete_while_typing = True + + # Fuzzy and dictionary completion. + repl.enable_fuzzy_completion = True + repl.enable_dictionary_completion = True + + # Vi mode. + repl.vi_mode = True + + # Paste mode. (When True, don't insert whitespace after new line.) + repl.paste_mode = False + + # Use the classic prompt. (Display '>>>' instead of 'In [1]'.) + repl.prompt_style = "classic" # 'classic' or 'ipython' + + # Don't insert a blank line after the output. + repl.insert_blank_line_after_output = False + + # History Search. + # When True, going back in history will filter the history on the records + # starting with the current input. (Like readline.) + # Note: When enable, please disable the `complete_while_typing` option. + # otherwise, when there is a completion available, the arrows will + # browse through the available completions instead of the history. + repl.enable_history_search = False + + # Enable auto suggestions. (Pressing right arrow will complete the input, + # based on the history.) + repl.enable_auto_suggest = True + + # Enable open-in-editor. Pressing C-x C-e in emacs mode or 'v' in + # Vi navigation mode will open the input in the current editor. + repl.enable_open_in_editor = True + + # Enable system prompt. Pressing meta-! will display the system prompt. + # Also enables Control-Z suspend. + repl.enable_system_bindings = True + + # Ask for confirmation on exit. + repl.confirm_exit = True + + # Enable input validation. (Don't try to execute when the input contains + # syntax errors.) + repl.enable_input_validation = True + + # Use this colorscheme for the code. + # repl.use_code_colorscheme("default") + repl.use_code_colorscheme("pastie") + + # Set color depth (keep in mind that not all terminals support true color). + + # repl.color_depth = "DEPTH_1_BIT" # Monochrome. + # repl.color_depth = "DEPTH_4_BIT" # ANSI colors only. + repl.color_depth = "DEPTH_8_BIT" # The default, 256 colors. + # repl.color_depth = "DEPTH_24_BIT" # True color. + + # Min/max brightness + repl.min_brightness = 0.0 # Increase for dark terminal backgrounds. + repl.max_brightness = 1.0 # Decrease for light terminal backgrounds. + + # Syntax. + repl.enable_syntax_highlighting = True + + # Get into Vi navigation mode at startup + repl.vi_start_in_navigation_mode = False + + # Preserve last used Vi input mode between main loop iterations + repl.vi_keep_last_used_mode = False + + # Install custom colorscheme named 'my-colorscheme' and use it. + """ + repl.install_ui_colorscheme("my-colorscheme", Style.from_dict(_custom_ui_colorscheme)) + repl.use_ui_colorscheme("my-colorscheme") + """ + + # Add custom key binding for PDB. + """ + @repl.add_key_binding("c-b") + def _(event): + " Pressing Control-B will insert "pdb.set_trace()" " + event.cli.current_buffer.insert_text("\nimport pdb; pdb.set_trace()\n") + """ + + # Typing ControlE twice should also execute the current command. + # (Alternative for Meta-Enter.) + """ + @repl.add_key_binding("c-e", "c-e") + def _(event): + event.current_buffer.validate_and_handle() + """ + + # Typing 'jj' in Vi Insert mode, should send escape. (Go back to navigation + # mode.) + """ + @repl.add_key_binding("j", "j", filter=ViInsertMode()) + def _(event): + " Map 'jj' to Escape. " + event.cli.key_processor.feed(KeyPress(Keys("escape"))) + """ + + # Custom key binding for some simple autocorrection while typing. + """ + corrections = { + "impotr": "import", + "pritn": "print", + } + + @repl.add_key_binding(" ") + def _(event): + " When a space is pressed. Check & correct word before cursor. " + b = event.cli.current_buffer + w = b.document.get_word_before_cursor() + + if w is not None: + if w in corrections: + b.delete_before_cursor(count=len(w)) + b.insert_text(corrections[w]) + + b.insert_text(" ") + """ + + # Add a custom title to the status bar. This is useful when ptpython is + # embedded in other applications. + """ + repl.title = "My custom prompt." + """ + + +# Custom colorscheme for the UI. See `ptpython/layout.py` and +# `ptpython/style.py` for all possible tokens. +_custom_ui_colorscheme = { + # Blue prompt. + "prompt": "bg:#eeeeff #000000 bold", + # Make the status toolbar red. + "status-toolbar": "bg:#ff0000 #000000", +} diff --git a/.config/ranger/rc.conf b/.config/ranger/rc.conf index cacf0d6..dc9143a 100644 --- a/.config/ranger/rc.conf +++ b/.config/ranger/rc.conf @@ -150,7 +150,7 @@ set draw_progress_bar_in_status_bar true # Separators are vertical lines between columns. # Outline draws a box around all the columns. # Both combines the two. -set draw_borders none +set draw_borders both # Display the directory name in tabs? set dirname_in_tabs true @@ -169,7 +169,7 @@ set display_free_space_in_status_bar true set display_tags_in_all_columns true # Set a title for the window? -set update_title false +set update_title true # Set the title to "ranger" in the tmux program? set update_tmux_title true -- cgit v1.2.3