Update to more recent Ansible roles

This commit is contained in:
Shaun Reed 2020-11-25 11:38:20 +00:00
parent 96182bb06a
commit 59d482cad7
47 changed files with 2970 additions and 38 deletions

View File

@ -1,8 +1,16 @@
---
packages: [git, vim, ssh, libpam-yubico]
packages: [python-apt, git, vim, ssh, libpam-yubico, ranger]
authusers: [user1, user2]
ssh_port: 22
auth_methods: "publickey,keyboard-interactive"
git_email: "email@domain.com"
git_email: "someemail@gmail.com"
git_name: "Shaun Reed"
vim_plugins: [{ repo: 'dense-analysis/ale', dest: 'ale'},
{ repo: 'chrisbra/Colorizer', dest: 'colorizer'},
{ repo: 'ervandew/supertab', dest: 'supertab'},
{ repo: 'chrisbra/unicode.vim', dest: 'unicode'},
{ repo: 'vim-airline/vim-airline', dest: 'vim-airline'},
{ repo: 'vim-airline/vim-airline-themes', dest: 'vim-airline-themes'},
{ repo: 'mhinz/vim-signify', dest: 'signify'}
]
upgrades_email: someemail@gmail.com

View File

@ -18,3 +18,5 @@ alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo
export LS_COLORS="di=1;34:ln=31;47:so=32:pi=33:ex=1;32:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43"
export EDITOR=vim
export VISUAL=vim
export PATH=$PATH:/opt/

View File

@ -0,0 +1,154 @@
" Single-quote is a comment written to be read
" Double-quotes are commented out code and can be removed or added
" General Vim Settings
" Define function in vim to remove whitespace
fun! TrimWhitespace()
let l:save = winsaveview()
keeppatterns %s/\s\+$//e
call winrestview(l:save)
endfun
"Call this on every attempt to save a file of types defined below..
autocmd BufWritePre *.cpp,*.h,*.c,*.php :call TrimWhitespace()
""autocmd BufWritePre *.cpp,*.h,*.c,*.php :%s/\s\+$//ge
" Set terminal title when opening file
"" autocmd BufEnter * let &titlestring = ' ' . expand("%:t")
"" set title
" Set tabwidth=2, adjust Vim shiftwidth to the same
set tabstop=2 shiftwidth=2
" expandtab inserts spaces instead of tabs
set expandtab
" autindent inserts the next line at your current depth
set autoindent
" mouse=a allows for mouse interaction with vim when supported
set mouse=a
set number
" Use Powerline symbols
""let g:airline_powerline_fonts = 1
" Enable Syntax Highlighting in Vim
syntax on
" Use Sourcerer color scheme by Xero
colorscheme sourcerer
" Fix plugin compatibility issues
set nocp
" Allow backspace to remove all types of characters
set backspace=indent,eol,start
" Custom Vim Keybindings
" nnoremap <C-e> <C-w> " Modify and remove leading quotation
" CPP Compile
""autocmd FileType cpp nmap <buffer> <F5> :w<bar>!g++ -o %:r % && ./%:r<CR>
" Set window jump to custom binding
" default Ctrl-W conflict - closes browser tabs
nnoremap <C-e> <C-w>
nnoremap <C-b> :!make -C build/
" Vim Plugin Settings
" set rtp+=/path/to/rtp/that/included/pathogen/vim " if needed
" Enable Pathogen plugin manager
execute pathogen#infect()
filetype plugin indent on
" Set Vim Airline theme
" base16 soda base16_pop laederon night_owl kalisi* ayu_mirage* raven
let g:airline_theme='kalisi'
" Gitgutter installed for + - diffs in gutters within repo files
" Ale linter settings
" Hover detail info in preview window
let g:ale_hover_to_preview = 1
" Hover detail info in balloons
""let g:ale_set_balloons = 1
let g:ale_sign_error = ''
let g:ale_sign_warning = ''
highlight ALEWarningSign ctermbg=Yellow
highlight ALEWarningSign ctermfg=Black
highlight ALEWarning ctermbg=DarkYellow
highlight ALEWarning ctermfg=White
highlight ALEErrorSign ctermbg=DarkRed
highlight ALEErrorSign ctermfg=White
highlight ALEError ctermfg=DarkRed
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
nmap <silent> <C-j> <Plug>(ale_next_wrap)
" Syntastic syntax checker settings
" See :help syntastic
""set statusline+=%#warningmsg#
""set statusline+=%{SyntasticStatuslineFlag()}
""set statusline+=%*
""let g:syntastic_always_populate_loc_list = 1
""let g:syntastic_auto_loc_list = 1
""let g:syntastic_check_on_open = 1
""let g:syntastic_check_on_wq = 0
" Clang_complete settings
""let g:clang_library_path='/usr/lib/llvm-8/lib/'
" Understand how the plugin works: :h signify-modus-operandi
" Spare the plugin some work and read: :h g:signify_vcs_list
" Signify plugin settings
" Diff gutter within Vim
"" let g:signify_vcs_list = ['git', 'hg']
"" let g:signify_cursorhold_insert = 1
"" let g:signify_cursorhold_normal = 1
"" let g:signify_update_on_bufenter = 0
"" let g:signify_update_on_focusgained = 1
"
" Colorizer plugin settings
" See :h colorizer in Vim for more info
""let g:colorizer_colornames = 0 " Don't color literal names, like red, green, etc
let g:colorizer_auto_color = 1
""let g:colorizer_skip_comments = 1
""let g:colorizer_auto_filetype ='css,html,vim'
nnoremap <C-c> :ColorToggle<CR>
" Symbols important to vim / terminal layouts
set termencoding=utf-8
set encoding=utf-8
" air-line
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = '␤'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'
" airline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''

View File

@ -0,0 +1,91 @@
// Automatically upgrade packages from these (origin:archive) pairs
//
// Note that in Ubuntu security updates may pull in new dependencies
// from non-security sources (e.g. chromium). By allowing the release
// pocket these get automatically pulled in.
Unattended-Upgrade::Allowed-Origins {
"${distro_id}:${distro_codename}";
"${distro_id}:${distro_codename}-security";
// Extended Security Maintenance; doesn't necessarily exist for
// every release and this system may not have it installed, but if
// available, the policy for updates is such that unattended-upgrades
// should also install from here by default.
"${distro_id}ESM:${distro_codename}";
"${distro_id}:${distro_codename}-updates";
// "${distro_id}:${distro_codename}-proposed";
// "${distro_id}:${distro_codename}-backports";
};
// List of packages to not update (regexp are supported)
Unattended-Upgrade::Package-Blacklist {
// "vim";
// "libc6";
// "libc6-dev";
// "libc6-i686";
};
// This option will controls whether the development release of Ubuntu will be
// upgraded automatically.
Unattended-Upgrade::DevRelease "false";
// This option allows you to control if on a unclean dpkg exit
// unattended-upgrades will automatically run
// dpkg --force-confold --configure -a
// The default is true, to ensure updates keep getting installed
//Unattended-Upgrade::AutoFixInterruptedDpkg "false";
// Split the upgrade into the smallest possible chunks so that
// they can be interrupted with SIGTERM. This makes the upgrade
// a bit slower but it has the benefit that shutdown while a upgrade
// is running is possible (with a small delay)
//Unattended-Upgrade::MinimalSteps "false";
// Install all unattended-upgrades when the machine is shutting down
// instead of doing it in the background while the machine is running
// This will (obviously) make shutdown slower
//Unattended-Upgrade::InstallOnShutdown "true";
// Send email to this address for problems or packages upgrades
// If empty or unset then no email is sent, make sure that you
// have a working mail setup on your system. A package that provides
// 'mailx' must be installed. E.g. "user@example.com"
Unattended-Upgrade::Mail "{{ upgrades_email }}";
// Set this value to "true" to get emails only on errors. Default
// is to always send a mail if Unattended-Upgrade::Mail is set
//Unattended-Upgrade::MailOnlyOnError "true";
// Remove unused automatically installed kernel-related packages
// (kernel images, kernel headers and kernel version locked tools).
Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";
// Do automatic removal of new unused dependencies after the upgrade
// (equivalent to apt-get autoremove)
Unattended-Upgrade::Remove-Unused-Dependencies "true";
// Automatically reboot *WITHOUT CONFIRMATION*
// if the file /var/run/reboot-required is found after the upgrade
//Unattended-Upgrade::Automatic-Reboot "false";
// If automatic reboot is enabled and needed, reboot at the specific
// time instead of immediately
// Default: "now"
//Unattended-Upgrade::Automatic-Reboot-Time "02:00";
// Use apt bandwidth limit feature, this example limits the download
// speed to 70kb/sec
//Acquire::http::Dl-Limit "70";
// Enable logging to syslog. Default is False
// Unattended-Upgrade::SyslogEnable "false";
// Specify syslog facility. Default is daemon
// Unattended-Upgrade::SyslogFacility "daemon";
// Download and install upgrades only on AC power
// (i.e. skip or gracefully stop updates on battery)
// Unattended-Upgrade::OnlyOnACPower "true";
// Download and install upgrades only on non-metered connection
// (i.e. skip or gracefully stop updates on a metered connection)
// Unattended-Upgrade::Skip-Updates-On-Metered-Connections "true";

View File

