Skip to content

Commit

Permalink
first batch of dev environment backups
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewhively committed Sep 6, 2023
1 parent cb49320 commit 7a087b3
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 0 deletions.
15 changes: 15 additions & 0 deletions env_files/.inputrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## arrow up
"\e[A":history-search-backward
## arrow down
"\e[B":history-search-forward

#TODO: get these stupid commands to work instead
#"\e[A":history-substr-search-backward
#"\e[A":history-substring-search-up

#"\e[B":history-substr-search-forward
#"\e[B":history-substring-search-down

#NOTE: these commands may require additional installations GNU readline? install from homebrew using these steps: http://blogs.perl.org/users/aristotle/2013/07/easy-osx-termreadlinegnu.html
# Also need to have installed cpan before hand (type "cpan" to begin)
# And then install cpanm (sudo cpan App::cpanminus)
32 changes: 32 additions & 0 deletions env_files/.irbrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
require 'rubygems'

# Some commonly used gemfiles
require 'awesome_print'
require 'json'
puts "Auto-required: awesome_print, json"
puts 'REM: use "_" to quickly reference the previous command output'

# turns on logging within ruby console
if ENV.include?('RAILS_ENV') && ENV["RAILS_ENV"] == 'development'
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.connection_pool.clear_reloadable_connections!
end

# To view source of:
# Rails.logger
# use:
# Rails.method(:logger).source
#
# https://stackoverflow.com/a/46966145/6716352
class Method
def source(limit=10)
file, line = source_location
if file && line
puts "#{file} (#{line-1}:#{line-1+limit})\n#{'-'*30}"
puts IO.readlines(file)[line-1,limit]
else
puts nil
end
end
end

89 changes: 89 additions & 0 deletions env_files/.vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
" NOTE: main vim config files here: /usr/share/vim/ DO NOT modify directly

" USEFUL http://nvie.com/posts/how-i-boosted-my-vim/
" USEFUL http://www.vim.org/scripts/script.php?script_id=302 << convert ANSI color codes into VIM color codes
" after it's installed use :AnsiEsc within vim to execute the script

if has("autocmd")
" remember where I was in a file
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif

" except for git commits
autocmd FileType gitcommit call setpos('.', [0, 1, 1, 0])
endif


" Turn on line#s and search highlighting
set ruler
set hlsearch

syntax on
" :scriptnames to view the currently loaded syntax files

" Set the syntax highlighting to scan from the top of the file
" this prevents syntax from breaking midway through complex files
" more info here => :help syn-sync
"syn sync fromstart
"syn sync minlines=50
" note: these may not work here because a language syntax file might set them, and that would be loaded after vimrc
"command :syntime to troubleshoot syntax highlighting slowness

" Note - syntax highlighting for html.erb files is fixed here:
" ~/.vim/after/syntax/html.vim

" Syntax folders
" ~/.vim/syntax/
" ~/.vim/after/syntax/
" /usr/share/vim/vim82/syntax/

" This might be interesting
" turn hybrid line numbers on
":set number relativenumber

" NOTE : installed https://github.com/chrisbra/vim-diff-enhanced plugin
" myers/default -- the default algo without the plugin
" minimal -- myers but TRY harder
" patience --
" histogram -- patience but faster
" TO change on the fly use :EnhancedDiff <algorithm>

if &diff
" we're in diff mode
"set diffopt+=iwhite
syntax off
" TODO: DO NOT set ignore whitespace for python files

" in theory this could work, but cannot get it to work: https://github.com/chrisbra/vim-diff-enhanced
endif

" turn off syntax highlight for README.md files
"au BufNewFile,BufRead * if expand('<afile>:e') !=? 'inc' | syntax enable | endif
autocmd BufRead,BufNewFile *.md set syntax=off

" shortcuts
command Q qall
command W wall

" convert tabs into spaces
set tabstop=2
set expandtab
" convert existing with :retab command

" Fix backspace so its not capped to start of the insert (for example)
set backspace=indent,eol,start

" space highlighting
hi NonText ctermfg=253
hi SpecialKey ctermfg=253
set listchars=tab:→\ ,eol:↲,nbsp:␣,space:•,extends:⟩,precedes:

"set list
" NOTE: don't have list on by default, because when copying out of vim, it'll grab the 'map character' instead of the original. Therefore the paste will be screwy

" Color demo
" :so ~/.vim/color_demo.vim

" Disable this garbage
" https://vim.fandom.com/wiki/Modeline_magic
set nomodeline

0 comments on commit 7a087b3

Please sign in to comment.