From e27bd2a635743a3c740515eb14b11e7123dbb459 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Thu, 21 Dec 2017 12:18:17 -0600 Subject: [PATCH] Work on modular vim config, mutt stuff --- apps/mutt/muttrc | 33 ++++ apps/neovim/init.vim | 397 +------------------------------------------ de/bar/bar.bash | 6 +- setup | 6 +- 4 files changed, 49 insertions(+), 393 deletions(-) create mode 100644 apps/mutt/muttrc diff --git a/apps/mutt/muttrc b/apps/mutt/muttrc new file mode 100644 index 0000000..ebaa240 --- /dev/null +++ b/apps/mutt/muttrc @@ -0,0 +1,33 @@ +# set imap_user = "wraithx2@gmail.com" +# set imap_pass = "`pass google | head -n 1`" +set realname = "Daniel Flanagan" +set from = "daniel@lytedev.io" +set use_from = yes +set envelope_from = yes + +set smtp_url = 'smtps://wraithx2@gmail.com@smtp.gmail.com:465/' +set smtp_pass = `pass google-app-password | head -n 1` +set imap_user = 'wraithx2@gmail.com' +set imap_pass = `pass google-app-password | head -n 1` + +set mbox="imaps://imap.gmail.com/[Gmail]/All Mail" + +set ssl_force_tls = yes +set folder = imaps://imap.gmail.com/ +set spoolfile = +INBOX +set record = "+[Gmail]/Sent Mail" +set postponed = "+[Gmail]/Drafts" +set editor = "nvim" + +# G to get mail +bind index G imap-fetch-mail + +macro index ga "=[Gmail]/All Mail" "Go to all mail" +macro index gd "=[Gmail]/Drafts" "Go to drafts" +macro index gi "=INBOX" "Go to inbox" +macro index gs "=[Gmail]/Starred" "Go to starred messages" +macro index gt "=[Gmail]/Trash" "Go to trash" +macro index,pager d "=[Gmail]/Trash" "Trash" +macro index,pager y "=[Gmail]/All Mail" "Archive" + +set record="" diff --git a/apps/neovim/init.vim b/apps/neovim/init.vim index 3d0ce92..e8219cd 100644 --- a/apps/neovim/init.vim +++ b/apps/neovim/init.vim @@ -1,6 +1,4 @@ -set nocompatible -" initial plugin manager installation if has('nvim') if empty(glob('~/.config/nvim/autoload/plug.vim')) silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim @@ -13,6 +11,7 @@ else endif end +" vim compatibility let $vimdir = $HOME.'/.vim' if has('nvim') let $vimdir = $HOME.'/.config/nvim' @@ -69,8 +68,7 @@ Plug 'junegunn/vim-plug' " plugins -" if vim is being launched to view man pages, don't do our magical session -" stuff! +" if vim is being launched to view man pages, don't do our session stuff! if exists('asmanviewer') let g:prosession_dir = '/dev/null' else @@ -247,46 +245,8 @@ endfun " kill the terminal buffer when the process exits " autocmd TermClose * call feedkeys('') -" whitespace -" use tabs at a two-space width -set tabstop=2 -set shiftwidth=2 -set softtabstop=2 -set noexpandtab - -" auto/smart indent -set autoindent smartindent - -" show certain whitespace characters -set list -set nostartofline -set listchars=trail:·,tab:\ \ ,trail:~ -" set listchars=eol:\ ,tab:>-,trail:~,extends:>,precedes:<,space:· - -" look and feel -" -" try and keep text (and code) to a width of 80 characters -set wrap -set linebreak -set breakindent -set textwidth=80 -set formatoptions=crql1j -" t autowrap to textwidth -" c autowrap comments to textwidth -" r autoinsert comment leader with -" q allow formatting of comments with gq -" l lines longer than 'textwidth' on insert do not get formatted -" 1 don't break a line after a one-letter word - break it before -" j where it makes sense, remove a comment leader when joining lines - -" handle window title -set title - -" don't do syntax highlighting on lines longer than 2048 characters -set synmaxcol=2048 - -" relative line numbers -set relativenumber +let settingsfile=$vimdir.'/settings.vim' +exec 'source ' . settingsfile if exists('asmanviewer') set nonumber " no line numbers when viewing a man page @@ -296,64 +256,6 @@ else set norelativenumber " line numbers endif -" highlight the current line -set nocursorline - -" set cursorcolumn " highlight the current column -" let &colorcolumn=join(range(81,400),",") " colors columns past 80 - -" highlight the 81st character in a line where it exists -highlight ColorColumn ctermbg=magenta ctermfg=7 -call matchadd('ColorColumn', '\%81v', 100) - -set noshowcmd -set nowildmenu -set wildmode=longest,list,full -set cpoptions-=$ -set showmatch -set mouse=a -set mousehide -set backspace=indent,eol,start -set noruler -set lazyredraw -set scrolloff=8 -set sidescrolloff=8 -set splitright -set splitbelow -set noerrorbells -set visualbell -set nobackup -set nowritebackup -set noswapfile -set timeout -set ttimeoutlen=200 -set isfname+=32 - -set vb t_vb= -if has('autocmd') - autocmd GUIEnter * set visualbell t_vb= -endif - -let base16colorspace=256 -set background=dark -colorscheme base16-donokai - -highlight SignColumn ctermbg=black guibg=black -highlight GitGutterAdd ctermbg=black guibg=black -highlight GitGutterDelete ctermbg=black guibg=black -highlight GitGutterChange ctermbg=black guibg=black -highlight GitGutterChangeDelete ctermbg=black guibg=black - -" TODO: need a way to toggle this and maybe make it on by default except in -" files where space indentation is expected -fun! ShowSpaceIndentation() - hi LeadingWhiteSpaces ctermfg=black ctermbg=8 -endfunction -fun! HideSpaceIndentation() - hi LeadingWhiteSpaces ctermfg=black ctermbg=black -endfunction -hi LeadingWhiteSpaces ctermfg=black ctermbg=black - " a toggle-able minimalistic distraction-free text editing mode let s:distractionFreeMode = 0 fun! DistractionFreeModeFunc() @@ -395,297 +297,10 @@ endif nnoremap mz :DistractionFreeMode -:command! SpaceIndents call ShowSpaceIndentation() -:command! ShowSpaceIndents call ShowSpaceIndentation() -:command! HideSpaceIndents call HideSpaceIndentation() :command! DistractionFreeMode call DistractionFreeModeFunc() -hi NonText ctermfg=black guifg=black - -set hidden " allows buffer switching without saving -set shortmess=Ia -set history=1000 - -" undo files -set undofile -set undodir=$vimdir/undo -set undolevels=1000 -set undoreload=10000 - -" backup files -set backupdir=$vimdir/backup -set directory=$vimdir/backup - -" spell file -set spellfile=$vimdir/spell/en.utf-8.add - -" smart case insensitivity by default -set ignorecase -set smartcase -set incsearch -set hlsearch -set wrapscan - -set foldmethod=syntax -set foldlevel=99 -set foldnestmax=10 -set foldlevelstart=0 - -set autowrite -set autochdir -set autoread -set nomodeline -set noshowmode -set noshowcmd - -set laststatus=0 - -" yank to OS clipboard -set clipboard+=unnamed - -" allows for manual and syntax folding... supposedly -augroup vimrc - au BufReadPre * setlocal foldmethod=indent - au BufWinEnter * if &fdm == 'indent' | setlocal foldmethod=manual | endif -augroup END - -set nofoldenable -setlocal nofoldenable - -" jump to last opened position in file except in git commits -let jump_to_pos_blacklist = ['gitcommit'] -if has("autocmd") - au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") && index(jump_to_pos_blacklist, &ft) | exe "normal! g'\"" | endif -endif - -" no empty buffer on startup -autocmd VimEnter * nested if bufname('')=='' && line('$') == 1 && col('$')==1 && !&modified | bd % | endif - -" terminal split in neovim -if has('nvim') - function! TerminalSplit() - let current_file = @% - echo current_file - if match(current_file, "term://*") != -1 - split - terminal - else - split - resize 24 - terminal - endif - endfunction -endif - -" bindings - -" common typo fixes -command! WQ wq -command! Wq wq -command! Wqa wqa -command! W w -command! Q q - -" best leader -let mapleader = "\" - -if has('nvim') - " terminal mappings - " open a terminal split at 80 columns - nnoremap :call TerminalSplit() - tnoremap :call TerminalSplit() - - " close the terminal - tnoremap :q! - - " moving between terminal splits - tnoremap h - tnoremap j - tnoremap k - tnoremap l -endif - -" enter insert mode when entering a terminal buffer -autocmd BufWinEnter,WinEnter term://* startinsert - -" Jump to the next or previous line that has the same level or a lower -" level of indentation than the current line. -" -" exclusive (bool): true: Motion is exclusive -" false: Motion is inclusive -" fwd (bool): true: Go to next line -" false: Go to previous line -" lowerlevel (bool): true: Go to line with lower indentation level -" false: Go to line with the same indentation level -" skipblanks (bool): true: Skip blank lines -" false: Don't skip blank lines -function! NextIndent(exclusive, fwd, lowerlevel, skipblanks) - let line = line('.') - let column = col('.') - let lastline = line('$') - let indent = indent(line) - let stepvalue = a:fwd ? 1 : -1 - while (line > 0 && line <= lastline) - let line = line + stepvalue - if ( ! a:lowerlevel && indent(line) == indent || - \ a:lowerlevel && indent(line) < indent) - if (! a:skipblanks || strlen(getline(line)) > 0) - if (a:exclusive) - let line = line - stepvalue - endif - exe line - exe "normal " column . "|" - return - endif - endif - endwhile -endfunction - -" Moving back and forth between lines of same or lower indentation. -nnoremap [l :call NextIndent(0, 0, 0, 1) -nnoremap ]l :call NextIndent(0, 1, 0, 1) -nnoremap [L :call NextIndent(0, 0, 1, 1) -nnoremap ]L :call NextIndent(0, 1, 1, 1) -vnoremap [l :call NextIndent(0, 0, 0, 1)m'gv'' -vnoremap ]l :call NextIndent(0, 1, 0, 1)m'gv'' -vnoremap [L :call NextIndent(0, 0, 1, 1)m'gv'' -vnoremap ]L :call NextIndent(0, 1, 1, 1)m'gv'' -onoremap [l :call NextIndent(0, 0, 0, 1) -onoremap ]l :call NextIndent(0, 1, 0, 1) -onoremap [L :call NextIndent(1, 0, 1, 1) -onoremap ]L :call NextIndent(1, 1, 1, 1) - -" run make with leader,m -nnoremap m :call RunMake() - -" change buffers with leader,tab -nnoremap :bnext -nnoremap :bprevious - -" don't kill vim -nnoremap K -nnoremap - -" nerdtree -nnoremap :NERDTree - -" run macro across visually selected lines -xnoremap @ :call ExecuteMacroOverVisualRange() -function! ExecuteMacroOverVisualRange() - echo "@".getcmdline() - execute ":'<,'>normal @".nr2char(getchar()) -endfunction - -" quick paragraph formatting -vmap Q gq -nmap Q gqap - -" launch fzf for the current git repo -nnoremap :GitFiles - -" launch fzf for files in the current directory -nnoremap :Files - -" launch fzf for files modified or not in git -nnoremap :GFiles? - -" launch fzf for open buffers (files) -nnoremap :Buffers - -" launch fzf for open buffers (files) -nnoremap l :Buffers - -" switch to previous buffer -nnoremap h :b# - -" use leader j and k to switch buffers as well -nnoremap k :bnext -nnoremap j :bprevious -nnoremap :bnext -nnoremap :bprevious - -" fast word change -nnoremap c ciw -nnoremap C ciW - -" bash-like deletion -inoremap -inoremap - -" clear search higlight -nnoremap / :let @/ = "" - -" remap jk/jj and its variants to escape -inoremap jj -inoremap Jj -inoremap Jj -inoremap JJ -inoremap jk -inoremap Jk -inoremap jK -inoremap JK - -" use hjkl-movement between rows when soft wrapping: -nnoremap j gj -nnoremap k gk -vnoremap j gj -vnoremap k gk - -" camel case movements -map ,w CamelCaseMotion_w -map ,b CamelCaseMotion_b -map ,e CamelCaseMotion_e -map ,ge CamelCaseMotion_ge - -" inner _ objects -omap ib CamelCaseMotion_ib -xmap ib CamelCaseMotion_ib -omap ie CamelCaseMotion_ie -xmap ie CamelCaseMotion_ie - -" a _ objects -" omap aw CamelCaseMotion_aw -" xmap aw CamelCaseMotion_aw -omap ab CamelCaseMotion_ab -xmap ab CamelCaseMotion_ab -omap ae CamelCaseMotion_ae -xmap ae CamelCaseMotion_ae - -" remove trailing whitespace -map mw:%s/\s\+$//:let @/ = ""'w - -" close buffer with leader-w -nnoremap w :bd - -" toggle spell checking: -map :setlocal spell! - -" open urls, files, etc. example: http://google.com: -noremap o :!xdg-open - -" run `make run` -nnoremap R :ProjectRootExe !make run - -" insert newline -" doesn't work in terminals? -noremap i -" noremap i - -" keep that dumb window from popping up (wild something or another) -map q: :q -noremap qqq: q: - -" sane n/N behavior -nnoremap n 'Nn'[v:searchforward] -nnoremap N 'nN'[v:searchforward] - -" better command history navigation -cnoremap -cnoremap - -" keep selection after indenting visual selection -xnoremap < >gv +let bindingsfile=$vimdir.'/bindings.vim' +exec 'source ' . bindingsfile " modify higlight colors hi Search cterm=NONE ctermbg=blue ctermfg=black diff --git a/de/bar/bar.bash b/de/bar/bar.bash index 23fb18b..1f10858 100755 --- a/de/bar/bar.bash +++ b/de/bar/bar.bash @@ -11,7 +11,11 @@ export BAR_ICON_FONT="FontAwesome" export BAR_FONT_SIZE=$(xrdb -query | sed -ne 's/.*font:\s*xft:[^-]*\=\([0-9]*\).*$/\1/p' | head -n 1) export BAR_ICON_FONT_SIZE=$((BAR_FONT_SIZE)) -export GAP=$(bspc wm -d | grep -Po '(windowGap.*?,)' | grep -Po '\d*' | head -n 1) +export GAP=$(bspc wm -d | grep -Po '(windowGap.*?,)' | grep -Po '\-?\d*' | head -n 1) + +if [ "$GAP" -lt 0 ]; then + GAP=0 +fi export BAR_BOTTOM="false" export BAR_VERTICAL_MARGIN=0 diff --git a/setup b/setup index 730e929..86ee4f1 100755 --- a/setup +++ b/setup @@ -75,7 +75,11 @@ links=( "$dfp/de/bar/polybar-config" "$XDG_CONFIG_HOME/polybar/config" # ranger config - "$dfp/pps/ranger/" "$XDG_CONFIG_HOME/ranger/" + "$dfp/apps/ranger/" "$XDG_CONFIG_HOME/ranger/" + + # mutt config + "$dfp/apps/mutt/muttrc" "$XDG_CONFIG_HOME/.muttrc" + "$dfp/apps/mutt/muttrc" "$HOME/.muttrc" # neofetch config "$dfp/apps/neofetch/config" "$XDG_CONFIG_HOME/neofetch/config"