@ -0,0 +1,32 @@
#!/bin/bash
## Author: Shaun Reed | Contact: shaunrd0@gmail.com | URL: www.shaunreed.com ##
## A custom bash script for creating new linux users. ##
## Syntax: ./adduser.sh <username> <userID> ##
###############################################################################
if [ "$#" -ne 2 ]; then
printf "Illegal number of parameters."
printf "\nUsage: sudo ./adduser.sh <username> <groupid>"
printf "\n\nAvailable groupd IDs:"
printf "\n60001......61183 Unused | 65520...............65533 Unused"
printf "\n65536.....524287 Unused | 1879048191.....2147483647 Unused\n"
exit
fi
sudo adduser $1 --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password --uid $2
printf "\nEnter 1 if $1 should have sudo privileges. Any other value will continue and make no changes\n"
read choice
if [ $choice -eq 1 ] ; then
printf "\nConfiguring sudo for $1...\n"
sudo usermod -G sudo $1
fi
printf "\nEnter 1 to set a password for $1, any other value will exit with no password set\n"
read choice
if [ $choice -eq 1 ] ; then
printf "\nChanging password for $1...\n"
sudo passwd $1
fi

View File

@ -0,0 +1 @@
user:cccckey1cccc:cccckey2cccc

View File

@ -2,7 +2,7 @@
*
{{ ansible_hostname }} |.===. {{ ansible_fqdn }}
|.===.
{}o o{}
----------------------ooO--(_)--Ooo--------------------------
# #

View File

