Commit graph

232 commits

Author SHA1 Message Date
1c5f02eb8f Make numbers and booleans stand out in vim 2020-03-04 11:42:30 +01:00
6e73dbea71 Change vim mapping for cycling line number style
<leader>r is used by plugins to run code, so better free it up.
2020-03-04 11:42:23 +01:00
b437ad60bf Improve vim window navigation
I use windows much more than tabs, so it makes sense to make window
navigation more convenient.
2020-03-04 11:42:23 +01:00
ca73637add Auto reload vimrc on save 2020-03-04 11:42:22 +01:00
fc5db841e3 Clean up globals() for python interactive sessions
Previously the global namespace of all interactive python session were
polluted with all the stuff we did in this initialization script. For
example, globals()['__doc__'] would show the docstring from this file.

While none of this was ciritical, it could be confusing sometimes. So
this commit fixes that.
2020-02-26 16:49:01 +01:00
c0b024974a Fix PATH manipulation bug in bash profile
This bug caused entries to not be removed if they were already present
in the beginning of the list before being prepended. This could lead to
duplication of entires, usually this ended up being /usr/local/bin.
2020-02-21 11:03:59 +01:00
77cd259e28 Change polaris ssh ports
Since the old ports I was using are now no longer accessible from work,
I had to change to the following:

    - 143/imap for SSH logins and tunneling
    - 587/smtp for access to git repos over SSH

Hopefully these ports will stay open because they are common services.
2020-02-19 12:05:32 +01:00
7b4ed26e21 Fix mapping conflict in vimrc for <leader>r
Now <leader>r only cylces through types of line numbering.
2020-01-30 19:31:35 +01:00
ea74eca230 Remove kj binding to exit Insert mode in vim
The timeout every time I ended a word with k was annoying me. So there
aren't really any words that end in j and one mapping for this is
enough.
2020-01-30 19:23:20 +01:00
773c2142b2 Use default behavior for CtrlP working directory
The default value is:
  let g:ctrlp_working_path_mode = 'ra'

which means:
  a - like "c", but only applies when the current working directory outside of
      CtrlP isn't a direct ancestor of the directory of the current file.
  r - the nearest ancestor that contains one of these directories or files:
      .git .hg .svn .bzr _darcs

So this makes it more convenient to work within repositories, which is
what I mostly do anyway.
2020-01-30 19:20:58 +01:00
e0fb9191e5 Emulate AltGr via Ctrl + Alt in mintty 2020-01-30 19:17:54 +01:00
f65c4858ab Add support for per-user bash completion files 2019-11-13 14:42:07 +01:00
4e9c8e8470 Ensure PATH directories are in correct order
Previously we only checked if the new directory was already in the PATH
and, if yes, didn't prepend it. This can cause the new directory to be
in an unexpected position.

Now we first remove any occurrences of the new directory (to prevent
duplication) and prepend it so it's in the position we expect.
2019-11-11 13:04:25 +01:00
10ad8282e2 Fix glob for bash completions 2019-11-11 11:43:53 +01:00
b8c257ff9b Shorten unnecessarily long parts 2019-11-11 11:37:11 +01:00
d5245eab46 Keep installation prefix in the environment 2019-11-11 11:20:24 +01:00
a49fe75566 Refactor bash PROMPT_COMMAND function
Two main changes:
    - avoid 2 additional fork() calls by evaluating \j instead of using
      $(jobs | wc -l) -> one fork for subshell and another for `wc`.
    - make the build up of the prompt a bit more modular by using an
      array to collect the pieces and "sort of" join them in the end.
