diff options
author | William Carroll <wpcarro@gmail.com> | 2020-03-05T17·26+0000 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-03-06T10·15+0000 |
commit | fe61dee51170a4aa7cdd984e03e56d4dc45afbb9 (patch) | |
tree | 7ee427504bee31df4a6e62f763fd43f749e1eea9 /configs/.config | |
parent | 137bd6dc0c8ef65d89c0daada860a2dd25460983 (diff) |
Splice configs/shared directory
- Move all children from configs/shared into configs. - Delete "shared" directory.
Diffstat (limited to 'configs/.config')
-rw-r--r-- | configs/.config/fish/config.fish | 249 | ||||
-rw-r--r-- | configs/.config/nixpkgs/config.nix | 3 | ||||
-rw-r--r-- | configs/.config/nixpkgs/home.nix | 90 | ||||
-rw-r--r-- | configs/.config/nvim/init.vim | 668 | ||||
-rw-r--r-- | configs/.config/nvim/templates/boilerplate.c | 6 | ||||
-rw-r--r-- | configs/.config/nvim/templates/boilerplate.rs | 5 | ||||
-rw-r--r-- | configs/.config/systemd/user/clipmenud.service | 18 | ||||
l--------- | configs/.config/systemd/user/default.target.wants/clipmenud.service | 1 | ||||
-rw-r--r-- | configs/.config/systemd/user/lieer-google.service | 7 | ||||
-rw-r--r-- | configs/.config/systemd/user/lieer-google.timer | 9 | ||||
l--------- | configs/.config/systemd/user/timers.target.wants/lieer-google.timer | 1 |
11 files changed, 1057 insertions, 0 deletions
diff --git a/configs/.config/fish/config.fish b/configs/.config/fish/config.fish new file mode 100644 index 000000000000..552b5d1c9b33 --- /dev/null +++ b/configs/.config/fish/config.fish @@ -0,0 +1,249 @@ +# While I work use a variety of programs, below of some of my more commonly used +# programs that I have decided to support with aliases. +# Applications +# java: jv +# tmux: t +# $EDITOR: e +# vim: v +# GnuPG: gpg +# blaze: bz +# borgcfg: br +# piper: pi +# pass: ps +# pastebin: pb +# pacman: pm +# codesearch: cs +# git: g +# mercurial: hg +# aptitude: apt +# chrome: c +# elixir: ex +# haskell: hk +# wifi: wf +# piper: pp +# g4: pp +# g4d: pp +# cci: circleci +# +# Below are some common modifiers or flags that programs support. +# Supported qualifiers: +# hidden: h +# ignore-case: i +# +# I've found that much of my time is spent working with programs that support +# some many of the following actions. +# Supported verbs: +# source: s +# install: i +# test: t +# build: b +# list: ls +# shell: REPL +# +# Commentary: +# Ideally a file like this would be either unnecessary in the case of a fully +# embraced Emacs workflow or compiled from some high-level language like +# Elisp. + +# Adding this to support tramp. +if test "$TERM" = "dumb" + function fish_prompt + echo "\$ " + end + function fish_right_prompt; end + function fish_greeting; end + function fish_title; end +else + # Remove the default greeting from fish + set fish_greeting "" + + # Prompt + function fish_prompt + # My custom prompt. + # + # Design objectives: + # - max-length <= 80 characters + # - minimal + # - no dependencies (well, you know what I mean) + # + # Components + # - ssh connection + # - user + # - host + # - git repo + # - git branch + # - lambda character as prompt + + # Cache status before we overwrite it. + set -l last_status $status + + # Colors + set -l color_inactive (set_color red --bold) + set -l color_active (set_color green --bold) + set -l color_normal (set_color normal) + + # SSH information + if set -q SSH_CLIENT; or set -q SSH_TTY + echo -en "$color_active \bssh ✓ [$color_normal$USER@"(hostname)"$color_active]$color_normal" + else + echo -en "$color_inactive \bssh ✗ [$color_normal$USER@"(hostname)"$color_inactive]$color_normal" + end + + # Separator + echo -n " " + + # Git information + set -l git_repo (git rev-parse --show-toplevel 2>/dev/null) + set -l git_status $status + set -l dir_parent (basename (realpath ..)) + set -l dir_current (basename (realpath .)) + if test $git_status -eq 0 + set -l git_repo_name (basename (git rev-parse --show-toplevel)) + set -l git_branch (git branch 2>/dev/null | grep '^\*' | cut -d' ' -f2-) + echo -en "$color_active \bgit ✓ [$color_normal$git_branch$color_active|$color_normal$git_repo_name$color_active|$color_normal$dir_parent/$dir_current$color_active]$color_normal" + else + echo -en "$color_inactive \bgit ✗ [$color_normal$dir_parent/$dir_current$color_inactive]$color_normal" + end + + # Newline + echo + + # Handle root vs non-root + if [ "$USER" = "root" ] + set -g prompt_sigil "#" + else + set -g prompt_sigil "λ" + end + + # TODO(wpcarro): For root directories like /tmp, there will not be a parent + # directory. Support these directories. + set -l time (date +"%T") + if test $last_status -eq 0 + # TODO(wpcarro): I'd prefer to use black here instead of white, but for + # some reason white is black and black is invisible. + set -l color_prompt (set_color white --bold) + echo -n "$time$color_prompt $prompt_sigil$color_normal " + else + set -l color_prompt (set_color red --bold) + echo -n "$time$color_prompt $prompt_sigil$color_normal " + end + end + + # Setup fzf for fuzzily finding commands, files, directories + source (fzf-share)/key-bindings.fish && fzf_key_bindings + + # TODO: What is the difference between `source` and `eval` + # direnv + eval (direnv hook fish) + + # Miscellaneous + alias c='xclip -selection clipboard -i' + alias p='xclip -selection clipboard -o' + alias lorem='echo "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."' + alias cat='bat --theme=TwoDark' + alias vim=nvim + alias rg='rg --ignore-case' + alias rgh='rg --hidden' # By default, rg skips hidden files + alias fdh='fd --hidden' # By default, fd skips hidden files + alias tpr='tput reset' + alias define=sdcv # uses stardict to lookup a word + alias perms='ls -ld' # list the permissions of a directory + alias rmrf='rm -rf' # sometimes the space and dash are too much... + alias open=xdg-open + alias stopx='sudo service lightdm stop' # stop X server session + alias please='eval sudo $history[1]' + alias chrome=google-chrome + alias sys='systemctl' + alias sysu='systemctl --user' + + # Filesystem + # TODO: Depend on `mkdir_cd`. + alias mdd=mkdir_cd + alias ls='exa --sort=type' + alias ll='exa --long --sort=type' + alias la='exa --long --all --sort=type' + # TODO: Depend on these functions once they're defined. + alias files=laf + alias dirs=lad + alias links=lal + + # Device and power management + alias off='shutdown now' + alias suspend='systemctl suspend' + alias hibernate='systemctl hibernate' + + # TODO: Debug `Error: No interface specified.`. + alias wfls='nmcli device wifi' + alias wfc='nmcli device connect' + + # Tmux + alias tls='tmux list-sessions' + alias ta ='tmux attach' + alias td ='tmux detach' + + # Dropbox + alias drst='dropbox.py status' + + # GPG + alias gpged='gpg --edit-key wpcarro@gmail.com' + alias gpge='gpg --encrypt' + alias gpgd='gpg --decrypt' + alias gpgls='gpg --list-keys' + + # Git + # alias glp='git log --graph --pretty="format:"%Cred%h%Creset -%Cblue %an %Creset - %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset" --abbrev-commit --date=relative' + alias ga='git add' + alias gc='git commit' + alias gco='git checkout' + alias gd='git diff' + alias gp='git push' + alias grbi='git rebase --interactive' + alias grba='git rebase --abort' + alias grbc='git rebase --continue' + alias gprom='git pull --rebase origin master' + alias gca='git commit --amend' + alias gcan='git commit --amend --no-edit' + alias gpf='git push --force' + alias gpff='git push --force --no-verify' + alias gds='git diff --staged' + alias gfx='git commit --fixup' + alias gsh='git show' + alias gwip='git add . && git commit -m wip' + alias gpr='git pull-request' + alias gst='git status' + + # Mercurial + # The attempt here is to map my well-known, existing `git` aliases to their + # Mercurial counterparts. Some may map 1:1, others may be like putting a square + # peg into a round hole. I will try and use my best judgement in these cases + # while erring on the side of unifying the two APIs. + alias hgst='hg status' + alias hglp'=hg xl' + alias hgp='hg uploadchain' + alias hga='hg add' + alias hgc='hg commit' + alias hgcan='hg amend' + alias hgpr='hg mail -r . -m' + alias hgd='hg diff' + alias hgsh='hg export' + alias hgco='hg update' + alias hgls='hg citc --list' + alias hgrc='hg rebase --continue' + alias hgra='hg rebase --abort' + alias hgrm='hg citc -d' + alias hgconflicts='hg resolve --list "set:unresolved()"' + + # Aptitude (apt) + alias apti='sudo apt-get install --assume-yes' + alias aptrm='sudo apt remove' + + # Google stuff + alias bzb='blaze build' + alias bzt='blaze test --test_output=all' + alias br=borgcfg + alias pils='p4 listclients' + alias pirm='p4 citc -d' + alias ppls='g4 listclients | sed \'s/^Client wpcarro://\' | sed \'s/:[0-9]*:citc.*$//g\'' + alias pprm='p4 citc -d -f' # WARNING: This will forcefully delete a CitC client even if contains pending changes. + alias aclcheck=/google/data/ro/projects/ganpati/aclcheck +end diff --git a/configs/.config/nixpkgs/config.nix b/configs/.config/nixpkgs/config.nix new file mode 100644 index 000000000000..1dd1750ae025 --- /dev/null +++ b/configs/.config/nixpkgs/config.nix @@ -0,0 +1,3 @@ +{ + allowUnfree = true; +} diff --git a/configs/.config/nixpkgs/home.nix b/configs/.config/nixpkgs/home.nix new file mode 100644 index 000000000000..d9b3cae931a8 --- /dev/null +++ b/configs/.config/nixpkgs/home.nix @@ -0,0 +1,90 @@ +{ config, pkgs, ... }: + +{ + home = { + packages = with pkgs; [ + bat + exa + ripgrep + fd + pass + tokei + nmap + tldr + diskus + jq + pup + ]; + sessionVariables = { + }; + stateVersion = "19.09"; + }; + + ############################################################################## + # Programs + ############################################################################## + + programs.home-manager = { + enable = true; + path = builtins.toPath ~/home-manager; + }; + + programs.git = { + enable = true; + userName = "William Carroll"; + userEmail = "wpcarro@gmail.com"; + aliases = { + today = "! git log --date=relative --since=00:00:00 --all --no-merges --oneline --author=\"$(git config --get user.email)\""; + yday = "! git log --since=yesterday.midnight --until=today.midnight --oneline --author=\"$(git config --get user.email)\""; + changed-files = "! git --no-pager diff --name-only $(current_branch) $(git merge-base $(current_branch) master)"; + conflicts = "! git --no-pager diff --name-only --diff-filter=U"; + unstage = "reset HEAD --"; + }; + extraConfig = { + push.default = "current"; + rebase = { + autosquash = true; + autostash = true; + }; + rerere.enabled = true; + }; + }; + + programs.gpg = { + enable = true; + settings = { + keyserver = "hkp://pgp.mit.edu"; + }; + }; + + programs.ssh = { + enable = true; + matchBlocks = { + desktop = { + user = "wpcarro"; + hostname = "zeno.lon.corp.google.com"; + }; + socrates = { + user = "wpcarro"; + hostname = "84.92.33.141"; + }; + }; + }; + + programs.fzf = rec { + defaultCommand = "fd --hidden --follow --exclude '.git'"; + fileWidgetCommand = defaultCommand; + }; + + ############################################################################## + # Services + ############################################################################## + + services.lorri.enable = true; + + services.gpg-agent = { + enable = true; + defaultCacheTtl = 7200; + maxCacheTtl = 7200; + }; +} diff --git a/configs/.config/nvim/init.vim b/configs/.config/nvim/init.vim new file mode 100644 index 000000000000..57cfe7ea6a20 --- /dev/null +++ b/configs/.config/nvim/init.vim @@ -0,0 +1,668 @@ +" -- BEGIN: Vundle config -- +set nocompatible " be iMproved, required +filetype off " required + +" set the runtime path to include Vundle and initialize +" share Vundle between vim and neovim +set rtp+=~/.vim/bundle/Vundle.vim +set rtp+=~/.config/nvim/bundle/Vundle.vim +call vundle#begin() +" alternatively, pass a path where Vundle should install plugins +"call vundle#begin('~/some/path/here') + +" let Vundle manage Vundle, required +Plugin 'VundleVim/Vundle.vim' + +" Rust IDE features +Plugin 'racer-rust/vim-racer' + +set hidden +let g:racer_experimental_completer = 1 +autocmd FileType rust nmap gd <Plug>(rust-def) +autocmd FileType rust nmap gs <Plug>(rust-def-split) +autocmd FileType rust nmap gx <Plug>(rust-def-vertical) +autocmd FileType rust nmap <leader>gd <Plug>(rust-doc) + +Plugin 'xolox/vim-misc' + +" The following are examples of different formats supported. +" Keep Plugin commands between vundle#begin/end. + +" Displays git information in airline. +Plugin 'tpope/vim-fugitive' + +" easier file navigation +Plugin 'tpope/vim-vinegar' + +" Displays git-tracked C*UD ops within gutter. +Plugin 'airblade/vim-gitgutter' + +" Fuzzy-finder +Plugin 'kien/ctrlp.vim' + +" Grep file contents +Plugin 'mileszs/ack.vim' + +" Syntax and other light-weight suppor for a variety of languages +Plugin 'sheerun/vim-polyglot' + +" Themes +Plugin 'deviantfero/wpgtk.vim' +Plugin 'rainglow/vim' + + +" Executes shell commands and pipes output into new Vim buffer. +Plugin 'sjl/clam.vim' + +" Multiple cursors for simultaneous edits. +" NOTE: use <C-n> to run miltiple cursors not <C-d> +Plugin 'terryma/vim-multiple-cursors' + +" Visualize buffers +Plugin 'vim-airline/vim-airline' +Plugin 'vim-airline/vim-airline-themes' + +" Visually align assignments +Plugin 'godlygeek/tabular' + +" Visually Highlight and comment code. +Plugin 'tpope/vim-commentary' + +" Macros for quotes, parens, etc. +Plugin 'tpope/vim-surround' + +" Allows Plugins to be repeated with `.` character +Plugin 'tpope/vim-repeat' + +" Pairs of mappings +Plugin 'tpope/vim-unimpaired' + +" LISPs support +Plugin 'guns/vim-sexp' +Plugin 'tpope/vim-sexp-mappings-for-regular-people' +let g:sexp_enable_insert_mode_mappings = 0 +let g:sexp_filetypes = '' + +" Seamlessly navigate Vim and Tmux with similar bindings. +Plugin 'christoomey/vim-tmux-navigator' + +" Async `:make` for code linting etc. +Plugin 'neomake/neomake' + +" Better buffer mgt than CtrlP +Plugin 'yegappan/mru' + +Plugin 'zanglg/nova.vim' + +" Emulates Emacs's Helm Swoop search +Plugin 'pelodelfuego/vim-swoop' + +" Transparent encryption + decryption +Plugin 'jamessan/vim-gnupg' + +" Javascript auto-formatting +" Plugin 'prettier/vim-prettier', { +" \ 'do': 'yarn install', + " \ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown'] } + +" Support Org mode +Plugin 'jceb/vim-orgmode' + +" Autocompletion +Plugin 'junegunn/fzf' + +" Text objects made easy +Plugin 'kana/vim-textobj-user' + +" Elixir text objects +Plugin 'andyl/vim-textobj-elixir' + +" Making HTML editing faster +Plugin 'mattn/emmet-vim' + +" Snippets for all languages +Plugin 'honza/vim-snippets' + +" Automatic bracket insertion +Plugin 'jiangmiao/auto-pairs' + +" Linting & error warnings +Plugin 'vim-syntastic/syntastic' + +" Angular.js support +Plugin 'burnettk/vim-angular' + +" Asynchronous Linting Engine +Plugin 'w0rp/ale' + +call vundle#end() " required +filetype plugin indent on " required +" Put your non-Plugin stuff after this line +" -- END: Vundle config -- + +" Changes <leader> to <space> character. +let mapleader = " " + + +" Highlight column width +set textwidth=80 +set colorcolumn=+0 + +" autoreload a file when it changes on disk +set autoread + +" default to case-insensitive searching +set ignorecase + +" JSX configuration +let g:jsx_ext_required = 0 + + +autocmd FileType reason nnoremap <buffer> gd :call LanguageClient_textDocument_definition()<CR> +autocmd FileType reason nnoremap <buffer> gf :call LanguageClient_textDocument_formatting()<CR> +autocmd FileType reason nnoremap <buffer> gh :call LanguageClient_textDocument_hover()<CR> +autocmd FileType reason nnoremap <buffer> gr :call LanguageClient_textDocument_rename()<CR> + +" Replace <CR> with G for faster navigation +nnoremap <CR> G +onoremap <CR> G +vnoremap <CR> G + +" Mirror ZLE KBD +inoremap <M-'> :echo "Working"<CR> + +" Syntastic configuration +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 +" let g:syntastic_javascript_checkers = ['eslint'] +let g:syntastic_javascript_eslint_generic = 1 +" this is a hack to prevent a false negative +" https://github.com/vim-syntastic/syntastic/issues/1692 +" let g:syntastic_javascript_eslint_exec = '/bin/ls' +" let g:syntastic_javascript_eslint_exe = 'npx eslint' +" let g:syntastic_javascript_eslint_args = '-f compact' + +" javascript autocompletion +" autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS +" autocmd FileType javascript nnoremap <buffer> gf :Prettier<CR> + +" Maximize the current window +" Similar to Tmux mapping alt-z in my tmux.conf +nnoremap t% :tab sp<CR> + +" Allow C-g to act like C-c the way it does in Emacs +cnoremap <C-g> <C-c> + +" Prettier configuration +" let g:prettier#exec_cmd_async = 1 +" force Prettier to run on files even without the @format pragma +" let g:prettier#autoformat = 0 + + +" Basic settings +" Thin cursor on INSERT mode +if has('nvim') + let $NVIM_TUI_ENABLE_CURSOR_SHAPE = 1 +endif + +set number +set nowrap +set tabstop=2 +set expandtab +set shiftwidth=2 +set background=dark + +syntax enable +colorscheme peacock + +" Vim in terminal cannot have a different font from the one set within your +" terminal. However, this setting will set the font for the GUI version. +if has('gui_running') + set guifont=Operator\ Mono:h12 +endif + +if has('termguicolors') + set termguicolors +endif + +if &term =~# '^screen' + let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" + let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" +endif + +set history=1000 +set undolevels=1000 + +set t_Co=255 + +" Support italics +highlight Comment cterm=italic + + +" quickly edit popular configuration files +nnoremap <leader>ev :vsplit $MYVIMRC<CR> +nnoremap <leader>ee :vsplit ~/.emacs.d/init.el<CR> +nnoremap <leader>ez :vsplit ~/.zshrc<CR> +nnoremap <leader>ea :vsplit ~/aliases.zsh<CR> +nnoremap <leader>ef :vsplit ~/functions.zsh<CR> +nnoremap <leader>el :vsplit ~/variables.zsh<CR> +nnoremap <leader>ex :vsplit ~/.Xresources<CR> + +" quickly source your vimrc +nnoremap <leader>sv :source $MYVIMRC<CR> + +" quickly edit your snippets +nnoremap <leader>es :vsplit<CR>:edit ~/.vim/bundle/vim-snippets/snippets/reason.snippets<CR> + + +" Auto resize window splits +autocmd VimResized * wincmd = + + +" Neomake Settings +autocmd! BufWritePost * Neomake + +" Elixir linting +let g:neomake_elixir_credo_maker = { + \ 'exe': 'mix', + \ 'args': ['credo', 'list', '%:p', '--format=oneline'], + \ 'errorformat': + \ '%W[F] %. %f:%l:%c %m,' . + \ '%W[F] %. %f:%l %m,' . + \ '%W[R] %. %f:%l:%c %m,' . + \ '%W[R] %. %f:%l %m,' . + \ '%I[C] %. %f:%l:%c %m,' . + \ '%I[C] %. %f:%l %m,' . + \ '%-Z%.%#' + \ } + + +let g:neomake_elixir_enabled_makers = ['mix', 'credo'] + +augroup my_error_signs + au! + autocmd ColorScheme * hi NeomakeErrorSign ctermfg=203 guifg=#ff5f5f + autocmd ColorScheme * hi NeomakeWarningSign ctermfg=209 guifg=#ffaf00 + autocmd ColorScheme * hi NeomakeInfoSign ctermfg=183 guifg=#dfafff + autocmd ColorScheme * hi NeomakeMessageSign ctermfg=27 guifg=#0087ff +augroup END + + +" templates +if has("autocmd") + autocmd BufNewFile *.c 0r ~/.config/nvim/templates/boilerplate.c + autocmd BufNewFile *.rs 0r ~/.config/nvim/templates/boilerplate.rs +endif + +let g:neomake_error_sign = { + \ 'text': '>>', + \ 'texthl': 'NeoMakeErrorSign', + \ } + +let g:neomake_warning_sign = { + \ 'text': '>>', + \ 'texthl': 'NeoMakeWarningSign', + \ } + +let g:neomake_info_sign = { + \ 'text': '>>', + \ 'texthl': 'NeoMakeInfoSign', + \ } + +let g:neomake_message_sign = { + \ 'text': '>>', + \ 'texthl': 'NeoMakeMessageSign', + \ } + +function! <SID>LocationPrevious() + try + lprev + catch /^Vim\%((\a\+)\)\=:E553/ + llast + endtry +endfunction + +function! <SID>LocationNext() + try + lnext + catch /^Vim\%((\a\+)\)\=:E553/ + lfirst + endtry +endfunction + +nnoremap <Leader>[ :call <SID>LocationPrevious()<CR> +nnoremap <Leader>] :call <SID>LocationNext()<CR> + + +" Alchemist settings +let g:alchemist#elixir_erlang_src = '/usr/local/share/src' + + +" Airline Settings +" Enables the list of buffers. +let g:airline#extensions#tabline#enabled = 0 + +" Buffer numbers alongside files +let g:airline#extensions#tabline#buffer_nr_show = 0 + +" Shows the filename only. +let g:airline#extensions#tabline#fnamemod = ':t' + +" Allow glyphs in airline +let g:airline_powerline_fonts = 1 + +" Change Airline theme +let g:airline_theme = 'hybrid' + + +" Vim-Swoop Settings +" Edits colorscheme +let g:swoopHighlight = ["hi! link SwoopBufferLineHi Warning", "hi! link SwoopPatternHi Error"] + + +" Jump to buffers. +nmap <F1> :1b<CR> +nmap <F2> :2b<CR> +nmap <F3> :3b<CR> +nmap <F4> :4b<CR> +nmap <F5> :5b<CR> +nmap <F6> :6b<CR> +nmap <F7> :7b<CR> +nmap <F8> :8b<CR> +nmap <F9> :9b<CR> + + +" It's the twenty-first century...no swaps. +set noswapfile + + +" Allow visual tab completion in command mode +set wildmenu + + +" Show Vim commands as they're being input. +set showcmd + + +" Code folding +" set foldmethod=indent +" set foldnestmax=10 +" set nofoldenable +" set foldlevel=4 + + +" emulate ci" and ci' behavior +nnoremap ci( f(%ci( +nnoremap ci[ f[%ci[ + + +" extend functionality of <C-e> & <C-y> scrolling +nnoremap <C-e> <C-e>j +vnoremap <C-e> <C-e>j +nnoremap <C-y> <C-y>k +vnoremap <C-y> <C-y>k + + +" Opens all folds within the buffer +" nnoremap ZZ zR + +" Closes all folds within the buffer +" nnoremap zz zM + +" Opens all folds beneath the cursor +" NOTE: j is the character to go down +" nnoremap zJ zO + +" Opens single fold beneath the cursor +" NOTE: j is the character to go down +" nnoremap zj zo + +" Opens single fold beneath the cursor +" NOTE: k is the character to go down +" nnoremap zK zC + +" Opens single fold beneath the cursor +" NOTE: k is the character to go down +" nnoremap zk zc + + +" Save shortcut +nnoremap <C-s> :w<CR> + + +" Switch to MRU'd buffer +nnoremap <leader><leader> <C-^> + + +" Alternative MRU to CtrlP MRU +nnoremap <leader>b :MRU<CR> + + +" Supports mouse interaction. +set mouse=a + + +" Highlights matches during a search. +set hlsearch + +" Clear highlight +noremap <silent> <leader>h :nohlsearch<bar>:echo<CR> + + +" backspace settings +set backspace=2 +set backspace=indent,eol,start + + +" Javascript specific variables +let g:javascript_plugin_jsdoc = 1 + +" GlobalListchars +set list +set listchars=tab:··,trail:·,nbsp:· + + +" Keeps everything concealed at all times. Even when cursor is on the word. +set conceallevel=1 +set concealcursor=nvic + + +" map jk to <Esc> +inoremap jk <Esc> + + +" Hybrid mode for Vim +inoremap <C-a> <Esc>I +inoremap <C-e> <Esc>A + +inoremap <M-b> <S-Left> +inoremap <M-f> <S-Right> + +inoremap <C-b> <Left> +inoremap <C-f> <Right> +inoremap <C-p> <Up> +inoremap <C-n> <Down> + +" temporarily disable <C-p> in normal mode so it doesn't attempt to index all of +" Google3. +nnoremap <C-p> :echo "You are attempting to index all of Google3. Aborting..."<CR> + +" tab maintenence +nnoremap <C-t> :tabnew<CR> +nnoremap <C-w> :tabclose<CR> +nnoremap <Tab> :tabnext<CR> +nnoremap <S-Tab> :tabprevious<CR> + +" Manage Vertical and Horizontal splits +nnoremap sl <Esc>:vs<CR><C-w>l +nnoremap sh <Esc>:vs<CR> +nnoremap sj <Esc>:sp<CR><C-w>j +nnoremap sk <Esc>:sp<CR> + + +" Delete (i.e. "close") the currently opened buffer +" TODO: unless it's a split window, which should be :q +nnoremap <leader>q :bdelete<CR> + + +" Set CtrlP runtime path +set runtimepath^=~/.vim/bundle/ctrlp.vim + + +" Pane movement +let g:tmux_navigator_no_mappings = 1 + +nnoremap <silent> <M-h> :TmuxNavigateLeft<CR> +nnoremap <silent> <M-j> :TmuxNavigateDown<CR> +nnoremap <silent> <M-k> :TmuxNavigateUp<CR> +nnoremap <silent> <M-l> :TmuxNavigateRight<CR> +nnoremap <silent> <M-q> :q<CR> + +" make Y do what is intuitive given: +" D: deletes until EOL +" C: changes until EOL +" Y: (should) yank until EOL +nnoremap Y y$ + + +" scrolling and maintaing mouse position +" nnoremap <C-j> j<C-e> +" nnoremap <C-k> k<C-y> + + +" remap redo key that is eclipsed by `rotate` currently +nnoremap U :redo<CR> + + +" Define highlighting groups +" NOTE: The ANSII aliases for colors will change when iTerm2 settings are +" changed. +highlight InterestingWord1 ctermbg=Magenta ctermfg=Black +highlight InterestingWord2 ctermbg=Blue ctermfg=Black + +" h1 highlighting +nnoremap <silent> <leader>1 :execute '2match InterestingWord1 /\<<c-r><c-w>\>/'<CR> +nnoremap <silent> <leader>x1 :execute '2match none'<CR> +vnoremap <silent> <leader>1 :execute '2match InterestingWord1 /\<<c-r><c-w>\>/'<CR> + +" h2 highlighting +nnoremap <silent> <leader>2 :execute '3match InterestingWord2 /\<<c-r><c-w>\>/'<CR> +nnoremap <silent> <leader>x2 :execute '3match none'<CR> + +"clear all highlighted groups +nnoremap <silent> <leader>xx :execute '2match none'<CR> :execute '3match none'<CR> hh + + +" pasteboard copy & paste +set clipboard+=unnamedplus + + +" Manage 80 char line limits +highlight OverLength1 ctermbg=Magenta ctermfg=Black +highlight OverLength2 ctermbg=LightMagenta ctermfg=Black +highlight OverLength3 ctermbg=White ctermfg=Black +" match OverLength3 /\%81v.\+/ +match OverLength2 /\%91v.\+/ +" match OverLength3 /\%101v.\+/ + +nnoremap <leader>w :w<CR> + + +" Resize split to 10,20,...,100 chars +" Uncomment the next lines for support at those sizes. +" These bindings interfere with the highlight groups, however. +" Increases the width of a vertical split. +" nnoremap <leader>1 :vertical resize 10<CR> +" nnoremap <leader>2 :vertical resize 20<CR> +nnoremap <leader>3 :vertical resize 30<CR> +nnoremap <leader>4 :vertical resize 40<CR> +nnoremap <leader>5 :vertical resize 50<CR> +nnoremap <leader>6 :vertical resize 60<CR> +nnoremap <leader>7 :vertical resize 70<CR> +nnoremap <leader>8 :vertical resize 80<CR> +nnoremap <leader>9 :vertical resize 90<CR> +nnoremap <leader>0 :vertical resize 100<CR> + + +" Increases the height of a horizontal split. +nnoremap <leader>v1 :resize 5<CR> +nnoremap <leader>v2 :resize 10<CR> +nnoremap <leader>v3 :resize 15<CR> +nnoremap <leader>v4 :resize 20<CR> +nnoremap <leader>v5 :resize 25<CR> +nnoremap <leader>v6 :resize 30<CR> +nnoremap <leader>v7 :resize 35<CR> +nnoremap <leader>v8 :resize 40<CR> +nnoremap <leader>v9 :resize 45<CR> +nnoremap <leader>v0 :resize 50<CR> + + +" BOL and EOL +nnoremap H ^ +vnoremap H ^ +nnoremap L $ +vnoremap L $ + + +" Search for visually selected text +vnoremap // y/<C-r>"<CR>N + + +" trim trailing whitespace on save +" Are there any file type where I wouldn't want this? +autocmd BufWritePre *.{js,py,tpl,less,html,ex,exs,txt,hs,java,rs,ml} :%s/\s\+$//e + + +" Use .gitignore file to populate Ctrl-P +let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f'] + + +" Ignores dirs and files +let g:ctrlp_custom_ignore = { + \ 'dir': 'node_modules', + \ 'file': '\v\.(exe|dll|png|jpg|jpeg)$' +\} + + +" WIP: Run elixir tests on that line +" TODO: only register binding in *.exs? file extensions +nnoremap <leader>t :call ExTestToggle()<CR> + + +" Jumps from an Elixir module file to an Elixir test file. +fun! ExTestToggle() + if expand('%:e') == "ex" + + let test_file_name = expand('%:t:r') . "_test.exs" + let test_file_dir = substitute(expand('%:p:h'), "/lib/", "/test/", "") + let full_test_path = join([test_file_dir, test_file_name], "/") + + e `=full_test_path` + + elseif match(expand('%:t'), "_test.exs") != -1 + + let test_file_name = expand('%:t:r') + let offset_amt = strlen(test_file_name) - strlen("_test") + let module_file_name = strpart(test_file_name, 0, offset_amt) . ".ex" + let module_file_dir = substitute(expand('%:p:h'), "/test/", "/lib/", "") + let full_module_path = join([module_file_dir, module_file_name], "/") + + e `=full_module_path` + + endif +endfun + + +" Creates intermediate directories and file to match current buffer's filepath +fun! CreateNonExistingDirsAndFile() + ! echo "Creating directory..." && mkdir -p %:p:h && echo "Created directory." && echo "Creating file..." && touch %:t:p && echo "Created file." + + " Write the buffer to the recently created file. + w +endfun diff --git a/configs/.config/nvim/templates/boilerplate.c b/configs/.config/nvim/templates/boilerplate.c new file mode 100644 index 000000000000..949743d72587 --- /dev/null +++ b/configs/.config/nvim/templates/boilerplate.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +int main() { + printf("Hello, world!"); + return 0; +} diff --git a/configs/.config/nvim/templates/boilerplate.rs b/configs/.config/nvim/templates/boilerplate.rs new file mode 100644 index 000000000000..c83adbc69fa0 --- /dev/null +++ b/configs/.config/nvim/templates/boilerplate.rs @@ -0,0 +1,5 @@ +fn main() { + // The statements here will be executed when the compiled binary is called. + + println!("Hello, world!"); +} diff --git a/configs/.config/systemd/user/clipmenud.service b/configs/.config/systemd/user/clipmenud.service new file mode 100644 index 000000000000..fac317f3f072 --- /dev/null +++ b/configs/.config/systemd/user/clipmenud.service @@ -0,0 +1,18 @@ +[Unit] +Description=Clipmenu daemon + +[Service] +ExecStart=clipmenud +Restart=always +RestartSec=500ms +Environment=DISPLAY=:0 + +MemoryDenyWriteExecute=yes +NoNewPrivileges=yes +ProtectControlGroups=yes +ProtectKernelTunables=yes +RestrictAddressFamilies= +RestrictRealtime=yes + +[Install] +WantedBy=default.target diff --git a/configs/.config/systemd/user/default.target.wants/clipmenud.service b/configs/.config/systemd/user/default.target.wants/clipmenud.service new file mode 120000 index 000000000000..387f2023d2d2 --- /dev/null +++ b/configs/.config/systemd/user/default.target.wants/clipmenud.service @@ -0,0 +1 @@ +/usr/local/google/home/wpcarro/.config/systemd/user/clipmenud.service \ No newline at end of file diff --git a/configs/.config/systemd/user/lieer-google.service b/configs/.config/systemd/user/lieer-google.service new file mode 100644 index 000000000000..2f79ed6ccaa8 --- /dev/null +++ b/configs/.config/systemd/user/lieer-google.service @@ -0,0 +1,7 @@ +[Unit] +Description=Lieer sync for account 'google' + +[Service] +Type=oneshot +ExecStart=/nix/store/n6c4pr4fyrsjfksspkapb7yqc6fzl166-corp-lieer/bin/gmi sync +WorkingDirectory=%h/mail/account.google diff --git a/configs/.config/systemd/user/lieer-google.timer b/configs/.config/systemd/user/lieer-google.timer new file mode 100644 index 000000000000..a073da25ea82 --- /dev/null +++ b/configs/.config/systemd/user/lieer-google.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Run lieer sync for account 'google' + +[Timer] +OnActiveSec=1 +OnUnitActiveSec=120 + +[Install] +WantedBy=timers.target diff --git a/configs/.config/systemd/user/timers.target.wants/lieer-google.timer b/configs/.config/systemd/user/timers.target.wants/lieer-google.timer new file mode 120000 index 000000000000..e9f2cab3bcec --- /dev/null +++ b/configs/.config/systemd/user/timers.target.wants/lieer-google.timer @@ -0,0 +1 @@ +/usr/local/google/home/wpcarro/.config/systemd/user/lieer-google.timer \ No newline at end of file |