@ -0,0 +1,264 @@
" pathogen.vim - path option manipulation
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 2.4
" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
"
" For management of individually installed plugins in ~/.vim/bundle (or
" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your
" .vimrc is the only other setup necessary.
"
" The API is documented inline below.
if exists("g:loaded_pathogen") || &cp
finish
endif
let g:loaded_pathogen = 1
" Point of entry for basic default usage. Give a relative path to invoke
" pathogen#interpose() or an absolute path to invoke pathogen#surround().
" Curly braces are expanded with pathogen#expand(): "bundle/{}" finds all
" subdirectories inside "bundle" inside all directories in the runtime path.
" If no arguments are given, defaults "bundle/{}", and also "pack/{}/start/{}"
" on versions of Vim without native package support.
function! pathogen#infect(...) abort
if a:0
let paths = filter(reverse(copy(a:000)), 'type(v:val) == type("")')
else
let paths = ['bundle/{}', 'pack/{}/start/{}']
endif
if has('packages')
call filter(paths, 'v:val !~# "^pack/[^/]*/start/[^/]*$"')
endif
let static = '^\%([$~\\/]\|\w:[\\/]\)[^{}*]*$'
for path in filter(copy(paths), 'v:val =~# static')
call pathogen#surround(path)
endfor
for path in filter(copy(paths), 'v:val !~# static')
if path =~# '^\%([$~\\/]\|\w:[\\/]\)'
call pathogen#surround(path)
else
call pathogen#interpose(path)
endif
endfor
call pathogen#cycle_filetype()
if pathogen#is_disabled($MYVIMRC)
return 'finish'
endif
return ''
endfunction
" Split a path into a list.
function! pathogen#split(path) abort
if type(a:path) == type([]) | return a:path | endif
if empty(a:path) | return [] | endif
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
endfunction
" Convert a list to a path.
function! pathogen#join(...) abort
if type(a:1) == type(1) && a:1
let i = 1
let space = ' '
else
let i = 0
let space = ''
endif
let path = ""
while i < a:0
if type(a:000[i]) == type([])
let list = a:000[i]
let j = 0
while j < len(list)
let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
let path .= ',' . escaped
let j += 1
endwhile
else
let path .= "," . a:000[i]
endif
let i += 1
endwhile
return substitute(path,'^,','','')
endfunction
" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
function! pathogen#legacyjoin(...) abort
return call('pathogen#join',[1] + a:000)
endfunction
" Turn filetype detection off and back on again if it was already enabled.
function! pathogen#cycle_filetype() abort
if exists('g:did_load_filetypes')
filetype off
filetype on
endif
endfunction
" Check if a bundle is disabled. A bundle is considered disabled if its
" basename or full name is included in the list g:pathogen_blacklist or the
" comma delimited environment variable $VIMBLACKLIST.
function! pathogen#is_disabled(path) abort
if a:path =~# '\~$'
return 1
endif
let sep = pathogen#slash()
let blacklist = get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) + pathogen#split($VIMBLACKLIST)
if !empty(blacklist)
call map(blacklist, 'substitute(v:val, "[\\/]$", "", "")')
endif
return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1
endfunction
" Prepend the given directory to the runtime path and append its corresponding
" after directory. Curly braces are expanded with pathogen#expand().
function! pathogen#surround(path) abort
let sep = pathogen#slash()
let rtp = pathogen#split(&rtp)
let path = fnamemodify(a:path, ':s?[\\/]\=$??')
let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)')
let after = filter(reverse(pathogen#expand(path, sep.'after')), '!pathogen#is_disabled(v:val[0:-7])')
call filter(rtp, 'index(before + after, v:val) == -1')
let &rtp = pathogen#join(before, rtp, after)
return &rtp
endfunction
" For each directory in the runtime path, add a second entry with the given
" argument appended. Curly braces are expanded with pathogen#expand().
function! pathogen#interpose(name) abort
let sep = pathogen#slash()
let name = a:name
if has_key(s:done_bundles, name)
return ""
endif
let s:done_bundles[name] = 1
let list = []
for dir in pathogen#split(&rtp)
if dir =~# '\<after$'
let list += reverse(filter(pathogen#expand(dir[0:-6].name, sep.'after'), '!pathogen#is_disabled(v:val[0:-7])')) + [dir]
else
let list += [dir] + filter(pathogen#expand(dir.sep.name), '!pathogen#is_disabled(v:val)')
endif
endfor
let &rtp = pathogen#join(pathogen#uniq(list))
return 1
endfunction
let s:done_bundles = {}
" Invoke :helptags on all non-$VIM doc directories in runtimepath.
function! pathogen#helptags() abort
let sep = pathogen#slash()
for glob in pathogen#split(&rtp)
for dir in map(split(glob(glob), "\n"), 'v:val.sep."/doc/".sep')
if (dir)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir) == 2 && !empty(split(glob(dir.'*.txt'))) && (!filereadable(dir.'tags') || filewritable(dir.'tags'))
silent! execute 'helptags' pathogen#fnameescape(dir)
endif
endfor
endfor
endfunction
command! -bar Helptags :call pathogen#helptags()
" Execute the given command. This is basically a backdoor for --remote-expr.
function! pathogen#execute(...) abort
for command in a:000
execute command
endfor
return ''
endfunction
" Section: Unofficial
function! pathogen#is_absolute(path) abort
return a:path =~# (has('win32') ? '^\%([\\/]\|\w:\)[\\/]\|^[~$]' : '^[/~$]')
endfunction
" Given a string, returns all possible permutations of comma delimited braced
" alternatives of that string. pathogen#expand('/{a,b}/{c,d}') yields
" ['/a/c', '/a/d', '/b/c', '/b/d']. Empty braces are treated as a wildcard
" and globbed. Actual globs are preserved.
function! pathogen#expand(pattern, ...) abort
let after = a:0 ? a:1 : ''
let pattern = substitute(a:pattern, '^[~$][^\/]*', '\=expand(submatch(0))', '')
if pattern =~# '{[^{}]\+}'
let [pre, pat, post] = split(substitute(pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1)
let found = map(split(pat, ',', 1), 'pre.v:val.post')
let results = []
for pattern in found
call extend(results, pathogen#expand(pattern))
endfor
elseif pattern =~# '{}'
let pat = matchstr(pattern, '^.*{}[^*]*\%($\|[\\/]\)')
let post = pattern[strlen(pat) : -1]
let results = map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post')
else
let results = [pattern]
endif
let vf = pathogen#slash() . 'vimfiles'
call map(results, 'v:val =~# "\\*" ? v:val.after : isdirectory(v:val.vf.after) ? v:val.vf.after : isdirectory(v:val.after) ? v:val.after : ""')
return filter(results, '!empty(v:val)')
endfunction
" \ on Windows unless shellslash is set, / everywhere else.
function! pathogen#slash() abort
return !exists("+shellslash") || &shellslash ? '/' : '\'
endfunction
function! pathogen#separator() abort
return pathogen#slash()
endfunction
" Convenience wrapper around glob() which returns a list.
function! pathogen#glob(pattern) abort
let files = split(glob(a:pattern),"\n")
return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")')
endfunction
" Like pathogen#glob(), only limit the results to directories.
function! pathogen#glob_directories(pattern) abort
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
endfunction
" Remove duplicates from a list.
function! pathogen#uniq(list) abort
let i = 0
let seen = {}
while i < len(a:list)
if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i])
call remove(a:list,i)
elseif a:list[i] ==# ''
let i += 1
let empty = 1
else
let seen[a:list[i]] = 1
let i += 1
endif
endwhile
return a:list
endfunction
" Backport of fnameescape().
function! pathogen#fnameescape(string) abort
if exists('*fnameescape')
return fnameescape(a:string)
elseif a:string ==# '-'
return '\-'
else
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
endif
endfunction
" Like findfile(), but hardcoded to use the runtimepath.
function! pathogen#runtime_findfile(file,count) abort
let rtp = pathogen#join(1,pathogen#split(&rtp))
let file = findfile(a:file,rtp,a:count)
if file ==# ''
return ''
else
return fnamemodify(file,':p')
endif
endfunction
" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':

Binary file not shown.

View File

@ -0,0 +1,322 @@
#!/usr/bin/python
# coding=UTF-8
# These glyphs, and the mapping of file extensions to glyphs
# has been copied from the vimscript code that is present in
# https://github.com/ryanoasis/vim-devicons
import re;
import os;
# all those glyphs will show as weird squares if you don't have the correct patched font
# My advice is to use NerdFonts which can be found here:
# https://github.com/ryanoasis/nerd-fonts
file_node_extensions = {
'7z' : '',
'a' : '',
'ai' : '',
'apk' : '',
'asm' : '',
'asp' : '',
'aup' : '',
'avi' : '',
'bat' : '',
'bmp' : '',
'bz2' : '',
'c' : '',
'c++' : '',
'cab' : '',
'cbr' : '',
'cbz' : '',
'cc' : '',
'class' : '',
'clj' : '',
'cljc' : '',
'cljs' : '',
'cmake' : '',
'coffee' : '',
'conf' : '',
'cp' : '',
'cpio' : '',
'cpp' : '',
'cs' : '',
'css' : '',
'cue' : '',
'cvs' : '',
'cxx' : '',
'd' : '',
'dart' : '',
'db' : '',
'deb' : '',
'diff' : '',
'dll' : '',
'doc' : '',
'docx' : '',
'dump' : '',
'edn' : '',
'efi' : '',
'ejs' : '',
'elf' : '',
'elm' : '',
'epub' : '',
'erl' : '',
'ex' : '',
'exe' : '',
'exs' : '',
'eex' : '',
'f#' : '',
'fifo' : '|',
'fish' : '',
'flac' : '',
'flv' : '',
'fs' : '',
'fsi' : '',
'fsscript' : '',
'fsx' : '',
'gem' : '',
'gif' : '',
'go' : '',
'gz' : '',
'gzip' : '',
'h' : '',
'hbs' : '',
'hrl' : '',
'hs' : '',
'htaccess' : '',
'htpasswd' : '',
'htm' : '',
'html' : '',
'ico' : '',
'img' : '',
'ini' : '',
'iso' : '',
'jar' : '',
'java' : '',
'jl' : '',
'jpeg' : '',
'jpg' : '',
'js' : '',
'json' : '',
'jsx' : '',
'key' : '',
'less' : '',
'lha' : '',
'lhs' : '',
'log' : '',
'lua' : '',
'lzh' : '',
'lzma' : '',
'm4a' : '',
'm4v' : '',
'markdown' : '',
'md' : '',
'mkv' : '',
'ml' : 'λ',
'mli' : 'λ',
'mov' : '',
'mp3' : '',
'mp4' : '',
'mpeg' : '',
'mpg' : '',
'msi' : '',
'mustache' : '',
'o' : '',
'ogg' : '',
'pdf' : '',
'php' : '',
'pl' : '',
'pm' : '',
'png' : '',
'pub' : '',
'ppt' : '',
'pptx' : '',
'psb' : '',
'psd' : '',
'py' : '',
'pyc' : '',
'pyd' : '',
'pyo' : '',
'rar' : '',
'rb' : '',
'rc' : '',
'rlib' : '',
'rom' : '',
'rpm' : '',
'rs' : '',
'rss' : '',
'rtf' : '',
's' : '',
'so' : '',
'scala' : '',
'scss' : '',
'sh' : '',
'slim' : '',
'sln' : '',
'sql' : '',
'styl' : '',
'suo' : '',
't' : '',
'tar' : '',
'tgz' : '',
'ts' : '',
'twig' : '',
'vim' : '',
'vimrc' : '',
'wav' : '',
'webm' : '',
'xbps' : '',
'xhtml' : '',
'xls' : '',
'xlsx' : '',
'xml' : '',
'xul' : '',
'xz' : '',
'yaml' : '',
'yml' : '',
'zip' : '',
}
dir_node_exact_matches = {
# English
'.git' : '',
'Desktop' : '',
'Documents' : '',
'Downloads' : '',
'Dotfiles' : '',
'Dropbox' : '',
'Music' : '',
'Pictures' : '',
'Public' : '',
'Templates' : '',
'Videos' : '',
# Spanish
'Escritorio' : '',
'Documentos' : '',
'Descargas' : '',
'Música' : '',
'Imágenes' : '',
'Público' : '',
'Plantillas' : '',
'Vídeos' : '',
# French
'Bureau' : '',
'Documents' : '',
'Images' : '',
'Musique' : '',
'Publique' : '',
'Téléchargements' : '',
'Vidéos' : '',
# Portuguese
'Documentos' : '',
'Imagens' : '',
'Modelos' : '',
'Música' : '',
'Público' : '',
'Vídeos' : '',
'Área de trabalho' : '',
# Italian
'Documenti' : '',
'Immagini' : '',
'Modelli' : '',
'Musica' : '',
'Pubblici' : '',
'Scaricati' : '',
'Scrivania' : '',
'Video' : '',
# German
'Bilder' : '',
'Dokumente' : '',
'Musik' : '',
'Schreibtisch' : '',
'Vorlagen' : '',
'Öffentlich' : '',
# Hungarian
'Dokumentumok' : '',
'Képek' : '',
'Modelli' : '',
'Zene' : '',
'Letöltések' : '',
'Számítógép' : '',
'Videók' : '',
}
file_node_exact_matches = {
'.Xauthority' : '',
'.Xdefaults' : '',
'.Xresources' : '',
'.bash_aliases' : '',
'.bashprofile' : '',
'.bash_profile' : '',
'.bash_logout' : '',
'.bash_history' : '',
'.bashrc' : '',
'.dmrc' : '',
'.DS_Store' : '',
'.fasd' : '',
'.fehbg' : '',
'.gitconfig' : '',
'.gitattributes' : '',
'.gitignore' : '',
'.inputrc' : '',
'.jack-settings' : '',
'.mime.types' : '',
'.nvidia-settings-rc' : '',
'.pam_environment' : '',
'.profile' : '',
'.recently-used' : '',
'.selected_editor' : '',
'.vim' : '',
'.vimrc' : '',
'.viminfo' : '',
'.xinitrc' : '',
'.xinputrc' : '',
'config' : '',
'Dockerfile' : '',
'docker-compose.yml' : '',
'dropbox' : '',
'exact-match-case-sensitive-1.txt' : 'X1',
'exact-match-case-sensitive-2' : 'X2',
'favicon.ico' : '',
'a.out' : '',
'bspwmrc' : '',
'sxhkdrc' : '',
'Makefile' : '',
'Makefile.in' : '',
'Makefile.ac' : '',
'config.mk' : '',
'config.m4' : '',
'config.ac' : '',
'configure' : '',
'Rakefile' : '',
'gruntfile.coffee' : '',
'gruntfile.js' : '',
'gruntfile.ls' : '',
'gulpfile.coffee' : '',
'gulpfile.js' : '',
'gulpfile.ls' : '',
'ini' : '',
'ledger' : '',
'package.json' : '',
'package-lock.json' : '',
'.ncmpcpp' : '',
'playlists' : '',
'known_hosts' : '',
'authorized_keys' : '',
'license' : '',
'LICENSE.md' : '',
'LICENSE' : '',
'LICENSE.txt' : '',
'mimeapps.list' : '',
'node_modules' : '',
'procfile' : '',
'react.jsx' : '',
'README.rst' : '',
'README.md' : '',
'README.markdown' : '',
'README' : '',
'README.txt' : '',
'user-dirs.dirs' : '',
'webpack.config.js' : '',
}
def devicon(file):
if file.is_directory: return dir_node_exact_matches.get(file.relative_path, '')
return file_node_exact_matches.get(os.path.basename(file.relative_path), file_node_extensions.get(file.extension, ''))

Binary file not shown.

View File

@ -0,0 +1,19 @@
import ranger.api
from ranger.core.linemode import LinemodeBase
from .devicons import *
@ranger.api.register_linemode
class DevIconsLinemode(LinemodeBase):
name = "devicons"
uses_metadata = False
def filetitle(self, file, metadata):
return devicon(file) + ' ' + file.relative_path
@ranger.api.register_linemode
class DevIconsLinemodeFile(LinemodeBase):
name = "filename"
def filetitle(self, file, metadata):
return devicon(file) + ' ' + file.relative_path

View File

@ -0,0 +1,2 @@
*.pyc
.mypy_cache/

View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2014 Ryan L McIntyre
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,18 @@
RANGER_DIR=$(if $(XDG_CONFIG_HOME),$(XDG_CONFIG_HOME),$(HOME)/.config)/ranger
PLUGIN_DIR=$(RANGER_DIR)/plugins
RC_FILE=$(RANGER_DIR)/rc.conf
install:
install -d $(PLUGIN_DIR)
install -b devicons.py $(PLUGIN_DIR)/devicons.py
install -b __init__.py $(PLUGIN_DIR)/devicons_linemode.py
grep -q 'default_linemode devicons' $(RC_FILE) || echo '# a plugin that adds file glyphs / icon support to Ranger:' >> $(RC_FILE)
grep -q 'default_linemode devicons' $(RC_FILE) || echo '# https://github.com/alexanderjeurissen/ranger_devicons' >> $(RC_FILE)
grep -q 'default_linemode devicons' $(RC_FILE) || echo 'default_linemode devicons' >> $(RC_FILE)
uninstall:
sed -i.old -E '/^# a plugin that adds file glyphs/d' $(RC_FILE)
sed -i.old -E '/^# https:\/\/github.com\/alexanderjeurissen\/ranger_devicons/d' $(RC_FILE)
sed -i.old -E '/^default_linemode devicons/d' $(RC_FILE)
$(RM) $(PLUGIN_DIR)/devicons.py
$(RM) $(PLUGIN_DIR)/devicons_linemode.py

View File

@ -0,0 +1,26 @@
# File icons for the Ranger file manager
This plugin introduces a new linemode that prefixes file names with a file icon
![image](https://raw.githubusercontent.com/alexanderjeurissen/ranger_devicons/master/screenshot.png)
## Prerequisites
This plugin uses glyphs from a patched NERDfont. So in order for this plugin to work you need to
install a NERDfont and set it as the default font for your terminal.
I personally use the Source Code Pro patched NERDfont(this is also the font displayed in the
screenshot), this and other NERDfonts and the install instructions for these fonts can be found in
the following repository: https://github.com/ryanoasis/nerd-fonts
## Install instructions
### Stable method:
A makefile is included to install and uninstall this plugin. to install simply run:
`make install` and to uninstall the plugin run `make uninstall`.
### Experimental method:
Ranger has added support for loading directories in the plugins folder to `master` which makes it easier to install and keep plugins updated.
To install, just clone the repo into the plugins folder:
```bash
git clone https://github.com/alexanderjeurissen/ranger_devicons ~/.config/ranger/plugins/ranger_devicons
```
Then add `default_linemode devicons` to your `rc.conf`.

View File

@ -0,0 +1,19 @@
import ranger.api
from ranger.core.linemode import LinemodeBase
from .devicons import *
@ranger.api.register_linemode
class DevIconsLinemode(LinemodeBase):
name = "devicons"
uses_metadata = False
def filetitle(self, file, metadata):
return devicon(file) + ' ' + file.relative_path
@ranger.api.register_linemode
class DevIconsLinemodeFile(LinemodeBase):
name = "filename"
def filetitle(self, file, metadata):
return devicon(file) + ' ' + file.relative_path

View File

@ -0,0 +1,322 @@
#!/usr/bin/python
# coding=UTF-8
# These glyphs, and the mapping of file extensions to glyphs
# has been copied from the vimscript code that is present in
# https://github.com/ryanoasis/vim-devicons
import re;
import os;
# all those glyphs will show as weird squares if you don't have the correct patched font
# My advice is to use NerdFonts which can be found here:
# https://github.com/ryanoasis/nerd-fonts
file_node_extensions = {
'7z' : '',
'a' : '',
'ai' : '',
'apk' : '',
'asm' : '',
'asp' : '',
'aup' : '',
'avi' : '',
'bat' : '',
'bmp' : '',
'bz2' : '',
'c' : '',
'c++' : '',
'cab' : '',
'cbr' : '',
'cbz' : '',
'cc' : '',
'class' : '',
'clj' : '',
'cljc' : '',
'cljs' : '',
'cmake' : '',
'coffee' : '',
'conf' : '',
'cp' : '',
'cpio' : '',
'cpp' : '',
'cs' : '',
'css' : '',
'cue' : '',
'cvs' : '',
'cxx' : '',
'd' : '',
'dart' : '',
'db' : '',
'deb' : '',
'diff' : '',
'dll' : '',
'doc' : '',
'docx' : '',
'dump' : '',
'edn' : '',
'efi' : '',
'ejs' : '',
'elf' : '',
'elm' : '',
'epub' : '',
'erl' : '',
'ex' : '',
'exe' : '',
'exs' : '',
'eex' : '',
'f#' : '',
'fifo' : '|',
'fish' : '',
'flac' : '',
'flv' : '',
'fs' : '',
'fsi' : '',
'fsscript' : '',
'fsx' : '',
'gem' : '',
'gif' : '',
'go' : '',
'gz' : '',
'gzip' : '',
'h' : '',
'hbs' : '',
'hrl' : '',
'hs' : '',
'htaccess' : '',
'htpasswd' : '',
'htm' : '',
'html' : '',
'ico' : '',
'img' : '',
'ini' : '',
'iso' : '',
'jar' : '',
'java' : '',
'jl' : '',
'jpeg' : '',
'jpg' : '',
'js' : '',
'json' : '',
'jsx' : '',
'key' : '',
'less' : '',
'lha' : '',
'lhs' : '',
'log' : '',
'lua' : '',
'lzh' : '',
'lzma' : '',
'm4a' : '',
'm4v' : '',
'markdown' : '',
'md' : '',
'mkv' : '',
'ml' : 'λ',
'mli' : 'λ',
'mov' : '',
'mp3' : '',
'mp4' : '',
'mpeg' : '',
'mpg' : '',
'msi' : '',
'mustache' : '',
'o' : '',
'ogg' : '',
'pdf' : '',
'php' : '',
'pl' : '',
'pm' : '',
'png' : '',
'pub' : '',
'ppt' : '',
'pptx' : '',
'psb' : '',
'psd' : '',
'py' : '',
'pyc' : '',
'pyd' : '',
'pyo' : '',
'rar' : '',
'rb' : '',
'rc' : '',
'rlib' : '',
'rom' : '',
'rpm' : '',
'rs' : '',
'rss' : '',
'rtf' : '',
's' : '',
'so' : '',
'scala' : '',
'scss' : '',
'sh' : '',
'slim' : '',
'sln' : '',
'sql' : '',
'styl' : '',
'suo' : '',
't' : '',
'tar' : '',
'tgz' : '',
'ts' : '',
'twig' : '',
'vim' : '',
'vimrc' : '',
'wav' : '',
'webm' : '',
'xbps' : '',
'xhtml' : '',
'xls' : '',
'xlsx' : '',
'xml' : '',
'xul' : '',
'xz' : '',
'yaml' : '',
'yml' : '',
'zip' : '',
}
dir_node_exact_matches = {
# English
'.git' : '',
'Desktop' : '',
'Documents' : '',
'Downloads' : '',
'Dotfiles' : '',
'Dropbox' : '',
'Music' : '',
'Pictures' : '',
'Public' : '',
'Templates' : '',
'Videos' : '',
# Spanish
'Escritorio' : '',
'Documentos' : '',
'Descargas' : '',
'Música' : '',
'Imágenes' : '',
'Público' : '',
'Plantillas' : '',
'Vídeos' : '',
# French
'Bureau' : '',
'Documents' : '',
'Images' : '',
'Musique' : '',
'Publique' : '',
'Téléchargements' : '',
'Vidéos' : '',
# Portuguese
'Documentos' : '',
'Imagens' : '',
'Modelos' : '',
'Música' : '',
'Público' : '',
'Vídeos' : '',
'Área de trabalho' : '',
# Italian
'Documenti' : '',
'Immagini' : '',
'Modelli' : '',
'Musica' : '',
'Pubblici' : '',
'Scaricati' : '',
'Scrivania' : '',
'Video' : '',
# German
'Bilder' : '',
'Dokumente' : '',
'Musik' : '',
'Schreibtisch' : '',
'Vorlagen' : '',
'Öffentlich' : '',
# Hungarian
'Dokumentumok' : '',
'Képek' : '',
'Modelli' : '',
'Zene' : '',
'Letöltések' : '',
'Számítógép' : '',
'Videók' : '',
}
file_node_exact_matches = {
'.Xauthority' : '',
'.Xdefaults' : '',
'.Xresources' : '',
'.bash_aliases' : '',
'.bashprofile' : '',
'.bash_profile' : '',
'.bash_logout' : '',
'.bash_history' : '',
'.bashrc' : '',
'.dmrc' : '',
'.DS_Store' : '',
'.fasd' : '',
'.fehbg' : '',
'.gitconfig' : '',
'.gitattributes' : '',
'.gitignore' : '',
'.inputrc' : '',
'.jack-settings' : '',
'.mime.types' : '',
'.nvidia-settings-rc' : '',
'.pam_environment' : '',
'.profile' : '',
'.recently-used' : '',
'.selected_editor' : '',
'.vim' : '',
'.vimrc' : '',
'.viminfo' : '',
'.xinitrc' : '',
'.xinputrc' : '',
'config' : '',
'Dockerfile' : '',
'docker-compose.yml' : '',
'dropbox' : '',
'exact-match-case-sensitive-1.txt' : 'X1',
'exact-match-case-sensitive-2' : 'X2',
'favicon.ico' : '',
'a.out' : '',
'bspwmrc' : '',
'sxhkdrc' : '',
'Makefile' : '',
'Makefile.in' : '',
'Makefile.ac' : '',
'config.mk' : '',
'config.m4' : '',
'config.ac' : '',
'configure' : '',
'Rakefile' : '',
'gruntfile.coffee' : '',
'gruntfile.js' : '',
'gruntfile.ls' : '',
'gulpfile.coffee' : '',
'gulpfile.js' : '',
'gulpfile.ls' : '',
'ini' : '',
'ledger' : '',
'package.json' : '',
'package-lock.json' : '',
'.ncmpcpp' : '',
'playlists' : '',
'known_hosts' : '',
'authorized_keys' : '',
'license' : '',
'LICENSE.md' : '',
'LICENSE' : '',
'LICENSE.txt' : '',
'mimeapps.list' : '',
'node_modules' : '',
'procfile' : '',
'react.jsx' : '',
'README.rst' : '',
'README.md' : '',
'README.markdown' : '',
'README' : '',
'README.txt' : '',
'user-dirs.dirs' : '',
'webpack.config.js' : '',
}
def devicon(file):
if file.is_directory: return dir_node_exact_matches.get(file.relative_path, '')
return file_node_exact_matches.get(os.path.basename(file.relative_path), file_node_extensions.get(file.extension, ''))

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

View File

@ -0,0 +1,613 @@
# ===================================================================
# This file contains the default startup commands for ranger.
# To change them, it is recommended to create the file
# ~/.config/ranger/rc.conf and add your custom commands there.
#
# If you copy this whole file there, you may want to set the environment
# variable RANGER_LOAD_DEFAULT_RC to FALSE to avoid loading it twice.
#
# The purpose of this file is mainly to define keybindings and settings.
# For running more complex python code, please create a plugin in "plugins/" or
# a command in "commands.py".
#
# Each line is a command that will be run before the user interface
# is initialized. As a result, you can not use commands which rely
# on the UI such as :delete or :mark.
# ===================================================================
# ===================================================================
# == Options
# ===================================================================
# Which viewmode should be used? Possible values are:
# miller: Use miller columns which show multiple levels of the hierarchy
# multipane: Midnight-commander like multipane view showing all tabs next
# to each other
set viewmode miller
#set viewmode multipane
# How many columns are there, and what are their relative widths?
set column_ratios 1,3,4
# Which files should be hidden? (regular expression)
set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$
# Show hidden files? You can toggle this by typing 'zh'
set show_hidden true
# Ask for a confirmation when running the "delete" command?
# Valid values are "always", "never", "multiple" (default)
# With "multiple", ranger will ask only if you delete multiple files at once.
set confirm_on_delete multiple
# Which script is used to generate file previews?
# ranger ships with scope.sh, a script that calls external programs (see
# README.md for dependencies) to preview images, archives, etc.
set preview_script ~/.config/ranger/scope.sh
# Use the external preview script or display simple plain text or image previews?
set use_preview_script true
# Automatically count files in the directory, even before entering them?
set automatically_count_files true
# Open all images in this directory when running certain image viewers
# like feh or sxiv? You can still open selected files by marking them.
set open_all_images true
# Be aware of version control systems and display information.
set vcs_aware false
# State of the three backends git, hg, bzr. The possible states are
# disabled, local (only show local info), enabled (show local and remote
# information).
set vcs_backend_git enabled
set vcs_backend_hg disabled
set vcs_backend_bzr disabled
# Use one of the supported image preview protocols
set preview_images false
# Set the preview image method. Supported methods:
#
# * w3m (default):
# Preview images in full color with the external command "w3mimgpreview"?
# This requires the console web browser "w3m" and a supported terminal.
# It has been successfully tested with "xterm" and "urxvt" without tmux.
#
# * iterm2:
# Preview images in full color using iTerm2 image previews
# (http://iterm2.com/images.html). This requires using iTerm2 compiled
# with image preview support.
#
# * urxvt:
# Preview images in full color using urxvt image backgrounds. This
# requires using urxvt compiled with pixbuf support.
#
# * urxvt-full:
# The same as urxvt but utilizing not only the preview pane but the
# whole terminal window.
set preview_images_method w3m
# Use a unicode "..." character to mark cut-off filenames?
set unicode_ellipsis false
# Show dotfiles in the bookmark preview box?
set show_hidden_bookmarks true
# Which colorscheme to use? These colorschemes are available by default:
# default, jungle, snow, solarized
set colorscheme default
# Preview files on the rightmost column?
# And collapse (shrink) the last column if there is nothing to preview?
set preview_files true
set preview_directories true
set collapse_preview true
# Save the console history on exit?
set save_console_history true
# Draw the status bar on top of the browser window (default: bottom)
set status_bar_on_top false
# Draw a progress bar in the status bar which displays the average state of all
# currently running tasks which support progress bars?
set draw_progress_bar_in_status_bar true
# Draw borders around columns?
set draw_borders false
# Display the directory name in tabs?
set dirname_in_tabs false
# Enable the mouse support?
set mouse_enabled true
# Display the file size in the main column or status bar?
set display_size_in_main_column true
set display_size_in_status_bar true
# Display files tags in all columns or only in main column?
set display_tags_in_all_columns true
# Set a title for the window?
set update_title false
# Set the title to "ranger" in the tmux program?
set update_tmux_title false
# Shorten the title if it gets long? The number defines how many
# directories are displayed at once, 0 turns off this feature.
set shorten_title 3
# Abbreviate $HOME with ~ in the titlebar (first line) of ranger?
set tilde_in_titlebar false
# How many directory-changes or console-commands should be kept in history?
set max_history_size 20
set max_console_history_size 50
# Try to keep so much space between the top/bottom border when scrolling:
set scroll_offset 8
# Flush the input after each key hit? (Noticeable when ranger lags)
set flushinput true
# Padding on the right when there's no preview?
# This allows you to click into the space to run the file.
set padding_right true
# Save bookmarks (used with mX and `X) instantly?
# This helps to synchronize bookmarks between multiple ranger
# instances but leads to *slight* performance loss.
# When false, bookmarks are saved when ranger is exited.
set autosave_bookmarks true
# You can display the "real" cumulative size of directories by using the
# command :get_cumulative_size or typing "dc". The size is expensive to
# calculate and will not be updated automatically. You can choose
# to update it automatically though by turning on this option:
set autoupdate_cumulative_size false
# Turning this on makes sense for screen readers:
set show_cursor false
# One of: size, natural, basename, atime, ctime, mtime, type, random
set sort natural
# Additional sorting options
set sort_reverse false
set sort_case_insensitive true
set sort_directories_first true
set sort_unicode false
# Enable this if key combinations with the Alt Key don't work for you.
# (Especially on xterm)
set xterm_alt_key false
# Whether to include bookmarks in cd command
set cd_bookmarks true
# Avoid previewing files larger than this size, in bytes. Use a value of 0 to
# disable this feature.
set preview_max_size 0
# Add the highlighted file to the path in the titlebar
set show_selection_in_titlebar true
# The delay that ranger idly waits for user input, in milliseconds, with a
# resolution of 100ms. Lower delay reduces lag between directory updates but
# increases CPU load.
set idle_delay 2000
# When the metadata manager module looks for metadata, should it only look for
# a ".metadata.json" file in the current directory, or do a deep search and
# check all directories above the current one as well?
set metadata_deep_search false
# Clear all existing filters when leaving a directory
set clear_filters_on_dir_change false
# Disable displaying line numbers in main column
set line_numbers false
# ===================================================================
# == Local Options
# ===================================================================
# You can set local options that only affect a single directory.
# Examples:
# setlocal path=~/downloads sort mtime
# ===================================================================
# == Command Aliases in the Console
# ===================================================================
alias e edit
alias q quit
alias q! quitall
alias qa quitall
alias qall quitall
alias setl setlocal
alias filter scout -prt
alias find scout -aeit
alias mark scout -mr
alias unmark scout -Mr
alias search scout -rs
alias search_inc scout -rts
alias travel scout -aefiklst
# ===================================================================
# == Define keys for the browser
# ===================================================================
# Basic
map Q quit!
map q quit
copymap q ZZ ZQ
map R reload_cwd
map <C-r> reset
map <C-l> redraw_window
map <C-c> abort
map <esc> change_mode normal
map ~ set viewmode!
map i display_file
map ? help
map W display_log
map w taskview_open
map S shell $SHELL
map : console
map ; console
map ! console shell%space
map @ console -p6 shell %%s
map # console shell -p%space
map s console shell%space
map r chain draw_possible_programs; console open_with%%space
map f console find%space
map cd console cd%space
# Change the line mode
map Mf linemode filename
map Mi linemode fileinfo
map Mm linemode mtime
map Mp linemode permissions
map Ms linemode sizemtime
map Mt linemode metatitle
# Tagging / Marking
map t tag_toggle
map ut tag_remove
map "<any> tag_toggle tag=%any
map <Space> mark_files toggle=True
map v mark_files all=True toggle=True
map uv mark_files all=True val=False
map V toggle_visual_mode
map uV toggle_visual_mode reverse=True
# For the nostalgics: Midnight Commander bindings
map <F1> help
map <F3> display_file
map <F4> edit
map <F5> copy
map <F6> cut
map <F7> console mkdir%space
map <F8> console delete
map <F10> exit
# In case you work on a keyboard with dvorak layout
map <UP> move up=1
map <DOWN> move down=1
map <LEFT> move left=1
map <RIGHT> move right=1
map <HOME> move to=0
map <END> move to=-1
map <PAGEDOWN> move down=1 pages=True
map <PAGEUP> move up=1 pages=True
map <CR> move right=1
#map <DELETE> console delete
map <INSERT> console touch%space
# VIM-like
copymap <UP> k
copymap <DOWN> j
copymap <LEFT> h
copymap <RIGHT> l
copymap <HOME> gg
copymap <END> G
copymap <PAGEDOWN> <C-F>
copymap <PAGEUP> <C-B>
map J move down=0.5 pages=True
map K move up=0.5 pages=True
copymap J <C-D>
copymap K <C-U>
# Jumping around
map H history_go -1
map L history_go 1
map ] move_parent 1
map [ move_parent -1
map } traverse
map gh cd ~
map gc cd ~/.config
map ge cd /etc
map gu cd /usr
map gd cd /dev
map gl cd -r .
map gL cd -r %f
map go cd /opt
map gv cd /var
map gm cd /media
map gM cd /mnt
map gs cd /srv
map gr cd /
map gR eval fm.cd(ranger.RANGERDIR)
map g/ cd /
map g? cd /usr/share/doc/ranger
# External Programs
map E edit
map du shell -p du --max-depth=1 -h --apparent-size
map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh
map yp shell -f echo -n %d/%f | xsel -i; xsel -o | xsel -i -b
map yd shell -f echo -n %d | xsel -i; xsel -o | xsel -i -b
map yn shell -f echo -n %f | xsel -i; xsel -o | xsel -i -b
# Filesystem Operations
map = chmod
map cw console rename%space
map a rename_append
map A eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"))
map I eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"), position=7)
map pp paste
map po paste overwrite=True
map pP paste append=True
map pO paste overwrite=True append=True
map pl paste_symlink relative=False
map pL paste_symlink relative=True
map phl paste_hardlink
map pht paste_hardlinked_subtree
map dD console delete
map dd cut
map ud uncut
map da cut mode=add
map dr cut mode=remove
map dt cut mode=toggle
map yy copy
map uy uncut
map ya copy mode=add
map yr copy mode=remove
map yt copy mode=toggle
# Temporary workarounds
map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier)
map dG eval fm.cut(dirarg=dict(to=-1), narg=quantifier)
map dj eval fm.cut(dirarg=dict(down=1), narg=quantifier)
map dk eval fm.cut(dirarg=dict(up=1), narg=quantifier)
map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier)
map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier)
map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier)
map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier)
# Searching
map / console search%space
map n search_next
map N search_next forward=False
map ct search_next order=tag
map cs search_next order=size
map ci search_next order=mimetype
map cc search_next order=ctime
map cm search_next order=mtime
map ca search_next order=atime
# Tabs
map <C-n> tab_new ~
map <C-w> tab_close
map <TAB> tab_move 1
map <S-TAB> tab_move -1
map <A-Right> tab_move 1
map <A-Left> tab_move -1
map gt tab_move 1
map gT tab_move -1
map gn tab_new ~
map gC tab_close
map uq tab_restore
map <a-1> tab_open 1
map <a-2> tab_open 2
map <a-3> tab_open 3
map <a-4> tab_open 4
map <a-5> tab_open 5
map <a-6> tab_open 6
map <a-7> tab_open 7
map <a-8> tab_open 8
map <a-9> tab_open 9
# Sorting
map or set sort_reverse!
map oz set sort=random
map os chain set sort=size; set sort_reverse=False
map ob chain set sort=basename; set sort_reverse=False
map on chain set sort=natural; set sort_reverse=False
map om chain set sort=mtime; set sort_reverse=False
map oc chain set sort=ctime; set sort_reverse=False
map oa chain set sort=atime; set sort_reverse=False
map ot chain set sort=type; set sort_reverse=False
map oe chain set sort=extension; set sort_reverse=False
map oS chain set sort=size; set sort_reverse=True
map oB chain set sort=basename; set sort_reverse=True
map oN chain set sort=natural; set sort_reverse=True
map oM chain set sort=mtime; set sort_reverse=True
map oC chain set sort=ctime; set sort_reverse=True
map oA chain set sort=atime; set sort_reverse=True
map oT chain set sort=type; set sort_reverse=True
map oE chain set sort=extension; set sort_reverse=True
map dc get_cumulative_size
# Settings
map zc set collapse_preview!
map zd set sort_directories_first!
map zh set show_hidden!
map <C-h> set show_hidden!
map zI set flushinput!
map zi set preview_images!
map zm set mouse_enabled!
map zp set preview_files!
map zP set preview_directories!
map zs set sort_case_insensitive!
map zu set autoupdate_cumulative_size!
map zv set use_preview_script!
map zf console filter%space
# Bookmarks
map `<any> enter_bookmark %any
map '<any> enter_bookmark %any
map m<any> set_bookmark %any
map um<any> unset_bookmark %any
map m<bg> draw_bookmarks
copymap m<bg> um<bg> `<bg> '<bg>
# Generate all the chmod bindings with some python help:
eval for arg in "rwxXst": cmd("map +u{0} shell -f chmod u+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +g{0} shell -f chmod g+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +o{0} shell -f chmod o+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +a{0} shell -f chmod a+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +{0} shell -f chmod u+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -u{0} shell -f chmod u-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -g{0} shell -f chmod g-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -o{0} shell -f chmod o-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -a{0} shell -f chmod a-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -{0} shell -f chmod u-{0} %s".format(arg))
# ===================================================================
# == Define keys for the console
# ===================================================================
# Note: Unmapped keys are passed directly to the console.
# Basic
cmap <tab> eval fm.ui.console.tab()
cmap <s-tab> eval fm.ui.console.tab(-1)
cmap <ESC> eval fm.ui.console.close()
cmap <CR> eval fm.ui.console.execute()
cmap <C-l> redraw_window
copycmap <ESC> <C-c>
copycmap <CR> <C-j>
# Move around
cmap <up> eval fm.ui.console.history_move(-1)
cmap <down> eval fm.ui.console.history_move(1)
cmap <left> eval fm.ui.console.move(left=1)
cmap <right> eval fm.ui.console.move(right=1)
cmap <home> eval fm.ui.console.move(right=0, absolute=True)
cmap <end> eval fm.ui.console.move(right=-1, absolute=True)
cmap <a-left> eval fm.ui.console.move_word(left=1)
cmap <a-right> eval fm.ui.console.move_word(right=1)
# Line Editing
cmap <backspace> eval fm.ui.console.delete(-1)
cmap <delete> eval fm.ui.console.delete(0)
cmap <C-w> eval fm.ui.console.delete_word()
cmap <A-d> eval fm.ui.console.delete_word(backward=False)
cmap <C-k> eval fm.ui.console.delete_rest(1)
cmap <C-u> eval fm.ui.console.delete_rest(-1)
cmap <C-y> eval fm.ui.console.paste()
# And of course the emacs way
copycmap <up> <C-p>
copycmap <down> <C-n>
copycmap <left> <C-b>
copycmap <right> <C-f>
copycmap <home> <C-a>
copycmap <end> <C-e>
copycmap <delete> <C-d>
copycmap <backspace> <C-h>
# Note: There are multiple ways to express backspaces. <backspace> (code 263)
# and <backspace2> (code 127). To be sure, use both.
copycmap <backspace> <backspace2>
# This special expression allows typing in numerals:
cmap <allow_quantifiers> false
# ===================================================================
# == Pager Keybindings
# ===================================================================
# Movement
pmap <down> pager_move down=1
pmap <up> pager_move up=1
pmap <left> pager_move left=4
pmap <right> pager_move right=4
pmap <home> pager_move to=0
pmap <end> pager_move to=-1
pmap <pagedown> pager_move down=1.0 pages=True
pmap <pageup> pager_move up=1.0 pages=True
pmap <C-d> pager_move down=0.5 pages=True
pmap <C-u> pager_move up=0.5 pages=True
copypmap <UP> k <C-p>
copypmap <DOWN> j <C-n> <CR>
copypmap <LEFT> h
copypmap <RIGHT> l
copypmap <HOME> g
copypmap <END> G
copypmap <C-d> d
copypmap <C-u> u
copypmap <PAGEDOWN> n f <C-F> <Space>
copypmap <PAGEUP> p b <C-B>
# Basic
pmap <C-l> redraw_window
pmap <ESC> pager_close
copypmap <ESC> q Q i <F3>
pmap E edit_file
# ===================================================================
# == Taskview Keybindings
# ===================================================================
# Movement
tmap <up> taskview_move up=1
tmap <down> taskview_move down=1
tmap <home> taskview_move to=0
tmap <end> taskview_move to=-1
tmap <pagedown> taskview_move down=1.0 pages=True
tmap <pageup> taskview_move up=1.0 pages=True
tmap <C-d> taskview_move down=0.5 pages=True
tmap <C-u> taskview_move up=0.5 pages=True
copytmap <UP> k <C-p>
copytmap <DOWN> j <C-n> <CR>
copytmap <HOME> g
copytmap <END> G
copytmap <C-u> u
copytmap <PAGEDOWN> n f <C-F> <Space>
copytmap <PAGEUP> p b <C-B>
# Changing priority and deleting tasks
tmap J eval -q fm.ui.taskview.task_move(-1)
tmap K eval -q fm.ui.taskview.task_move(0)
tmap dd eval -q fm.ui.taskview.task_remove()
tmap <pagedown> eval -q fm.ui.taskview.task_move(-1)
tmap <pageup> eval -q fm.ui.taskview.task_move(0)
tmap <delete> eval -q fm.ui.taskview.task_remove()
# Basic
tmap <C-l> redraw_window
tmap <ESC> taskview_close
copytmap <ESC> q Q w <C-c>

