4 Achegas 7d638562e5 ... 2b5d2fcaf7

Autor SHA1 Mensaxe Data
  logicp 2b5d2fcaf7 Merge branch 'kcloud' hai 1 ano
  logicp f1ef89b8d9 adding arch-dev hai 1 ano
  logicp 3dce0ca410 kcloud as-is %!s(int64=3) %!d(string=hai) anos
  logicp 6d59b1c007 updating %!s(int64=3) %!d(string=hai) anos

+ 26 - 0
arch-dev/README.md

@@ -0,0 +1,26 @@
+# Ansible-manjaro-desktop
+
+A playbook for setting up the tools I like on a fresh manjaro
+installation.
+
+## Setup
+
+1. Ansible must be installed
+
+>  sudo pacman -S ansible
+
+2. SSH server must be running
+
+```
+sudo pacman -S openssh
+sudo systemctl enable sshd
+sudo systemctl start sshd
+```
+
+3. SSH pass is required to enter password
+
+> sudo pacman -S sshpass
+
+## Running
+
+> ./run.sh

+ 2 - 0
arch-dev/hosts

@@ -0,0 +1,2 @@
+[localhost]
+127.0.0.1 ansible_connection=local

BIN=BIN
arch-dev/packages.microsoft.gpg


+ 9 - 0
arch-dev/roles/common/files/config.fish

@@ -0,0 +1,9 @@
+fish_vi_key_bindings
+
+alias ga "git add --all"
+alias gc "git commit"
+alias gd "git diff"
+alias gpo "git push origin "
+alias gpom "git push origin master"
+alias l "ls -l"
+alias f "fuck"

+ 332 - 0
arch-dev/roles/common/files/init.vim