2019-11-08 13:38:28 +01:00
a9e50f2ba8 Call __git_ps1 as function instead of command substitution
This results in a slightly faster prompt because it saves us one fork()
call for the subshell that now doesn't have to be instantiated.
2019-11-08 10:44:59 +01:00
7243dc02b3 Minor refactoring
Just renaming last_status to exit because the latter is a more common
term.
2019-11-08 10:33:17 +01:00
f178b0c3cf Fix sourcing of local bash configuration 2019-11-08 10:03:22 +01:00
907eb892de Improve bash prompt speed
Avoiding starting many processes during creation of the PS1 string makes
the shell much more responsive, especially under Cygwin, which has
problems with fork().
2019-11-08 09:22:42 +01:00
c5baba5f5f Another useful alias for getting IP information
Also use -s flag in curl so we don't get progress bars.
2019-11-03 03:27:14 +01:00
d053c5c82c bashrc aliases for better head & tail 2019-11-03 03:22:12 +01:00
5bbbfb0632 Replace ~/.python_history with $XDG_CACHE_HOME/python/history 2019-11-03 02:52:18 +01:00
a3c3bcf1d6 Add a python startup file for interactive sessions
This is a preparation to move the .python_history file into an XDG
directory -> $XDG_CACHE_HOME/python/history
2019-11-03 02:27:29 +01:00
f7a498dbb7 Use XDG Base Directory Specification
SSH is an exception because there seems to be no good way of supporting
XDG. Patience, I guess...
2019-11-03 01:53:27 +01:00
16cd08905e Improve readability of if statements in bashrc 2019-11-01 01:58:53 +01:00
3a90bdad1f Fixes based on shellcheck output 2019-11-01 01:53:14 +01:00
2d468f2070 Better python virtual env in bash prompt 2019-11-01 00:45:59 +01:00
c69f179c88 Better job reporting in bash prompt 2019-11-01 00:34:49 +01:00
11c60060db Further bash prompt improvements 2019-11-01 00:29:38 +01:00
8908b16f72 Improvements to mintty options 2019-10-31 19:53:27 +01:00
d8e97c7c2c Fix setting the terminal palette under tmux 2019-10-31 19:52:22 +01:00
ca131bb775 Formatting tweaks to bashrc 2019-10-31 19:51:53 +01:00
ea55d530cf Fix display of background jobs in bash prompt 2019-10-31 03:15:56 +01:00
3b3e080335 Fix exit code of last command in bash prompt 2019-10-31 03:15:14 +01:00
ea58023c79 Fix colorized man to use tput 2019-10-31 03:08:07 +01:00
c04175aa85 Use tput to set terminal colors 2019-10-31 02:36:02 +01:00
5319e2de68 Remove bashrc prefix from functions 2019-10-31 01:44:07 +01:00
616b026f4a Fix terminal palette customization 2019-10-31 01:39:30 +01:00
0ed0677dc8 Minor tweaks to setting bash prompt 2019-10-30 20:19:02 +01:00
7384c7730b Clean up bash variables after use
Plus some minor visual tweaks on .bashrc
2019-10-30 20:07:18 +01:00
3c6d6c695b Improve colorized man
The previous solution worked fine for coloring the man pages but the
display in bash's job control was a disaster:

    $ man sshd_config   # followed by CTRL-z
    $ jobs
    [1]+  Stopped                 env LESS_TERMCAP_so=$(echo
    -ne"\033[${standout}m") LESS_TERMCAP_md=$(echo -ne "\033[${bold}m")
    LESS_TERMCAP_us=$(echo -ne "\033[${underline}m") LESS_TERMCAP_se=''
    LESS_TERMCAP_me='' LESS_TERMCAP_ue='' GROFF_NO_SGR=1 man sshd_config

The new solution behaves identically regarding coloring the man pages
but the job control information is much more useful:

    $ man sshd_config   # followed by CTRL-z
    $ jobs
    [1]+  Stopped                 man sshd_config
2019-10-30 19:54:29 +01:00
2c37d63937 Simplify tree improvements 2019-10-30 19:50:45 +01:00
4d1f7305ee Refactor terminal customization for readability 2019-10-30 18:43:49 +01:00
cce6134b94 Refactor .bashrc so we don't define so many functions 2019-10-30 17:30:36 +01:00
51ff9f8fdd Add background jobs to bash prompt 2019-10-29 23:40:18 +01:00
5af3c5ac0d Remove unnecessary loop when setting bash shopt 2019-10-29 23:07:31 +01:00
b06ab834a5 Make bash output redirection safer 2019-10-29 22:51:27 +01:00
afa328fc06 Remove bashrc support for Apple Terminal
I find myself never really using it...
2019-10-29 20:31:35 +01:00