View File

@ -0,0 +1,216 @@
" ██████ ██████ ██ ██ ██████ █████ █████ ██████ █████ ██████
" ██░░░░ ██░░░░██░██ ░██░░██░░████░░░██ ██░░░██░░██░░████░░░██░░██░░██
" ░░█████ ░██ ░██░██ ░██ ░██ ░░░██ ░░ ░███████ ░██ ░░░███████ ░██ ░░
" ░░░░░██░██ ░██░██ ░██ ░██ ░██ ██░██░░░░ ░██ ░██░░░░ ░██
" ██████ ░░██████ ░░██████░███ ░░█████ ░░██████░███ ░░██████░███
" ░░░░░░ ░░░░░░ ░░░░░░ ░░░ ░░░░░ ░░░░░░ ░░░ ░░░░░░ ░░░
" r e a d c o d e l i k e a w i z a r d
"
" sourcerer by xero harrison (http://sourcerer.xero.nu)
" ├─ based on sorcerer by Jeet Sukumaran (http://jeetworks.org)
" └─ based on mustang by Henrique C. Alves (hcarvalhoalves@gmail.com)
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "sourcerer"
" █▓▒░ GUI colors
hi Normal guifg=#c2c2b0 guibg=#222222 gui=NONE
hi ColorColumn guifg=NONE guibg=#1c1c1c
hi Cursor guifg=NONE guibg=#626262 gui=NONE
hi CursorColumn guibg=#2d2d2d
hi CursorLine guibg=#2d2d2d
hi DiffAdd guifg=#000000 guibg=#3cb371 gui=NONE
hi DiffDelete guifg=#000000 guibg=#aa4450 gui=NONE
hi DiffChange guifg=#000000 guibg=#4f94cd gui=NONE
hi DiffText guifg=#000000 guibg=#8ee5ee gui=NONE
hi Directory guifg=#1e90ff guibg=NONE gui=NONE
hi ErrorMsg guifg=#ff6a6a guibg=NONE gui=bold
hi FoldColumn guifg=#68838b guibg=#4B4B4B gui=bold
hi Folded guifg=#406060 guibg=#232c2c gui=NONE
hi IncSearch guifg=#ffffff guibg=#ff4500 gui=bold
hi LineNr guifg=#878787 guibg=#3A3A3A gui=NONE
hi MatchParen guifg=#fff000 guibg=NONE gui=bold
hi ModeMsg guifg=#afafaf guibg=#222222 gui=bold
hi MoreMsg guifg=#2e8b57 guibg=NONE gui=bold
hi NonText guifg=#404050 guibg=NONE gui=NONE
" completions
hi Pmenu guifg=#A8A8A8 guibg=#3A3A3A
hi PmenuSel guifg=#000000 guibg=#528B8B
hi PmenuSbar guifg=#000000 guibg=#528B8B
hi PmenuThumb guifg=#000000 guibg=#528B8B
hi Question guifg=#00ee00 guibg=NONE gui=bold
hi Search guifg=#000000 guibg=#d6e770 gui=bold
hi SignColumn guifg=#ffffff guibg=NONE gui=NONE
hi SpecialKey guifg=#505060 guibg=NONE gui=NONE
hi SpellBad guisp=#ee2c2c gui=undercurl
hi SpellCap guisp=#0000ff gui=undercurl
hi SpellLocal guisp=#008b8b gui=undercurl
hi SpellRare guisp=#ff00ff gui=undercurl
hi StatusLine guifg=#000000 guibg=#808070 gui=bold
hi StatusLineNC guifg=#000000 guibg=#404c4c gui=italic
hi VertSplit guifg=#404c4c guibg=#404c4c gui=NONE
hi TabLine guifg=fg guibg=#d3d3d3 gui=underline
hi TabLineFill guifg=fg guibg=NONE gui=reverse
hi TabLineSel guifg=fg guibg=NONE gui=bold
hi Title guifg=#528b8b guibg=NONE gui=bold
hi Visual guifg=#000000 guibg=#6688aa gui=NONE
hi WarningMsg guifg=#ee9a00 guibg=NONE gui=NONE
hi WildMenu guifg=#000000 guibg=#87ceeb gui=NONE
hi ExtraWhitespace guifg=fg guibg=#528b8b gui=NONE
" syntax highlighting
hi Comment guifg=#686858 gui=italic
hi Boolean guifg=#ff9800 gui=NONE
hi String guifg=#779b70 gui=NONE
hi Identifier guifg=#9ebac2 gui=NONE
hi Function guifg=#faf4c6 gui=NONE
hi Type guifg=#7e8aa2 gui=NONE
hi Statement guifg=#90b0d1 gui=NONE
hi Keyword guifg=#90b0d1 gui=NONE
hi Constant guifg=#ff9800 gui=NONE
hi Number guifg=#cc8800 gui=NONE
hi Special guifg=#719611 gui=NONE
hi PreProc guifg=#528b8b gui=NONE
hi Todo guifg=#8f6f8f guibg=#202020 gui=italic,underline,bold
" diff
hi diffOldFile guifg=#88afcb guibg=NONE gui=italic
hi diffNewFile guifg=#88afcb guibg=NONE gui=italic
hi diffFile guifg=#88afcb guibg=NONE gui=italic
hi diffLine guifg=#88afcb guibg=NONE gui=italic
hi link diffSubname diffLine
hi diffAdded guifg=#3cb371 guibg=NONE gui=NONE
hi diffRemoved guifg=#aa4450 guibg=NONE gui=NONE
hi diffChanged guifg=#4f94cd guibg=NONE gui=NONE
hi link diffOnly Constant
hi link diffIdentical Constant
hi link diffDiffer Constant
hi link diffBDiffer Constant
hi link diffIsA Constant
hi link diffNoEOL Constant
hi link diffCommon Constant
hi link diffComment Constant
" python
hi pythonException guifg=#90b0d1 guibg=NONE gui=NONE
hi pythonExClass guifg=#996666 guibg=NONE gui=NONE
hi pythonDecorator guifg=#888555 guibg=NONE gui=NONE
hi link pythonDecoratorFunction pythonDecorator
" █▓▒░ 256 colors
hi Normal cterm=NONE ctermbg=NONE ctermfg=145
hi ColorColumn cterm=NONE ctermbg=16 ctermfg=NONE
hi Cursor cterm=NONE ctermbg=241 ctermfg=fg
hi CursorColumn cterm=NONE ctermbg=16 ctermfg=fg
hi CursorLine cterm=NONE ctermbg=236 ctermfg=fg
hi DiffAdd cterm=NONE ctermbg=71 ctermfg=16
hi DiffDelete cterm=NONE ctermbg=124 ctermfg=16
hi DiffChange cterm=NONE ctermbg=68 ctermfg=16
hi DiffText cterm=NONE ctermbg=117 ctermfg=16
hi Directory cterm=NONE ctermbg=234 ctermfg=33
hi ErrorMsg cterm=bold ctermbg=NONE ctermfg=203
hi FoldColumn cterm=bold ctermbg=239 ctermfg=66
hi Folded cterm=NONE ctermbg=16 ctermfg=60
hi IncSearch cterm=bold ctermbg=202 ctermfg=231
hi LineNr cterm=NONE ctermbg=237 ctermfg=102
hi MatchParen cterm=bold ctermbg=NONE ctermfg=226
hi ModeMsg cterm=bold ctermbg=NONE ctermfg=145
hi MoreMsg cterm=bold ctermbg=234 ctermfg=29
hi NonText cterm=NONE ctermbg=NONE ctermfg=59
hi Pmenu cterm=NONE ctermbg=238 ctermfg=231
hi PmenuSbar cterm=NONE ctermbg=250 ctermfg=fg
hi PmenuSel cterm=NONE ctermbg=149 ctermfg=16
hi Question cterm=bold ctermbg=NONE ctermfg=46
hi Search cterm=bold ctermbg=185 ctermfg=16
hi SignColumn cterm=NONE ctermbg=NONE ctermfg=231
hi SpecialKey cterm=NONE ctermbg=NONE ctermfg=59
hi SpellBad cterm=undercurl ctermbg=NONE ctermfg=196
hi SpellCap cterm=undercurl ctermbg=NONE ctermfg=21
hi SpellLocal cterm=undercurl ctermbg=NONE ctermfg=30
hi SpellRare cterm=undercurl ctermbg=NONE ctermfg=201
hi StatusLine cterm=bold ctermbg=101 ctermfg=16
hi StatusLineNC cterm=NONE ctermbg=102 ctermfg=16
hi VertSplit cterm=NONE ctermbg=102 ctermfg=102
hi TabLine cterm=bold ctermbg=102 ctermfg=16
hi TabLineFill cterm=NONE ctermbg=102 ctermfg=16
hi TabLineSel cterm=bold ctermbg=16 ctermfg=59
hi Title cterm=bold ctermbg=NONE ctermfg=66
hi Visual cterm=NONE ctermbg=67 ctermfg=16
hi WarningMsg cterm=NONE ctermbg=234 ctermfg=208
hi WildMenu cterm=NONE ctermbg=116 ctermfg=16
hi ExtraWhitespace cterm=NONE ctermbg=66 ctermfg=fg
hi Comment cterm=NONE ctermbg=NONE ctermfg=59
hi Boolean cterm=NONE ctermbg=NONE ctermfg=208
hi String cterm=NONE ctermbg=NONE ctermfg=101
hi Identifier cterm=NONE ctermbg=NONE ctermfg=145
hi Function cterm=NONE ctermbg=NONE ctermfg=230
hi Type cterm=NONE ctermbg=NONE ctermfg=103
hi Statement cterm=NONE ctermbg=NONE ctermfg=110
hi Keyword cterm=NONE ctermbg=NONE ctermfg=110
hi Constant cterm=NONE ctermbg=NONE ctermfg=208
hi Number cterm=NONE ctermbg=NONE ctermfg=172
hi Special cterm=NONE ctermbg=NONE ctermfg=64
hi PreProc cterm=NONE ctermbg=NONE ctermfg=66
hi Todo cterm=bold,underline ctermbg=234 ctermfg=96
hi diffOldFile cterm=NONE ctermbg=NONE ctermfg=67
hi diffNewFile cterm=NONE ctermbg=NONE ctermfg=67
hi diffFile cterm=NONE ctermbg=NONE ctermfg=67
hi diffLine cterm=NONE ctermbg=NONE ctermfg=67
hi diffAdded cterm=NONE ctermfg=NONE ctermfg=71
hi diffRemoved cterm=NONE ctermfg=NONE ctermfg=124
hi diffChanged cterm=NONE ctermfg=NONE ctermfg=68
hi link diffSubname diffLine
hi link diffOnly Constant
hi link diffIdentical Constant
hi link diffDiffer Constant
hi link diffBDiffer Constant
hi link diffIsA Constant
hi link diffNoEOL Constant
hi link diffCommon Constant
hi link diffComment Constant
hi pythonClass cterm=NONE ctermbg=NONE ctermfg=fg
hi pythonDecorator cterm=NONE ctermbg=NONE ctermfg=101
hi pythonExClass cterm=NONE ctermbg=NONE ctermfg=95
hi pythonException cterm=NONE ctermbg=NONE ctermfg=110
hi pythonFunc cterm=NONE ctermbg=NONE ctermfg=fg
hi pythonFuncParams cterm=NONE ctermbg=NONE ctermfg=fg
hi pythonKeyword cterm=NONE ctermbg=NONE ctermfg=fg
hi pythonParam cterm=NONE ctermbg=NONE ctermfg=fg
hi pythonRawEscape cterm=NONE ctermbg=NONE ctermfg=fg
hi pythonSuperclasses cterm=NONE ctermbg=NONE ctermfg=fg
hi pythonSync cterm=NONE ctermbg=NONE ctermfg=fg
hi Conceal cterm=NONE ctermbg=248 ctermfg=252
hi Error cterm=NONE ctermbg=196 ctermfg=231
hi Ignore cterm=NONE ctermbg=NONE ctermfg=234
hi InsertModeCursorLine cterm=NONE ctermbg=16 ctermfg=fg
hi NormalModeCursorLine cterm=NONE ctermbg=235 ctermfg=fg
hi PmenuThumb cterm=reverse ctermbg=NONE ctermfg=fg
hi StatusLineAlert cterm=NONE ctermbg=160 ctermfg=231
hi StatusLineUnalert cterm=NONE ctermbg=238 ctermfg=144
hi Test cterm=NONE ctermbg=NONE ctermfg=fg
hi Underlined cterm=underline ctermbg=NONE ctermfg=111
hi VisualNOS cterm=bold,underline ctermbg=NONE ctermfg=fg
hi cCursor cterm=reverse ctermbg=NONE ctermfg=fg
hi iCursor cterm=NONE ctermbg=210 ctermfg=16
hi lCursor cterm=NONE ctermbg=145 ctermfg=234
hi nCursor cterm=NONE ctermbg=NONE ctermfg=145
hi vCursor cterm=NONE ctermbg=201 ctermfg=16
hi Pmenu cterm=NONE ctermfg=248 ctermbg=237
hi PmenuSel cterm=NONE ctermfg=16 ctermbg=66
hi PmenuSbar cterm=NONE ctermfg=16 ctermbg=66
hi PmenuThumb cterm=NONE ctermfg=16 ctermbg=66