@@ -0,0 +1,332 @@
+" Inspired from https://github.com/kristijanhusak/neovim-config/blob/master/init.vim
+
+" ================ dein config ===================
+if &compatible
+  set nocompatible
+endif
+
+" Required:
+set runtimepath+=~/.local/share/dein/repos/github.com/Shougo/dein.vim
+
+" Required:
+if dein#load_state('~/.local/share/dein/')
+  call dein#begin('~/.local/share/dein/')
+
+  " Let dein manage dein
+  " Required:
+  call dein#add('~/.local/share/dein/repos/github.com/Shougo/dein.vim')
+
+  " >>> Add or remove your plugins here <<<:
+  ""
+  call dein#add('Shougo/deoplete.nvim')	" auto-complete
+  call dein#add('Shougo/denite.nvim') " fuzzy-searching across files using :Denite grep
+  call dein#add('Shougo/neosnippet.vim') " Include code snippets
+  call dein#add('Shougo/neosnippet-snippets')
+  call dein#add('honza/vim-snippets')
+
+  call dein#add('freeo/vim-kalisi') "colorscheme
+  call dein#add('ryanoasis/vim-devicons') " icons everywhere!
+  call dein#add('Raimondi/delimitMate') " Automatic closing of quotes, brackets, etc.
+
+  call dein#add('vim-airline/vim-airline') " action bar
+  call dein#add('vim-airline/vim-airline-themes')
+
+  call dein#add('tpope/vim-commentary') " Comment code easily
+  call dein#add('tpope/vim-surround') " Surround with quotes, brackets
+  call dein#add('tpope/vim-repeat') " Enable plugins to use repeat '.'
+
+  call dein#add('scrooloose/nerdtree') " File browser
+  call dein#add('Xuyuanp/nerdtree-git-plugin') " Git for nerdtree
+
+  call dein#add('airblade/vim-gitgutter') " Git diff viewer
+
+  call dein#add('duff/vim-bufonly') " Delete all buffers except current
+  call dein#add('gregsexton/MatchTag') " Match HTML tags
+  call dein#add('sheerun/vim-polyglot') " Language syntax,detect,indent,etc pack
+
+  call dein#add('mhinz/vim-startify') " A nice start screen
+  call dein#add('lambdalisue/gina.vim') " Git stuff
+
+  call dein#add('eugen0329/vim-esearch') " Search in files easily
+  call dein#add('posva/vim-vue') " Search in files easily
+
+  " You can specify revision/branch/tag.
+  " call dein#add('Shougo/vimshell', { 'rev': '3787e5' })
+
+  " Required:
+  call dein#end()
+  call dein#save_state()
+endif
+
+" Required:
+filetype plugin indent on
+syntax enable
+
+" If you want to install not installed plugins on startup.
+if dein#check_install()
+  call dein#install()
+endif
+
+if (has("termguicolors"))
+ set termguicolors
+endif
+
+" ================ Plugin config =====================
+"
+
+let g:deoplete#enable_at_startup = 1
+
+let g:airline_powerline_fonts = 1                                               "Enable powerline fonts
+let g:airline_theme = "kalisi"                                                  "Set theme to powerline default theme
+let g:airline_section_y = '%{substitute(getcwd(), expand("$HOME"), "~", "g")}'  "Set relative path
+let g:airline#extensions#whitespace#enabled = 0                                 "Disable whitespace extension
+let g:airline#extensions#tabline#enabled = 1                                    "Enable tabline extension
+let g:airline#extensions#tabline#left_sep = ' '                                 "Left separator for tabline
+let g:airline#extensions#tabline#left_alt_sep = '│'                             "Right separator for tabline
+
+let g:delimitMate_expand_cr = 1                                                 "auto indent on enter
+
+let g:WebDevIconsNerdTreeAfterGlyphPadding = ' '                                "Set up spacing for sidebar icons
+
+let g:neosnippet#disable_runtime_snippets = {'_' : 1}                           "Snippets setup
+
+let g:gitgutter_realtime = 0                                                    "Disable gitgutter in realtime
+let g:gitgutter_eager = 0                                                       "Disable gitgutter to eager load on tab or buffer switch
+
+let g:NERDTreeChDirMode = 2                                                     "Always change the root directory
+let g:NERDTreeMinimalUI = 1                                                     "Disable help text and bookmark title
+let g:NERDTreeShowHidden = 1                                                    "Show hidden files in NERDTree
+let g:NERDTreeIgnore=['\.git$', '\.sass-cache$', '\.vagrant', '\.idea']
+
+let g:Tlist_Use_Right_Window = 1
+
+let g:neosnippet#snippets_directory = [
+            \ '~/.local/share/dein//repos/github.com//honza/vim-snippets/snippets',
+            \ '~/.local/share/dein/repos/github.com/Shougo/neosnippet-snippets/neosnippets',
+            \ '~/.local/my-snippets']
+
+" Use silver searcher for recursive file search
+call denite#custom#var('file_rec', 'command',
+	\ ['ag', '--follow', '--nocolor', '--nogroup', '-g', ''])
+
+" ================ General Config ====================
+
+let g:mapleader = ","                                                           "Change leader to a comma
+let g:enable_bold_font = 1                                                      "Enable bold font in colorscheme
+colorscheme kalisi
+
+set t_Co=256                                                                    "Set 256 colors
+set title                                                                       "change the terminal's title
+set relativenumber                                                              "relative numbers are good
+set history=500                                                                 "Store lots of :cmdline history
+set showcmd                                                                     "Show incomplete cmds down the bottom
+set noshowmode                                                                  "Hide showmode because of the powerline plugin
+set gdefault                                                                    "Set global flag for search and replace
+set gcr=a:blinkon500-blinkwait500-blinkoff500                                   "Set cursor blinking rate
+set cursorline                                                                  "Highlight current line
+set smartcase                                                                   "Smart case search if there is uppercase
+set ignorecase                                                                  "case insensitive search
+set mouse=a                                                                     "Enable mouse usage
+set showmatch                                                                   "Highlight matching bracket
+set nostartofline                                                               "Jump to first non-blank character
+set timeoutlen=1000 ttimeoutlen=200                                             "Reduce Command timeout for faster escape and O
+set fileencoding=utf-8                                                          "Set utf-8 encoding on write
+set wrap                                                                        "Enable word wrap
+set linebreak                                                                   "Wrap lines at convenient points
+set listchars=tab:\ \ ,trail:·                                                  "Set trails for tabs and spaces
+set list                                                                        "Enable listchars
+set lazyredraw                                                                  "Do not redraw on registers and macros
+set completeopt-=preview                                                        "Disable preview for autocomplete
+set background=dark                                                             "Set background to dark
+set conceallevel=2 concealcursor=i                                              "neosnippets conceal marker
+set splitright                                                                  "Set up new splits positions
+
+syntax on                                                                       "turn on syntax highlighting
+
+" ================ Persistent Undo ==================
+
+" Keep undo history across sessions, by storing in file.
+silent !mkdir ~/.config/nvim/backups > /dev/null 2>&1
+set undodir=~/.config/nvim/backups
+set undofile
+
+" ================ Indentation ======================
+
+set shiftwidth=4
+set softtabstop=4
+set tabstop=4
+set expandtab
+set smartindent
+set nofoldenable
+
+" ================ Completion =======================
+
+set wildmode=list:full
+set wildignore=*.o,*.obj,*~                                                     "stuff to ignore when tab completing
+set wildignore+=*vim/backups*
+set wildignore+=*sass-cache*
+set wildignore+=*cache*
+set wildignore+=*logs*
+set wildignore+=*node_modules/**
+set wildignore+=*DS_Store*
+set wildignore+=*.gem
+set wildignore+=log/**
+set wildignore+=tmp/**
+set wildignore+=*.png,*.jpg,*.gif
+
+" ================ Scrolling ========================
+
+set scrolloff=100                                                                 "Start scrolling when we're 100 lines away from margins
+set sidescrolloff=30
+set sidescroll=5
+
+
+" ================ Custom mappings ========================
+
+" Comment map
+nmap <Leader>c gcc
+" Line comment command
+xmap <Leader>c gc
+
+" Map save to Ctrl + S
+map <c-s> :w<CR>
+imap <c-s> <C-o>:w<CR>
+
+" Also save with ,w
+nnoremap <Leader>w :w<CR>
+
+" Easier window navigation
+nmap <C-h> <C-w>h
+nmap <C-j> <C-w>j
+nmap <C-k> <C-w>k
+nmap <C-l> <C-w>l
+
+" Down is really the next line
+nnoremap j gj
+nnoremap k gk
+
+" Expand snippets on tab if snippets exists, otherwise do autocompletion
+imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
+\ "\<Plug>(neosnippet_expand_or_jump)"
+\ : pumvisible() ? "\<C-n>" : "\<TAB>"
+
+" If popup window is visible do autocompletion from back
+imap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<S-Tab>"
+
+" Fix for jumping over placeholders for neosnippet
+smap <expr><TAB> neosnippet#jumpable() ?
+\ "\<Plug>(neosnippet_jump)"
+\: "\<TAB>"
+
+" Yank to the end of the line
+nnoremap Y y$
+
+" Copy to system clipboard
+vnoremap <C-c> "+y
+
+" Paste from system clipboard with Ctrl + v
+inoremap <C-v> <Esc>"+p
+nnoremap <Leader>p "0p
+vnoremap <Leader>p "0p
+
+" Move to the end of yanked text after yank and paste
+nnoremap p p`]
+vnoremap y y`]
+vnoremap p p`]
+
+" Move selected lines up and down
+vnoremap J :m '>+1<CR>gv=gv
+vnoremap K :m '<-2<CR>gv=gv
+
+" Clear search highlight
+nnoremap <Leader><space> :noh<CR>
+
+" Handle syntastic error window
+nnoremap <Leader>e :lopen<CR>
+nnoremap <Leader>q :lclose<CR>
+
+" Find current file in NERDTree
+nnoremap <Leader>hf :NERDTreeFind<CR>
+" Open NERDTree
+nnoremap <Leader>n :NERDTreeToggle<CR>
+
+" Toggle between last 2 buffers
+nnoremap <leader><tab> <c-^>
+
+" Auto change directory to match current file
+nnoremap <Leader>dc :cd %:p:h<CR>:pwd<CR>
+
+" Maps for indentation in normal mode
+nnoremap <tab> >>
+nnoremap <s-tab> <<
+
+" Indenting in visual mode
+xnoremap <s-tab> <gv
+xnoremap <tab> >gv
+
+" Resize window with shift + and shift -
+nnoremap + <c-w>5>
+nnoremap _ <c-w>5<
+
+" Center highlighted search
+nnoremap n nzz
+nnoremap N Nzz
+
+nnoremap <c-p> :Denite file_rec<CR>
+nnoremap <Leader>t :TlistToggle<CR>
+
+" Go to normal mode in terminal by pressing esc
+tnoremap <Esc> <C-\><C-n>
+
+" Always go at beginning of first word in line
+nnoremap 0 ^
+
+
+" ================ Abbreviations ====================
+
+cnoreabbrev Wq wq
+cnoreabbrev WQ wq
+cnoreabbrev W w
+cnoreabbrev Q q
+cnoreabbrev Qa qa
+cnoreabbrev Bd bd
+cnoreabbrev bD bd
+cnoreabbrev wrap set wrap
+cnoreabbrev nowrap set nowrap
+cnoreabbrev bda BufOnly
+cnoreabbrev t tabe
+cnoreabbrev T tabe
+cnoreabbrev den Denite
+
+" ================ Functions ========================
+function! s:StripTrailingWhitespaces()
+    let l:l = line(".")
+    let l:c = col(".")
+    %s/\s\+$//e
+    call cursor(l:l, l:c)
+endfunction
+
+function! s:LoadLocalVimrc()
+    if filereadable(glob(getcwd() . '/.vimrc.local'))
+        :execute 'source '.fnameescape(glob(getcwd(). '/.vimrc.local'))
+    endif
+endfunction
+
+" ================ Auto commands ======================
+
+augroup vimrc
+    autocmd!
+augroup END
+
+autocmd vimrc BufWritePre * :call s:StripTrailingWhitespaces()                  "Auto-remove trailing spaces
+autocmd vimrc InsertLeave * NeoSnippetClearMarkers                              "Remove unused markers for snippets
+autocmd vimrc InsertEnter * :set nocul                                          "Remove cursorline highlight
+autocmd vimrc InsertLeave * :set cul                                            "Add cursorline highlight in normal mode
+" autocmd vimrc FileType html,javascript,coffee,cucumber setlocal sw=2 sts=2 ts=2 "Set 2 indent for html
+" autocmd vimrc FileType php,javascript setlocal cc=80                            "Set right margin only for php and js
+autocmd vimrc VimEnter,BufNewFile,BufReadPost * call s:LoadLocalVimrc()         "Load per project vimrc (Used for custom test mappings, etc.)
+
+autocmd vimrc VimEnter * set vb t_vb=
+
+autocmd vimrc FileType nerdtree syntax match hideBracketsInNerdTree
+\ "\]" contained conceal containedin=ALL

+ 249 - 0
arch-dev/roles/common/files/z.sh

@@ -0,0 +1,249 @@
+# Copyright (c) 2009 rupa deadwyler under the WTFPL license
+
+# maintains a jump-list of the directories you actually use
+#
+# INSTALL:
+#     * put something like this in your .bashrc/.zshrc:
+#         . /path/to/z.sh
+#     * cd around for a while to build up the db
+#     * PROFIT!!
+#     * optionally:
+#         set $_Z_CMD in .bashrc/.zshrc to change the command (default z).
+#         set $_Z_DATA in .bashrc/.zshrc to change the datafile (default ~/.z).
+#         set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution.
+#         set $_Z_NO_PROMPT_COMMAND if you're handling PROMPT_COMMAND yourself.
+#         set $_Z_EXCLUDE_DIRS to an array of directories to exclude.
+#         set $_Z_OWNER to your username if you want use z while sudo with $HOME kept
+#
+# USE:
+#     * z foo     # cd to most frecent dir matching foo
+#     * z foo bar # cd to most frecent dir matching foo and bar
+#     * z -r foo  # cd to highest ranked dir matching foo
+#     * z -t foo  # cd to most recently accessed dir matching foo
+#     * z -l foo  # list matches instead of cd
+#     * z -c foo  # restrict matches to subdirs of $PWD
+
+[ -d "${_Z_DATA:-$HOME/.z}" ] && {
+    echo "ERROR: z.sh's datafile (${_Z_DATA:-$HOME/.z}) is a directory."
+}
+
+_z() {
+
+    local datafile="${_Z_DATA:-$HOME/.z}"
+
+    # bail if we don't own ~/.z and $_Z_OWNER not set
+    [ -z "$_Z_OWNER" -a -f "$datafile" -a ! -O "$datafile" ] && return
+
+    _z_dirs () {
+      while read line; do
+        # only count directories
+        [ -d "${line%%\|*}" ] && echo $line
+      done < "$datafile"
+      return 0
+    }
+
+    # add entries
+    if [ "$1" = "--add" ]; then
+        shift
+
+        # $HOME isn't worth matching
+        [ "$*" = "$HOME" ] && return
+
+        # don't track excluded directory trees
+        local exclude
+        for exclude in "${_Z_EXCLUDE_DIRS[@]}"; do
+            case "$*" in "$exclude*") return;; esac
+        done
+
+        # maintain the data file
+        local tempfile="$datafile.$RANDOM"
+        awk < <(_z_dirs 2>/dev/null) -v path="$*" -v now="$(date +%s)" -F"|" '
+            BEGIN {
+                rank[path] = 1
+                time[path] = now
+            }
+            $2 >= 1 {
+                # drop ranks below 1
+                if( $1 == path ) {
+                    rank[$1] = $2 + 1
+                    time[$1] = now
+                } else {
+                    rank[$1] = $2
+                    time[$1] = $3
+                }
+                count += $2
+            }
+            END {
+                if( count > 9000 ) {
+                    # aging
+                    for( x in rank ) print x "|" 0.99*rank[x] "|" time[x]
+                } else for( x in rank ) print x "|" rank[x] "|" time[x]
+            }
+        ' 2>/dev/null >| "$tempfile"
+        # do our best to avoid clobbering the datafile in a race condition.
+        if [ $? -ne 0 -a -f "$datafile" ]; then
+            env rm -f "$tempfile"
+        else
+            [ "$_Z_OWNER" ] && chown $_Z_OWNER:$(id -ng $_Z_OWNER) "$tempfile"
+            env mv -f "$tempfile" "$datafile" || env rm -f "$tempfile"
+        fi
+
+    # tab completion
+    elif [ "$1" = "--complete" -a -s "$datafile" ]; then
+        while read line; do
+            [ -d "${line%%\|*}" ] && echo $line
+        done < "$datafile" | awk -v q="$2" -F"|" '
+            BEGIN {
+                if( q == tolower(q) ) imatch = 1
+                q = substr(q, 3)
+                gsub(" ", ".*", q)
+            }
+            {
+                if( imatch ) {
+                    if( tolower($1) ~ tolower(q) ) print $1
+                } else if( $1 ~ q ) print $1
+            }
+        ' 2>/dev/null
+
+    else
+        # list/go
+        while [ "$1" ]; do case "$1" in
+            --) while [ "$1" ]; do shift; local fnd="$fnd${fnd:+ }$1";done;;
+            -*) local opt=${1:1}; while [ "$opt" ]; do case ${opt:0:1} in
+                    c) local fnd="^$PWD $fnd";;
+                    e) local echo=echo;;
+                    h) echo "${_Z_CMD:-z} [-cehlrtx] args" >&2; return;;
+                    l) local list=1;;
+                    r) local typ="rank";;
+                    t) local typ="recent";;
+                    x) sed -i -e "\:^${PWD}|.*:d" "$datafile";;
+                esac; opt=${opt:1}; done;;
+             *) local fnd="$fnd${fnd:+ }$1";;
+        esac; local last=$1; [ "$#" -gt 0 ] && shift; done
+        [ "$fnd" -a "$fnd" != "^$PWD " ] || local list=1
+
+        # if we hit enter on a completion just go there
+        case "$last" in
+            # completions will always start with /
+            /*) [ -z "$list" -a -d "$last" ] && builtin cd "$last" && return;;
+        esac
+
+        # no file yet
+        [ -f "$datafile" ] || return
+
+        local cd
+        cd="$( < <( _z_dirs ) awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -F"|" '
+            function frecent(rank, time) {
+                # relate frequency and time
+                dx = t - time
+                if( dx < 3600 ) return rank * 4
+                if( dx < 86400 ) return rank * 2
+                if( dx < 604800 ) return rank / 2
+                return rank / 4
+            }
+            function output(files, out, common) {
+                # list or return the desired directory
+                if( list ) {
+                    cmd = "sort -n >&2"
+                    for( x in files ) {
+                        if( files[x] ) printf "%-10s %s\n", files[x], x | cmd
+                    }
+                    if( common ) {
+                        printf "%-10s %s\n", "common:", common > "/dev/stderr"
+                    }
+                } else {
+                    if( common ) out = common
+                    print out
+                }
+            }
+            function common(matches) {
+                # find the common root of a list of matches, if it exists
+                for( x in matches ) {
+                    if( matches[x] && (!short || length(x) < length(short)) ) {
+                        short = x
+                    }
+                }
+                if( short == "/" ) return
+                # use a copy to escape special characters, as we want to return
+                # the original. yeah, this escaping is awful.
+                clean_short = short
+                gsub(/\[\(\)\[\]\|\]/, "\\\\&", clean_short)
+                for( x in matches ) if( matches[x] && x !~ clean_short ) return
+                return short
+            }
+            BEGIN {
+                gsub(" ", ".*", q)
+                hi_rank = ihi_rank = -9999999999
+            }
+            {
+                if( typ == "rank" ) {
+                    rank = $2
+                } else if( typ == "recent" ) {
+                    rank = $3 - t
+                } else rank = frecent($2, $3)
+                if( $1 ~ q ) {
+                    matches[$1] = rank
+                } else if( tolower($1) ~ tolower(q) ) imatches[$1] = rank
+                if( matches[$1] && matches[$1] > hi_rank ) {
+                    best_match = $1
+                    hi_rank = matches[$1]
+                } else if( imatches[$1] && imatches[$1] > ihi_rank ) {
+                    ibest_match = $1
+                    ihi_rank = imatches[$1]
+                }
+            }
+            END {
+                # prefer case sensitive
+                if( best_match ) {
+                    output(matches, best_match, common(matches))
+                } else if( ibest_match ) {
+                    output(imatches, ibest_match, common(imatches))
+                }
+            }
+        ')"
+
+        [ $? -eq 0 ] && [ "$cd" ] && {
+          if [ "$echo" ]; then echo "$cd"; else builtin cd "$cd"; fi
+        }
+    fi
+}
+
+alias ${_Z_CMD:-z}='_z 2>&1'
+
+[ "$_Z_NO_RESOLVE_SYMLINKS" ] || _Z_RESOLVE_SYMLINKS="-P"
+
+if type compctl >/dev/null 2>&1; then
+    # zsh
+    [ "$_Z_NO_PROMPT_COMMAND" ] || {
+        # populate directory list, avoid clobbering any other precmds.
+        if [ "$_Z_NO_RESOLVE_SYMLINKS" ]; then
+            _z_precmd() {
+                (_z --add "${PWD:a}" &)
+            }
+        else
+            _z_precmd() {
+                (_z --add "${PWD:A}" &)
+            }
+        fi
+        [[ -n "${precmd_functions[(r)_z_precmd]}" ]] || {
+            precmd_functions[$(($#precmd_functions+1))]=_z_precmd
+        }
+    }
+    _z_zsh_tab_completion() {
+        # tab completion
+        local compl
+        read -l compl
+        reply=(${(f)"$(_z --complete "$compl")"})
+    }
+    compctl -U -K _z_zsh_tab_completion _z
+elif type complete >/dev/null 2>&1; then
+    # bash
+    # tab completion
+    complete -o filenames -C '_z --complete "$COMP_LINE"' ${_Z_CMD:-z}
+    [ "$_Z_NO_PROMPT_COMMAND" ] || {
+        # populate directory list. avoid clobbering other PROMPT_COMMANDs.
+        grep "_z --add" <<< "$PROMPT_COMMAND" >/dev/null || {
+            PROMPT_COMMAND="$PROMPT_COMMAND"$'\n''(_z --add "$(command pwd '$_Z_RESOLVE_SYMLINKS' 2>/dev/null)" 2>/dev/null &);'
+        }
+    }
+fi

+ 183 - 0
arch-dev/roles/common/tasks/main.yml

@@ -0,0 +1,183 @@
+---
+- name: install neovim
+  pacman: name=neovim state=present
+  tags: neovim
+  become: true
+
+    #- name: install neovim python client
+    #  pip: name=neovim
+    #  tags: python neovim
+    #  become: true
+
+    #- name: create vim symlink to nvim
+    #  file: src=/usr/bin/nvim dest=/usr/bin/vim state=link
+    #  become: true
+
+- name: create vi symlink to vim
+  file: src=/usr/bin/vim dest=/usr/bin/vi state=link
+  become: true
+
+    #- name: install zsh shell
+    #  pacman: name=zsh state=present
+    #  tags: zsh
+    #  become: true
+    #
+    #- name: switch default shell to fish
+    #  shell: chsh -s /usr/bin/zsh
+    #  tags: shellchange
+    #  become: true
+
+- name: clone oh-my-zsh
+  get_url:
+    url: https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
+    dest: /tmp/zsh_install.sh
+    mode: 0774
+
+- name: install oh-my-zsh
+  shell: /tmp/zsh_install.sh --noninteractive
+  ignore_errors: true
+  async: 10
+  poll: 1
+
+- name: neovim plug
+  shell: |
+    curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
+    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
+
+- name: install nodejs
+  pacman: name=nodejs state=present
+  become: true
+
+- name: install npm
+  pacman: name=npm state=present
+  become: true
+
+- name: install ctags
+  pacman: name=ctags state=present
+  become: true
+
+- name: install locate
+  pacman: name=mlocate state=present
+  become: true
+
+- name: install yarn
+  shell: curl -o- -L https://yarnpkg.com/install.sh | bash
+  tags: yarn
+
+- name: install postgres
+  pacman: name=postgresql state=present
+  tags: postgres
+  become: true
+
+- name: install postgres-libs
+  pacman: name=postgresql-libs state=present
+  tags: postgres-libs libpq
+  become: true
+
+- name: install cmake
+  pacman: name=cmake state=present
+  tags: cmake
+  become: true
+
+- name: install zeromq
+  pacman: name=zeromq state=present
+  tags: zeromq
+  become: true
+
+- name: install libpqxx
+  pacman: name=libpqxx
+  become: true
+
+- name: nvm
+  shell: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
+
+- name: telegram dl
+  shell: |
+    wget -O- https://telegram.org/dl/desktop/linux | sudo tar xJ -C /opt/
+
+- name: link telegram
+  shell: |
+    sudo ln -s /opt/Telegram/Telegram /usr/local/bin/telegram-desktop
+
+- name: Download VSCode
+  shell: curl -L https://code.visualstudio.com/sha/download\?build\=stable\&os\=linux-x64 -o /home/logicp/Downloads/vscode.tar.gz
+  tags: VSCode
+
+- name: Uncompress VSCode
+  shell: |
+      cd /home/logicp/Downloads && tar xvf vscode.tar.gz
+
+- name: Install VSCode
+  shell: |
+      mv /home/logicp/Downloads/VSCode-linux-x64 /opt
+  become: true
+
+- name: Create data dir
+  shell: mkdir /data && chown -R logicp:logicp /data
+  become: true
+
+- name: Clone KServer
+  ignore_errors: true
+  ansible.builtin.git:
+    repo: git@github.com:stronglogicsolutions/kserver
+    dest: /data/kserver
+
+- name: Clone KY_GUI
+  ignore_errors: true
+  ansible.builtin.git:
+    repo: git@github.com:stronglogicsolutions/ky_gui
+    dest: /data/kygui
+
+- name: Clone KBOT
+  ignore_errors: true
+  ansible.builtin.git:
+    repo: git@github.com:stronglogicsolutions/kbot
+    dest: /data/kbot
+
+- name: Clone Keleqram
+  ignore_errors: true 
+  ansible.builtin.git:
+    repo: git@github.com:stronglogicsolutions/keleqram
+    dest: /data/keleqram
+
+- name: Clone KGRAM
+  ignore_errors: true
+  ansible.builtin.git:
+    repo: git@github.com:stronglogicsolutions/kgram
+    dest: /data/kgram
+
+- name: Clone KStodon
+  ignore_errors: true
+  ansible.builtin.git:
+    repo: git@github.com:stronglogicsolutions/kstodon
+    dest: /data/kstodon
+
+- name: Clone KScord
+  ignore_errors: true
+  ansible.builtin.git:
+    repo: git@github.com:stronglogicsolutions/kscord
+    dest: /data/kscord
+
+- name: Clone KTube
+  ignore_errors: true
+  ansible.builtin.git:
+    repo: git@github.com:stronglogicsolutions/ktube
+    dest: /data/ktube
+
+- name: Clone KNeural
+  ignore_errors: true
+  ansible.builtin.git:
+    repo: git@github.com:stronglogicsolutions/kneural
+    dest: /data/kneural
+
+- name: Clone Katrix
+  ignore_errors: true
+  ansible.builtin.git:
+    repo: git@github.com:stronglogicsolutions/katrix
+    dest: /data/katrix
+
+- name: Clone Kwitter
+  ignore_errors: true
+  ansible.builtin.git:
+    repo: git@github.com:stronglogicsolutions/kwitter
+    dest: /data/kwitter

BIN=BIN
arch-dev/roles/packages.microsoft.gpg


+ 2 - 0
arch-dev/run.sh

@@ -0,0 +1,2 @@
+#!/bin/bash
+ansible-playbook -i hosts site.yml --ask-become-pass  

+ 7 - 0
arch-dev/site.yml

@@ -0,0 +1,7 @@
+---
+- name: install software
+  hosts: localhost
+  remote_user: logicp
+
+  roles:
+    - common

+ 37 - 78
arch/roles/common/tasks/main.yml

@@ -1,28 +1,20 @@
 ---
-- name: install neovim
-  pacman: name=neovim state=present
-  tags: neovim
-  become: true
-
-- name: install neovim python client
-  pip: name=neovim
-  tags: python neovim
-  become: true
-
-- name: create vim symlink to nvim
-  file: src=/usr/bin/nvim dest=/usr/bin/vim state=link
-  become: true
+# - name: install neovim
+#   pip: name=neovim state=present
+#   tags: neovim
+#   # become: true
 
-- name: create vi symlink to vim
-  file: src=/usr/bin/vim dest=/usr/bin/vi state=link
+- name: install nginx
+  pacman: name=nginx state=present
+  tags: nginx
   become: true
 
-- name: install zsh shell
+- name: install zsh
   pacman: name=zsh state=present
   tags: zsh
   become: true
 
-- name: switch default shell to fish
+- name: switch default shell to zsh
   shell: chsh -s /usr/bin/zsh
   tags: shellchange
   become: true
@@ -39,85 +31,52 @@
   async: 10
   poll: 1
 
-#- name: google chrome
-  #shell: |
-    #cd ~/Downloads && git clone https://aur.archlinux.org/google-chrome.git && cd google-chrome && makepkg -s
- 
-- name: install google chrome
-  shell: cd /home/logicp/Downloads/google-chrome && pacman -U --noconfirm  google-chrome*.pkg.tar.xz
-  become: true
-  
-- name: neovim plug
-  shell: |
-    curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
-    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
-
-- name: install nodejs
-  pacman: name=nodejs state=present
+- name: install neovim python client
+  pip: name=neovim
+  tags: python neovim
   become: true
 
-- name: install npm
-  pacman: name=npm state=present
+- name: create vim symlink to nvim
+  file: src=/usr/bin/nvim dest=/usr/bin/vim state=link
   become: true
 
-- name: install virtualbox
-  pacman: name=virtualbox state=present
+- name: create vi symlink to vim
+  file: src=/usr/bin/vim dest=/usr/bin/vi state=link
   become: true
 
-- name: install vagrant
-  pacman: name=vagrant state=present
-  become: true
 
-- name: install ruby
-  pacman: name=ruby state=present
+- name: install nodejs
+  pacman: name=nodejs state=present
+  tags: nodejs
   become: true
 
-- name: install ctags
-  pacman: name=ctags state=present
-  become: true
 
-- name: install locate
-  pacman: name=mlocate state=present
+- name: install npm
+  pacman: name=npm state=present
+  tags: npm
   become: true
 
 - name: install yarn
-  shell: curl -o- -L https://yarnpkg.com/install.sh | bash
+  community.general.npm: name=yarn global=yes
   tags: yarn
 
-- name: Download VSCode
-  shell: wget -o /home/logicp/Downloads/vscode.tar.gz https://go.microsoft.com/fwlink/?LinkID=620884
-  tags: VSCode
-
-- name: Uncompress VSCode
-  shell: |
-      cd /home/logicp/Downloads && tar zxvf vscode.tar.gz
-
-- name: Install VSCode
-  shell: |
-      mv /home/logicp/Downloads/VSCode-linux-x64 /opt
+- name: install postgres
+  pacman: name=postgresql state=present
+  tags: postgres
   become: true
 
-- name: Download IntelliJ Community
-  get_url:
-      url: http://
-      dest: /home/logicp/Downloads/intellij-ce.tar.gz
 
-- name: Unpack and Install IntelliJ
-  shell: |
-      tar zxvf /home/logicp/Downloads/intellij-ce.tar.gz || mv /home/logicp/Download/idea-IC* /opt/idea-IC
+- name: install postgres-libs
+  pacman: name=postgres-libs state=present
+  tags: postgres-libs libpq
   become: true
 
-- name: Clone and install slack
-  shell: |
-	cd /home/logicp/Downloads && git clone https://aur.archlinux.org/slack-desktop.git && \
-        cd slack-desktop && makepkg -s && pacman -U slack-desktop-*x86_64.pkg.tar.xz
-
-- name: Download Telegram
-  get_url:
-      url: https://github.com/telegramdesktop/tdesktop/releases/download/v1.7.8/tsetup.1.7.8.beta.tar.xz
-      dest: /home/logicp/Downloads/tsetup.xz
-
-- name: Unpack Telegram
-  shell: cd /home/logicp/Downloads && tar xvf tsetup.xz
-
+- name: install cmake
+  pacman: name=cmake state=present
+  tags: cmake
+  become: true
 
+- name: install zeromq
+  pacman: name=zeromq state=present
+  tags: zeromq
+  become: true

+ 26 - 0
kcloud/README.md

@@ -0,0 +1,26 @@
+# Ansible-manjaro-desktop
+
+A playbook for setting up the tools I like on a fresh manjaro
+installation.
+
+## Setup
+
+1. Ansible must be installed
+
+>  sudo pacman -S ansible
+
+2. SSH server must be running
+
+```
+sudo pacman -S openssh
+sudo systemctl enable sshd
+sudo systemctl start sshd
+```
+
+3. SSH pass is required to enter password
+
+> sudo pacman -S sshpass
+
+## Running
+
+> ./run.sh

+ 2 - 0
kcloud/hosts

@@ -0,0 +1,2 @@
+[localhost]
+127.0.0.1 ansible_connection=local

BIN=BIN
kcloud/packages.microsoft.gpg


+ 9 - 0
kcloud/roles/common/files/config.fish

@@ -0,0 +1,9 @@
+fish_vi_key_bindings
+
+alias ga "git add --all"
+alias gc "git commit"
+alias gd "git diff"
+alias gpo "git push origin "
+alias gpom "git push origin master"
+alias l "ls -l"
+alias f "fuck"

+ 332 - 0
kcloud/roles/common/files/init.vim

@@ -0,0 +1,332 @@
+" Inspired from https://github.com/kristijanhusak/neovim-config/blob/master/init.vim
+
+" ================ dein config ===================
+if &compatible
+  set nocompatible
+endif
+
+" Required:
+set runtimepath+=~/.local/share/dein/repos/github.com/Shougo/dein.vim
+
+" Required:
+if dein#load_state('~/.local/share/dein/')
+  call dein#begin('~/.local/share/dein/')
+
+  " Let dein manage dein
+  " Required:
+  call dein#add('~/.local/share/dein/repos/github.com/Shougo/dein.vim')
+
+  " >>> Add or remove your plugins here <<<:
+  ""
+  call dein#add('Shougo/deoplete.nvim')	" auto-complete
+  call dein#add('Shougo/denite.nvim') " fuzzy-searching across files using :Denite grep
+  call dein#add('Shougo/neosnippet.vim') " Include code snippets
+  call dein#add('Shougo/neosnippet-snippets')
+  call dein#add('honza/vim-snippets')
+
+  call dein#add('freeo/vim-kalisi') "colorscheme
+  call dein#add('ryanoasis/vim-devicons') " icons everywhere!
+  call dein#add('Raimondi/delimitMate') " Automatic closing of quotes, brackets, etc.
+
+  call dein#add('vim-airline/vim-airline') " action bar
+  call dein#add('vim-airline/vim-airline-themes')
+
+  call dein#add('tpope/vim-commentary') " Comment code easily
+  call dein#add('tpope/vim-surround') " Surround with quotes, brackets
+  call dein#add('tpope/vim-repeat') " Enable plugins to use repeat '.'
+
+  call dein#add('scrooloose/nerdtree') " File browser
+  call dein#add('Xuyuanp/nerdtree-git-plugin') " Git for nerdtree
+
+  call dein#add('airblade/vim-gitgutter') " Git diff viewer
+
+  call dein#add('duff/vim-bufonly') " Delete all buffers except current
+  call dein#add('gregsexton/MatchTag') " Match HTML tags
+  call dein#add('sheerun/vim-polyglot') " Language syntax,detect,indent,etc pack
+
+  call dein#add('mhinz/vim-startify') " A nice start screen
+  call dein#add('lambdalisue/gina.vim') " Git stuff
+
+  call dein#add('eugen0329/vim-esearch') " Search in files easily
+  call dein#add('posva/vim-vue') " Search in files easily
+
+  " You can specify revision/branch/tag.
+  " call dein#add('Shougo/vimshell', { 'rev': '3787e5' })
+
+  " Required:
+  call dein#end()
+  call dein#save_state()
+endif
+
+" Required:
+filetype plugin indent on
+syntax enable
+
+" If you want to install not installed plugins on startup.
+if dein#check_install()
+  call dein#install()
+endif
+
+if (has("termguicolors"))
+ set termguicolors
+endif
+
+" ================ Plugin config =====================
+"
+
+let g:deoplete#enable_at_startup = 1
+
+let g:airline_powerline_fonts = 1                                               "Enable powerline fonts
+let g:airline_theme = "kalisi"                                                  "Set theme to powerline default theme
+let g:airline_section_y = '%{substitute(getcwd(), expand("$HOME"), "~", "g")}'  "Set relative path
+let g:airline#extensions#whitespace#enabled = 0                                 "Disable whitespace extension
+let g:airline#extensions#tabline#enabled = 1                                    "Enable tabline extension
+let g:airline#extensions#tabline#left_sep = ' '                                 "Left separator for tabline
+let g:airline#extensions#tabline#left_alt_sep = '│'                             "Right separator for tabline
+
+let g:delimitMate_expand_cr = 1                                                 "auto indent on enter
+
+let g:WebDevIconsNerdTreeAfterGlyphPadding = ' '                                "Set up spacing for sidebar icons
+
+let g:neosnippet#disable_runtime_snippets = {'_' : 1}                           "Snippets setup
+
+let g:gitgutter_realtime = 0                                                    "Disable gitgutter in realtime
+let g:gitgutter_eager = 0                                                       "Disable gitgutter to eager load on tab or buffer switch
+
+let g:NERDTreeChDirMode = 2                                                     "Always change the root directory
+let g:NERDTreeMinimalUI = 1                                                     "Disable help text and bookmark title
+let g:NERDTreeShowHidden = 1                                                    "Show hidden files in NERDTree
+let g:NERDTreeIgnore=['\.git$', '\.sass-cache$', '\.vagrant', '\.idea']
+
+let g:Tlist_Use_Right_Window = 1
+
+let g:neosnippet#snippets_directory = [
+            \ '~/.local/share/dein//repos/github.com//honza/vim-snippets/snippets',
+            \ '~/.local/share/dein/repos/github.com/Shougo/neosnippet-snippets/neosnippets',
+            \ '~/.local/my-snippets']
+
+" Use silver searcher for recursive file search
+call denite#custom#var('file_rec', 'command',
+	\ ['ag', '--follow', '--nocolor', '--nogroup', '-g', ''])
+
+" ================ General Config ====================
+
+let g:mapleader = ","                                                           "Change leader to a comma
+let g:enable_bold_font = 1                                                      "Enable bold font in colorscheme
+colorscheme kalisi
+
+set t_Co=256                                                                    "Set 256 colors
+set title                                                                       "change the terminal's title
+set relativenumber                                                              "relative numbers are good
+set history=500                                                                 "Store lots of :cmdline history
+set showcmd                                                                     "Show incomplete cmds down the bottom
+set noshowmode                                                                  "Hide showmode because of the powerline plugin
+set gdefault                                                                    "Set global flag for search and replace
+set gcr=a:blinkon500-blinkwait500-blinkoff500                                   "Set cursor blinking rate
+set cursorline                                                                  "Highlight current line
+set smartcase                                                                   "Smart case search if there is uppercase
+set ignorecase                                                                  "case insensitive search
+set mouse=a                                                                     "Enable mouse usage
+set showmatch                                                                   "Highlight matching bracket
+set nostartofline                                                               "Jump to first non-blank character
+set timeoutlen=1000 ttimeoutlen=200                                             "Reduce Command timeout for faster escape and O
+set fileencoding=utf-8                                                          "Set utf-8 encoding on write
+set wrap                                                                        "Enable word wrap
+set linebreak                                                                   "Wrap lines at convenient points
+set listchars=tab:\ \ ,trail:·                                                  "Set trails for tabs and spaces
+set list                                                                        "Enable listchars
+set lazyredraw                                                                  "Do not redraw on registers and macros
+set completeopt-=preview                                                        "Disable preview for autocomplete
+set background=dark                                                             "Set background to dark
+set conceallevel=2 concealcursor=i                                              "neosnippets conceal marker
+set splitright                                                                  "Set up new splits positions
+
+syntax on                                                                       "turn on syntax highlighting
+
+" ================ Persistent Undo ==================
+
+" Keep undo history across sessions, by storing in file.
+silent !mkdir ~/.config/nvim/backups > /dev/null 2>&1
+set undodir=~/.config/nvim/backups
+set undofile
+
+" ================ Indentation ======================
+
+set shiftwidth=4
+set softtabstop=4
+set tabstop=4
+set expandtab
+set smartindent
+set nofoldenable
+
+" ================ Completion =======================
+
+set wildmode=list:full
+set wildignore=*.o,*.obj,*~                                                     "stuff to ignore when tab completing
+set wildignore+=*vim/backups*
+set wildignore+=*sass-cache*
+set wildignore+=*cache*
+set wildignore+=*logs*
+set wildignore+=*node_modules/**
+set wildignore+=*DS_Store*
+set wildignore+=*.gem
+set wildignore+=log/**
+set wildignore+=tmp/**
+set wildignore+=*.png,*.jpg,*.gif
+
+" ================ Scrolling ========================
+
+set scrolloff=100                                                                 "Start scrolling when we're 100 lines away from margins
+set sidescrolloff=30
+set sidescroll=5
+
+
+" ================ Custom mappings ========================
+
+" Comment map
+nmap <Leader>c gcc
+" Line comment command
+xmap <Leader>c gc
+
+" Map save to Ctrl + S
+map <c-s> :w<CR>
+imap <c-s> <C-o>:w<CR>
+
+" Also save with ,w
+nnoremap <Leader>w :w<CR>
+
+" Easier window navigation
+nmap <C-h> <C-w>h
+nmap <C-j> <C-w>j
+nmap <C-k> <C-w>k
+nmap <C-l> <C-w>l
+
+" Down is really the next line
+nnoremap j gj
+nnoremap k gk
+
+" Expand snippets on tab if snippets exists, otherwise do autocompletion
+imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
+\ "\<Plug>(neosnippet_expand_or_jump)"
+\ : pumvisible() ? "\<C-n>" : "\<TAB>"
+
+" If popup window is visible do autocompletion from back
+imap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<S-Tab>"
+
+" Fix for jumping over placeholders for neosnippet
+smap <expr><TAB> neosnippet#jumpable() ?
+\ "\<Plug>(neosnippet_jump)"
+\: "\<TAB>"
+
+" Yank to the end of the line
+nnoremap Y y$
+
+" Copy to system clipboard
+vnoremap <C-c> "+y
+
+" Paste from system clipboard with Ctrl + v
+inoremap <C-v> <Esc>"+p
+nnoremap <Leader>p "0p
+vnoremap <Leader>p "0p
+
+" Move to the end of yanked text after yank and paste
+nnoremap p p`]
+vnoremap y y`]
+vnoremap p p`]
+
+" Move selected lines up and down
+vnoremap J :m '>+1<CR>gv=gv
+vnoremap K :m '<-2<CR>gv=gv
+
+" Clear search highlight
+nnoremap <Leader><space> :noh<CR>
+
+" Handle syntastic error window
+nnoremap <Leader>e :lopen<CR>
+nnoremap <Leader>q :lclose<CR>
+
+" Find current file in NERDTree
+nnoremap <Leader>hf :NERDTreeFind<CR>
+" Open NERDTree
+nnoremap <Leader>n :NERDTreeToggle<CR>
+
+" Toggle between last 2 buffers
+nnoremap <leader><tab> <c-^>
+
+" Auto change directory to match current file
+nnoremap <Leader>dc :cd %:p:h<CR>:pwd<CR>
+
+" Maps for indentation in normal mode
+nnoremap <tab> >>
+nnoremap <s-tab> <<
+
+" Indenting in visual mode
+xnoremap <s-tab> <gv
+xnoremap <tab> >gv
+
+" Resize window with shift + and shift -
+nnoremap + <c-w>5>
+nnoremap _ <c-w>5<
+
+" Center highlighted search
+nnoremap n nzz
+nnoremap N Nzz
+
+nnoremap <c-p> :Denite file_rec<CR>
+nnoremap <Leader>t :TlistToggle<CR>
+
+" Go to normal mode in terminal by pressing esc
+tnoremap <Esc> <C-\><C-n>
+
+" Always go at beginning of first word in line
+nnoremap 0 ^
+
+
+" ================ Abbreviations ====================
+
+cnoreabbrev Wq wq
+cnoreabbrev WQ wq
+cnoreabbrev W w
+cnoreabbrev Q q
+cnoreabbrev Qa qa
+cnoreabbrev Bd bd
+cnoreabbrev bD bd
+cnoreabbrev wrap set wrap
+cnoreabbrev nowrap set nowrap
+cnoreabbrev bda BufOnly
+cnoreabbrev t tabe
+cnoreabbrev T tabe
+cnoreabbrev den Denite
+
+" ================ Functions ========================
+function! s:StripTrailingWhitespaces()
+    let l:l = line(".")
+    let l:c = col(".")
+    %s/\s\+$//e
+    call cursor(l:l, l:c)
+endfunction
+
+function! s:LoadLocalVimrc()
+    if filereadable(glob(getcwd() . '/.vimrc.local'))
+        :execute 'source '.fnameescape(glob(getcwd(). '/.vimrc.local'))
+    endif
+endfunction
+
+" ================ Auto commands ======================
+
+augroup vimrc
+    autocmd!
+augroup END
+
+autocmd vimrc BufWritePre * :call s:StripTrailingWhitespaces()                  "Auto-remove trailing spaces
+autocmd vimrc InsertLeave * NeoSnippetClearMarkers                              "Remove unused markers for snippets
+autocmd vimrc InsertEnter * :set nocul                                          "Remove cursorline highlight
+autocmd vimrc InsertLeave * :set cul                                            "Add cursorline highlight in normal mode
+" autocmd vimrc FileType html,javascript,coffee,cucumber setlocal sw=2 sts=2 ts=2 "Set 2 indent for html
+" autocmd vimrc FileType php,javascript setlocal cc=80                            "Set right margin only for php and js
+autocmd vimrc VimEnter,BufNewFile,BufReadPost * call s:LoadLocalVimrc()         "Load per project vimrc (Used for custom test mappings, etc.)
+
+autocmd vimrc VimEnter * set vb t_vb=
+
+autocmd vimrc FileType nerdtree syntax match hideBracketsInNerdTree
+\ "\]" contained conceal containedin=ALL

+ 249 - 0
kcloud/roles/common/files/z.sh

@@ -0,0 +1,249 @@
+# Copyright (c) 2009 rupa deadwyler under the WTFPL license
+
+# maintains a jump-list of the directories you actually use
+#
+# INSTALL:
+#     * put something like this in your .bashrc/.zshrc:
+#         . /path/to/z.sh
+#     * cd around for a while to build up the db
+#     * PROFIT!!
+#     * optionally:
+#         set $_Z_CMD in .bashrc/.zshrc to change the command (default z).
+#         set $_Z_DATA in .bashrc/.zshrc to change the datafile (default ~/.z).
+#         set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution.
+#         set $_Z_NO_PROMPT_COMMAND if you're handling PROMPT_COMMAND yourself.
+#         set $_Z_EXCLUDE_DIRS to an array of directories to exclude.
+#         set $_Z_OWNER to your username if you want use z while sudo with $HOME kept
+#
+# USE:
+#     * z foo     # cd to most frecent dir matching foo
+#     * z foo bar # cd to most frecent dir matching foo and bar
+#     * z -r foo  # cd to highest ranked dir matching foo
+#     * z -t foo  # cd to most recently accessed dir matching foo
+#     * z -l foo  # list matches instead of cd
+#     * z -c foo  # restrict matches to subdirs of $PWD
+
+[ -d "${_Z_DATA:-$HOME/.z}" ] && {
+    echo "ERROR: z.sh's datafile (${_Z_DATA:-$HOME/.z}) is a directory."
+}
+
+_z() {
+
+    local datafile="${_Z_DATA:-$HOME/.z}"
+
+    # bail if we don't own ~/.z and $_Z_OWNER not set
+    [ -z "$_Z_OWNER" -a -f "$datafile" -a ! -O "$datafile" ] && return
+
+    _z_dirs () {
+      while read line; do
+        # only count directories
+        [ -d "${line%%\|*}" ] && echo $line
+      done < "$datafile"
+      return 0
+    }
+
+    # add entries
+    if [ "$1" = "--add" ]; then
+        shift
+
+        # $HOME isn't worth matching
+        [ "$*" = "$HOME" ] && return
+
+        # don't track excluded directory trees
+        local exclude
+        for exclude in "${_Z_EXCLUDE_DIRS[@]}"; do
+            case "$*" in "$exclude*") return;; esac
+        done
+
+        # maintain the data file
+        local tempfile="$datafile.$RANDOM"
+        awk < <(_z_dirs 2>/dev/null) -v path="$*" -v now="$(date +%s)" -F"|" '
+            BEGIN {
+                rank[path] = 1
+                time[path] = now
+            }
+            $2 >= 1 {
+                # drop ranks below 1
+                if( $1 == path ) {
+                    rank[$1] = $2 + 1
+                    time[$1] = now
+                } else {
+                    rank[$1] = $2
+                    time[$1] = $3
+                }
+                count += $2
+            }
+            END {
+                if( count > 9000 ) {
+                    # aging
+                    for( x in rank ) print x "|" 0.99*rank[x] "|" time[x]
+                } else for( x in rank ) print x "|" rank[x] "|" time[x]
+            }
+        ' 2>/dev/null >| "$tempfile"
+        # do our best to avoid clobbering the datafile in a race condition.
+        if [ $? -ne 0 -a -f "$datafile" ]; then
+            env rm -f "$tempfile"
+        else
+            [ "$_Z_OWNER" ] && chown $_Z_OWNER:$(id -ng $_Z_OWNER) "$tempfile"
+            env mv -f "$tempfile" "$datafile" || env rm -f "$tempfile"
+        fi
+
+    # tab completion
+    elif [ "$1" = "--complete" -a -s "$datafile" ]; then
+        while read line; do
+            [ -d "${line%%\|*}" ] && echo $line
+        done < "$datafile" | awk -v q="$2" -F"|" '
+            BEGIN {
+                if( q == tolower(q) ) imatch = 1
+                q = substr(q, 3)
+                gsub(" ", ".*", q)
+            }
+            {
+                if( imatch ) {
+                    if( tolower($1) ~ tolower(q) ) print $1
+                } else if( $1 ~ q ) print $1
+            }
+        ' 2>/dev/null
+
+    else
+        # list/go
+        while [ "$1" ]; do case "$1" in
+            --) while [ "$1" ]; do shift; local fnd="$fnd${fnd:+ }$1";done;;
+            -*) local opt=${1:1}; while [ "$opt" ]; do case ${opt:0:1} in
+                    c) local fnd="^$PWD $fnd";;
+                    e) local echo=echo;;
+                    h) echo "${_Z_CMD:-z} [-cehlrtx] args" >&2; return;;
+                    l) local list=1;;
+                    r) local typ="rank";;
+                    t) local typ="recent";;
+                    x) sed -i -e "\:^${PWD}|.*:d" "$datafile";;
+                esac; opt=${opt:1}; done;;
+             *) local fnd="$fnd${fnd:+ }$1";;
+        esac; local last=$1; [ "$#" -gt 0 ] && shift; done
+        [ "$fnd" -a "$fnd" != "^$PWD " ] || local list=1
+
+        # if we hit enter on a completion just go there
+        case "$last" in
+            # completions will always start with /
+            /*) [ -z "$list" -a -d "$last" ] && builtin cd "$last" && return;;
+        esac
+
+        # no file yet
+        [ -f "$datafile" ] || return
+
+        local cd
+        cd="$( < <( _z_dirs ) awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -F"|" '
+            function frecent(rank, time) {
+                # relate frequency and time
+                dx = t - time
+                if( dx < 3600 ) return rank * 4
+                if( dx < 86400 ) return rank * 2
+                if( dx < 604800 ) return rank / 2
+                return rank / 4
+            }
+            function output(files, out, common) {
+                # list or return the desired directory
+                if( list ) {
+                    cmd = "sort -n >&2"
+                    for( x in files ) {
+                        if( files[x] ) printf "%-10s %s\n", files[x], x | cmd
+                    }
+                    if( common ) {
+                        printf "%-10s %s\n", "common:", common > "/dev/stderr"
+                    }
+                } else {
+                    if( common ) out = common
+                    print out
+                }
+            }
+            function common(matches) {
+                # find the common root of a list of matches, if it exists
+                for( x in matches ) {
+                    if( matches[x] && (!short || length(x) < length(short)) ) {
+                        short = x
+                    }
+                }
+                if( short == "/" ) return
+                # use a copy to escape special characters, as we want to return
+                # the original. yeah, this escaping is awful.
+                clean_short = short
+                gsub(/\[\(\)\[\]\|\]/, "\\\\&", clean_short)
+                for( x in matches ) if( matches[x] && x !~ clean_short ) return
+                return short
+            }
+            BEGIN {
+                gsub(" ", ".*", q)
+                hi_rank = ihi_rank = -9999999999
+            }
+            {
+                if( typ == "rank" ) {
+                    rank = $2
+                } else if( typ == "recent" ) {
+                    rank = $3 - t
+                } else rank = frecent($2, $3)
+                if( $1 ~ q ) {
+                    matches[$1] = rank
+                } else if( tolower($1) ~ tolower(q) ) imatches[$1] = rank
+                if( matches[$1] && matches[$1] > hi_rank ) {
+                    best_match = $1
+                    hi_rank = matches[$1]
+                } else if( imatches[$1] && imatches[$1] > ihi_rank ) {
+                    ibest_match = $1
+                    ihi_rank = imatches[$1]
+                }
+            }
+            END {
+                # prefer case sensitive
+                if( best_match ) {
+                    output(matches, best_match, common(matches))
+                } else if( ibest_match ) {
+                    output(imatches, ibest_match, common(imatches))
+                }
+            }
+        ')"
+
+        [ $? -eq 0 ] && [ "$cd" ] && {
+          if [ "$echo" ]; then echo "$cd"; else builtin cd "$cd"; fi
+        }
+    fi
+}
+
+alias ${_Z_CMD:-z}='_z 2>&1'
+
+[ "$_Z_NO_RESOLVE_SYMLINKS" ] || _Z_RESOLVE_SYMLINKS="-P"
+
+if type compctl >/dev/null 2>&1; then
+    # zsh
+    [ "$_Z_NO_PROMPT_COMMAND" ] || {
+        # populate directory list, avoid clobbering any other precmds.
+        if [ "$_Z_NO_RESOLVE_SYMLINKS" ]; then
+            _z_precmd() {
+                (_z --add "${PWD:a}" &)
+            }
+        else
+            _z_precmd() {
+                (_z --add "${PWD:A}" &)
+            }
+        fi
+        [[ -n "${precmd_functions[(r)_z_precmd]}" ]] || {
+            precmd_functions[$(($#precmd_functions+1))]=_z_precmd
+        }
+    }
+    _z_zsh_tab_completion() {
+        # tab completion
+        local compl
+        read -l compl
+        reply=(${(f)"$(_z --complete "$compl")"})
+    }
+    compctl -U -K _z_zsh_tab_completion _z
+elif type complete >/dev/null 2>&1; then
+    # bash
+    # tab completion
+    complete -o filenames -C '_z --complete "$COMP_LINE"' ${_Z_CMD:-z}
+    [ "$_Z_NO_PROMPT_COMMAND" ] || {
+        # populate directory list. avoid clobbering other PROMPT_COMMANDs.
+        grep "_z --add" <<< "$PROMPT_COMMAND" >/dev/null || {
+            PROMPT_COMMAND="$PROMPT_COMMAND"$'\n''(_z --add "$(command pwd '$_Z_RESOLVE_SYMLINKS' 2>/dev/null)" 2>/dev/null &);'
+        }
+    }
+fi

+ 113 - 0
kcloud/roles/common/tasks/main.yml

@@ -0,0 +1,113 @@
+---
+- name: install nginx
+  pacman: name=nginx state=present
+  tags: nginx
+  become: true
+
+- name: install gcc
+  pacman: name=gcc state=present
+  tags: gcc
+  become: true
+
+- name: install python-pip
+  pacman: name=python-pip state=present
+  tags: python-pip python pip
+  become: true
+
+- name: install zsh
+  pacman: name=zsh state=present
+  tags: zsh
+  become: true
+
+- name: switch default shell to zsh
+  shell: chsh -s /usr/bin/zsh
+  tags: shellchange
+  become: true
+
+- name: install neovim
+  pacman: name=neovim
+  tags: neovim
+  become: true
+
+- name: install pynvim python client
+  pip: name=pynvim
+  tags: python neovim pynvim
+
+- name: Move vi
+  command: mv /usr/bin/vi /usr/bin/oldvi
+  become: true
+
+- name: Move vim
+  command: mv /usr/bin/vim /usr/bin/oldvim
+  become: true
+
+- name: create vim symlink to nvim
+  file: src=/usr/bin/nvim dest=/usr/bin/vim state=link
+  become: true
+
+- name: create vi symlink to vim
+  file: src=/usr/bin/vim dest=/usr/bin/vi state=link
+  become: true
+
+- name: install nodejs
+  pacman: name=nodejs state=present
+  tags: nodejs
+  become: true
+
+- name: install npm
+  pacman: name=npm state=present
+  tags: npm
+  become: true
+
+- name: install git
+  pacman: name=git state=present
+  tags: git
+  become: true
+
+- name: install postgres
+  pacman: name=postgresql state=present
+  tags: postgres
+  become: true
+
+- name: install postgresql-libs
+  pacman: name=postgresql-libs state=present
+  tags: postgresql-libs libpq
+  become: true
+
+- name: install make
+  pacman: name=make state=present
+  tags: mmake
+  become: true
+
+- name: install cmake
+  pacman: name=cmake state=present
+  tags: cmake
+  become: true
+
+- name: install ninja
+  pacman: name=ninja state=present
+  tags: ninja
+  become: true
+
+- name: install gn
+  pacman: name=gn state=present
+  tags: gn
+  become: true
+
+- name: install zeromq
+  pacman: name=zeromq state=present
+  tags: zeromq
+  become: true
+
+- name: install yarn
+  community.general.npm: name=yarn global=yes
+  tags: yarn
+  become: true
+
+- name: install flatbuffers
+  pacman: name=flatbuffers state=present
+  tags: flatbuffers
+  become: true
+
+
+

BIN=BIN
kcloud/roles/packages.microsoft.gpg


+ 2 - 0
kcloud/run.sh

@@ -0,0 +1,2 @@
+#!/bin/bash
+ansible-playbook -i hosts site.yml --ask-become-pass  

+ 7 - 0
kcloud/site.yml

@@ -0,0 +1,7 @@
+---
+- name: install software
+  hosts: localhost
+  remote_user: logicp
+
+  roles:
+    - common