View File

@ -10,4 +10,9 @@
- name: Set skeleton files for new users
template: src=files/.bash_aliases dest=/etc/skel/.bash_aliases
- name: Configure unattended upgrades
template:
src: files/50unattended-upgrades
dest: /etc/apt/apt.conf.d/50unattended-upgrades

View File

@ -0,0 +1,14 @@
---
- name: Configure ranger
copy:
src: files/ranger
dest: "{{ item }}"
with_items:
- /home/ansibleuser/.config
- /etc/skel/.config
- name: Set ranger permissions
file:
dest: /home/ansibleuser/.config/ranger/
group: ansibleuser
owner: ansibleuser

View File

@ -11,17 +11,22 @@
template: src=files/sshd dest=/etc/pam.d/sshd
- name: Add authusers file
copy:
dest: "/etc/authusers"
content: |
user1
user2
lineinfile:
dest: /etc/authusers
line: '{{ item }}'
with_items:
- 'user1'
- 'user2'
- name: Add authorized_yubikeys file
copy:
dest: "/etc/ssh/authorized_yubikeys"
content: |
user:cccckey1cccc:cccckey2cccc
src: files/authorized_yubikeys
dest: /etc/ssh/
- name: Copy adduser.sh script
copy:
src: files/adduser.sh
dest: /home/ansibleuser/
- name: Add custom /etc/hosts
lineinfile:
@ -29,15 +34,15 @@
line: '{{ item }}'
with_items:
- '127.0.0.1 localhost'
- '127.0.0.2 www.otherhost.com otherhost'
- '123.123.123.12 some.domain.com somewhere'
- '12.12.12.12 other.domains.com somewhereelse'
- name: Add SSH Keys
lineinfile:
dest: /home/ansible/.ssh/authorized_keys
dest: /home/ansibleuser/.ssh/authorized_keys
line: '{{ item }}'
with_items:
- 'ssh-idrsa AAZ1NTE5AAAAIA+ndydG+ddddpdddaabvbumkiuyk7778678676547564563434XwmnYb user@host'
- 'ssh-rsa 1232346A+7654475n4x5y6GL657+V6mJ5Yp23s6I6o4+6N ansibleuser@host'
- name: Copy ssh configuration file
template: src=files/sshd_config dest=/etc/ssh/sshd_config

View File

@ -1,10 +1,60 @@
---
- name: Clone github.com/shaunrd0/klips
- name: Create vim directories
file:
path: "{{ item }}"
state: directory
with_items:
- /home/ansibleuser/.vim/
- /home/ansibleuser/.vim/colors/
- /home/ansibleuser/.vim/plugin/
- /home/ansibleuser/.vim/doc/
- /home/ansibleuser/.vim/bundle/
- /home/ansibleuser/.vim/autoload/
- /etc/skel/.vim/
- /etc/skel/.vim/colors/
- /etc/skel/.vim/plugin/
- /etc/skel/.vim/doc/
- /etc/skel/.vim/bundle/
- /etc/skel/.vim/autoload/
- name: Install Pathogen, sourcerer theme
copy:
src: files/{{ item.src }}
dest: /home/ansibleuser/.vim/{{ item.dest }}
with_items:
- { src: 'pathogen.vim', dest: 'autoload/pathogen.vim'}
- { src: 'sourcerer.vim', dest: 'colors/sourcerer.vim'}
- name: Install sourcerer theme
copy:
src: files/pathogen.vim
dest: /home/ansibleuser/.vim/autoload/
- name : Install vim plugins
git:
repo: https://github.com/shaunrd0/klips.git
clone: yes
dest: /etc/klips/
repo: https://github.com/{{ item.repo }}
dest: /home/ansibleuser/.vim/bundle/{{ item.dest }}
with_items: "{{ vim_plugins }}"
- name: Run Vim setup script
script: /etc/ansible/roles/core/files/setup-vim.sh
- name: Install Pathogen, sourcerer theme within skeleton files
copy:
src: files/{{ item.src }}
dest: /etc/skel/.vim/{{ item.dest }}
with_items:
- { src: 'pathogen.vim', dest: 'autoload/pathogen.vim'}
- { src: 'sourcerer.vim', dest: 'colors/sourcerer.vim'}
- name: Install vim plugins within skeleton files
git:
repo: https://github.com/{{ item.repo }}
dest: /etc/skel/.vim/bundle/{{ item.dest }}
with_items: "{{ vim_plugins }}"
- name: Configure vim
template:
src: files/.vimrc
dest: "{{ item }}"
with_items:
- /home/ansibleuser/.vimrc
- /etc/skel/.vimrc

View File

@ -1,4 +1,18 @@
---
- name: Install packages
apt: name="{{ item }}" state=latest
package: name="{{ item }}" state=present
with_items: "{{ packages }}"
- name: Ensure package lists are up-to-date
apt:
update_cache: yes
- name: Ensure packages are up-to-date
apt:
upgrade: dist
- name: Remove unused packages from the cache
apt:
autoclean: yes
- name: Remove dependencies that are no longer required
apt:
autoremove: yes

View File

@ -13,7 +13,8 @@
- import_tasks: configure-git.yml
# Vim
#- import_tasks: configure-vim.yml
- import_tasks: configure-vim.yml
- import_tasks: configure-ranger.yml
# Bash
- import_tasks: configure-bash.yml

View File

@ -25,3 +25,13 @@
state: present
notify: restart docker
- name: Install python-pip package
package:
name: python-pip
state: latest
- name: Install Docker python packages
pip:
name: docker
name: docker-compose

View File

@ -0,0 +1,6 @@
---
- hosts: plumbi
become: yes
roles:
- fail2ban

View File

@ -10,7 +10,8 @@ nginx_http_auth: "true"
nginx_nobinary: "true"
nginx_nohome: "true"
nginx_noproxy: "true"
nginx_noscan: "true"
nginx_wplogin: "true"
nginx_noscan: "true"
nginx_noenv: "true"
nginx_noscript: "true"
sshd: "true"

View File

@ -394,7 +394,16 @@ port = http,https
filter = nginx-noenv
logpath = /var/log/nginx/access.log
maxretry = 1
bantime = 4
bantime = 4h
[nginx-wplogin]
enabled = {{ nginx_wplogin }}
port = http,https
filter = nginx-wplogin
logpath = /var/log/nginx/access.log
maxretry = 1
bantime = 4h
[nginx-nobinary]
@ -407,7 +416,7 @@ bantime = -1
[sshd-badproto]
enabled = {{ sshd_badproto }}
port = {{ ssh+port }}
port = {{ ssh_port }}
filter = sshd-badproto
logpath = /var/log/auth.log
maxretry = 1

View File

@ -1,7 +1,7 @@
---
- name: Copy fail2ban jail.local configuration
- name: Copy jail.local configuration
template: src=files/fail2ban/jail.local dest=/etc/fail2ban/jail.local
- name: Copy fail2ban jail filters
- name: Copy jail filters
copy: src=files/fail2ban/filter.d/ dest=/etc/fail2ban/filter.d/

View File

@ -1,4 +1,4 @@
---
- name: Install packages
apt: name="{{ item }}" state=latest
package: name="{{ item }}" state=present
with_items: "{{ packages }}"

View File

@ -1,3 +1,3 @@
---
- name: Start and enable fail2ban service
- name: Start and enable services
service: name=fail2ban state=restarted enabled=yes

6
ansible/roles/nginx.yml Normal file
View File

@ -0,0 +1,6 @@
---
- hosts: plumbi
become: yes
roles:
- nginx

View File

@ -1,5 +1,5 @@
---
- name: Copy nginx configuration file
- name: Copy nginx.cong configuration
template: src=files/nginx/nginx.conf dest=/etc/nginx/nginx.conf
- name: Copy index.html file

View File

@ -1,4 +1,4 @@
---
- name: Install packages
apt: name="{{ item }}" state=latest
package: name="{{ item }}" state=present
with_items: "{{ packages }}"

View File

@ -1,3 +1,3 @@
---
- name: Start and enable nginx service
- name: Start and enable services
service: name=nginx state=restarted enabled=yes

View File

@ -0,0 +1,6 @@
---
- hosts: plumbi
become: yes
roles:
- postfix

View File

@ -1,5 +1,5 @@
---
- name: Copy postfix configuration template
- name: Copy configuration template
template: src=files/postfix/main.cf dest=/etc/postfix/main.cf
- name: Copy postfix sasl_passwd

View File

@ -1,4 +1,4 @@
---
- name: Install packages
apt: name="{{ item }}" state=latest
package: name="{{ item }}" state=present
with_items: "{{ packages }}"

View File

@ -1,3 +1,3 @@
---
- name: Start and enable postfix service
- name: Start and enable services
service: name=postfix state=restarted enabled=yes