Massively overhauled XMonad's configuration, nvim
This commit is contained in:
parent
d8bda8b49e
commit
230845f938
|
@ -5,4 +5,10 @@ if has('win32') || has('win64')
|
|||
set guiheadroom=0
|
||||
endif
|
||||
|
||||
if has('nvim')
|
||||
if exists('g:GuiLoaded')
|
||||
Guifont! Roboto Mono:h12
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
|
|
|
@ -1,46 +1,80 @@
|
|||
" init.vim
|
||||
|
||||
" -------
|
||||
" Plugins
|
||||
" -------
|
||||
call plug#begin('$HOME/.config/nvim/plugged')
|
||||
call plug#begin('~/.local/share/nvim/plugged')
|
||||
" color schemes
|
||||
Plug 'chriskempson/base16-vim'
|
||||
Plug 'w0ng/vim-hybrid'
|
||||
Plug 'mhinz/vim-janah'
|
||||
Plug 'jacoborus/tender.vim'
|
||||
|
||||
Plug 'sheerun/vim-polyglot'
|
||||
Plug 'vim-scripts/gnuplot.vim'
|
||||
Plug 'baskerville/vim-sxhkdrc'
|
||||
|
||||
Plug 'vim-pandoc/vim-pandoc' | Plug 'vim-pandoc/vim-pandoc-syntax'
|
||||
Plug 'chrisbra/csv.vim'
|
||||
Plug 'mboughaba/i3config.vim'
|
||||
|
||||
Plug 'tpope/vim-git'
|
||||
Plug 'tpope/vim-repeat'
|
||||
Plug 'tpope/vim-eunuch'
|
||||
" Plug 'tpope/vim-eunuch'
|
||||
Plug 'tpope/vim-dispatch'
|
||||
Plug 'tpope/vim-fugitive'
|
||||
Plug 'tpope/vim-surround'
|
||||
Plug 'tpope/vim-markdown'
|
||||
Plug 'tpope/vim-dispatch'
|
||||
Plug 'tpope/vim-unimpaired'
|
||||
Plug 'tpope/vim-commentary'
|
||||
Plug 'tpope/vim-speeddating'
|
||||
Plug 'tpope/vim-projectionist'
|
||||
|
||||
Plug 'mattn/calendar-vim'
|
||||
Plug 'chrisbra/NrrwRgn'
|
||||
Plug 'vim-scripts/SyntaxRange'
|
||||
Plug 'jceb/vim-orgmode'
|
||||
|
||||
Plug 'equalsraf/neovim-gui-shim'
|
||||
|
||||
Plug 'godlygeek/csapprox', { 'for': 'fugitiveblame' }
|
||||
|
||||
Plug 'jmcantrell/vim-virtualenv'
|
||||
Plug 'mileszs/ack.vim'
|
||||
Plug 'neomake/neomake'
|
||||
Plug 'justinmk/vim-dirvish'
|
||||
Plug 'ludovicchabant/vim-gutentags'
|
||||
Plug 'gregsexton/gitv'
|
||||
Plug 'justinmk/vim-dirvish'
|
||||
Plug 'Valloric/ListToggle'
|
||||
|
||||
" Plug 'metakirby5/codi.vim'
|
||||
" Plug 'mhinz/vim-startify'
|
||||
Plug 'metakirby5/codi.vim'
|
||||
|
||||
Plug 'ludovicchabant/vim-gutentags'
|
||||
|
||||
Plug 'AndrewRadev/splitjoin.vim'
|
||||
Plug 'AndrewRadev/linediff.vim'
|
||||
Plug 'jreybert/vimagit'
|
||||
|
||||
Plug 'scrooloose/nerdtree'
|
||||
|
||||
Plug 'junegunn/gv.vim'
|
||||
Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity'] }
|
||||
Plug 'junegunn/fzf.vim'
|
||||
" Plug 'dyng/ctrlsf.vim'
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
|
||||
" Plug 'junegunn/fzf.vim'
|
||||
|
||||
Plug 'ctrlpvim/ctrlp.vim' | Plug 'nixprime/cpsm', { 'do': './install.sh ' }
|
||||
Plug 'itchyny/lightline.vim' | Plug 'daviesjamie/vim-base16-lightline'
|
||||
Plug 'ctrlpvim/ctrlp.vim'
|
||||
Plug 'tacahiroy/ctrlp-funky'
|
||||
Plug 'FelikZ/ctrlp-py-matcher'
|
||||
|
||||
" Plug 'nixprime/cpsm', { 'do': './install.sh ' }
|
||||
|
||||
Plug 'bling/vim-bufferline'
|
||||
Plug 'itchyny/lightline.vim'
|
||||
Plug 'edkolev/tmuxline.vim'
|
||||
Plug 'cocopon/lightline-hybrid.vim'
|
||||
|
||||
Plug 'mbbill/undotree', { 'on': 'UndotreeToggle' }
|
||||
Plug 'godlygeek/tabular', { 'on': ['Tab', 'Tabularize'] }
|
||||
Plug 'majutsushi/tagbar', { 'on': 'TagbarToggle' }
|
||||
Plug 'majutsushi/tagbar'
|
||||
|
||||
Plug 'lervag/vimtex'
|
||||
Plug 'rust-lang/rust.vim'
|
||||
|
@ -49,11 +83,7 @@ call plug#begin('$HOME/.config/nvim/plugged')
|
|||
if has('nvim')
|
||||
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
||||
Plug 'Shougo/neosnippet.vim' | Plug 'Shougo/neosnippet-snippets'
|
||||
" Plug 'Shougo/context_filetype.vim'
|
||||
|
||||
" Plug 'ervandew/supertab'
|
||||
" " snippets
|
||||
" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
|
||||
Plug 'Shougo/context_filetype.vim'
|
||||
|
||||
" " includes completion
|
||||
Plug 'Shougo/neoinclude.vim'
|
||||
|
@ -70,7 +100,6 @@ call plug#begin('$HOME/.config/nvim/plugged')
|
|||
|
||||
Plug 'eagletmt/neco-ghc'
|
||||
Plug 'carlitux/deoplete-ternjs'
|
||||
" Plug 'SevereOverfl0w/deoplete-github'
|
||||
Plug 'fishbullet/deoplete-ruby'
|
||||
Plug 'zchee/deoplete-zsh'
|
||||
Plug 'sebastianmarkow/deoplete-rust'
|
||||
|
@ -81,12 +110,39 @@ call plug#end()
|
|||
" Setup and Configuration
|
||||
" ------------------------
|
||||
|
||||
" use the comma key as <leader>
|
||||
let mapleader = ','
|
||||
|
||||
" use the backslash key as <localleader>
|
||||
let maplocalleader = '\\'
|
||||
|
||||
" set the background type (light/dark) before activating a colorscheme
|
||||
set background=dark
|
||||
|
||||
" enable colorscheme
|
||||
" silent! colorscheme janah
|
||||
|
||||
" " set the colorscheme but dont't throw an error if it's unavailable
|
||||
|
||||
if filereadable(expand("~/.vimrc_background"))
|
||||
let base16colorspace=256
|
||||
source ~/.vimrc_background
|
||||
endif
|
||||
|
||||
silent! colorscheme base16-tomorrow-night
|
||||
" silent! colorscheme hybrid
|
||||
|
||||
" silent! colorscheme tender
|
||||
|
||||
" highlight! Normal ctermbg=NONE guibg=NONE
|
||||
" highlight! NonText ctermbg=NONE guibg=NONE
|
||||
|
||||
" for detecting/enabling platform-specific features
|
||||
if !exists("g:platform")
|
||||
if has("win32") || has("win64")
|
||||
let g:platform='windows'
|
||||
let s:platform='windows'
|
||||
else
|
||||
let g:platform = tolower(substitute(system('uname'), '\n', '', ''))
|
||||
let s:platform = tolower(substitute(system('uname'), '\n', '', ''))
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -96,44 +152,31 @@ if has('nvim')
|
|||
let g:python_host_prog = '/usr/bin/python2'
|
||||
|
||||
if exists('&inccommand')
|
||||
" set inccommand=split
|
||||
set inccommand=nosplit
|
||||
set inccommand=split
|
||||
" set inccommand=nosplit
|
||||
endif
|
||||
|
||||
" if exists('&termguicolors')
|
||||
" set termguicolors
|
||||
" endif
|
||||
if exists('&termguicolors')
|
||||
set termguicolors
|
||||
endif
|
||||
|
||||
tnoremap <Esc> <C-\><C-n>
|
||||
endif
|
||||
|
||||
if filereadable(expand("~/.vimrc_background"))
|
||||
let base16colorspace=256
|
||||
source ~/.vimrc_background
|
||||
endif
|
||||
|
||||
|
||||
" use the comma key as <leader>
|
||||
let mapleader = ','
|
||||
|
||||
" use the backslash key as <localleader>
|
||||
let maplocalleader = '\\'
|
||||
|
||||
" set the colorscheme but dont't throw an error if it's unavailable
|
||||
silent! colorscheme base16-tomorrow-night
|
||||
|
||||
" if available, use ag in place of grep
|
||||
" if executable('ag')
|
||||
" set grepprg=ag\ --vimgrep\ $*
|
||||
" set grepformat=%f:%l:%c:%m
|
||||
" endif
|
||||
if executable("rg")
|
||||
set grepprg=rg\ --vimgrep\ --no-heading
|
||||
set grepformat=%f:%l:%c:%m,%f:%l:%m
|
||||
elseif executable ('ag')
|
||||
let grepprg=ag\ --vimgrep
|
||||
set grepformat=%f:%l:%c:%m,%f:%l:%m
|
||||
endif
|
||||
|
||||
" dark terminal
|
||||
set background=dark
|
||||
" silly windows, not having a real shell
|
||||
if s:platform ==? 'windows'
|
||||
set shell=cmd.exe
|
||||
set shellcmdflag=/c
|
||||
set encoding=utf-8
|
||||
endif
|
||||
|
||||
" only show ten lines of insert-mode completion
|
||||
set pumheight=10
|
||||
|
@ -143,6 +186,8 @@ set colorcolumn=72
|
|||
|
||||
" completion options
|
||||
set completeopt=menu,menuone,longest
|
||||
" set completeopt+=noinsert
|
||||
" set completeopt+=noselect
|
||||
|
||||
" options for diff mode
|
||||
set diffopt=filler,icase,iwhite,vertical
|
||||
|
@ -227,6 +272,7 @@ set wildignore+=log/**
|
|||
set wildignore+=tmp/**
|
||||
set wildignore+=*.png,*.jpg,*.gif
|
||||
set wildignore+=*.so,*.swp,*.zip
|
||||
set wildoptions=tagfile
|
||||
|
||||
" scrolling
|
||||
set scrolloff=10
|
||||
|
@ -236,7 +282,8 @@ set sidescrolloff=15
|
|||
set sidescroll=1
|
||||
|
||||
" shorten messages
|
||||
set shortmess=aIT
|
||||
" set shortmess=aIT
|
||||
set shortmess=aoOTI
|
||||
|
||||
" " command line height
|
||||
" set cmdheight=2
|
||||
|
@ -248,12 +295,35 @@ set noshowmode
|
|||
set undofile
|
||||
set undolevels=5000
|
||||
|
||||
set tags=./tags;/
|
||||
|
||||
" indentation options
|
||||
set breakindent
|
||||
set copyindent
|
||||
set preserveindent
|
||||
set smartindent
|
||||
|
||||
set switchbuf=useopen
|
||||
|
||||
" don't redray the window when executing macros
|
||||
set lazyredraw
|
||||
|
||||
" if has('cscope')
|
||||
" set cscopetag
|
||||
" set csto=0
|
||||
|
||||
" set cscopequickfix=s-,c-,d-,i-,t-,e-
|
||||
" " set cscopeverbose
|
||||
|
||||
" if filereadable('cscope.out')
|
||||
" cs add cscope.out
|
||||
" elseif $CSCOPE_DB != ''
|
||||
" cs add $CDSCOPE_DB
|
||||
" endif
|
||||
" endif
|
||||
|
||||
" set clipboard=unnamedplus
|
||||
|
||||
" -------------
|
||||
" netrw options
|
||||
" -------------
|
||||
|
@ -271,7 +341,6 @@ let g:netrw_list_hide .= ',\(^\|\s\s\)\zs\.\S\+'
|
|||
" :Grep <keyword>
|
||||
command! -nargs=1 -bar Grep execute 'silent! grep! <q-args>' | redraw! | copen
|
||||
|
||||
|
||||
" --------
|
||||
" bindings
|
||||
" --------
|
||||
|
@ -286,17 +355,17 @@ vnoremap >> >gv
|
|||
nnoremap <silent> <Space> @=(foldlevel('.')?'za':'\<Space>')<cr>
|
||||
vnoremap <Space> zf
|
||||
|
||||
" clear trailing whitespace (http://vi.stackexchange.com/a/2285)
|
||||
nnoremap <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar><cr>
|
||||
nnoremap <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar><CR>
|
||||
|
||||
" kill the current buffer
|
||||
nnoremap <silent><leader>K :bdelete<cr>
|
||||
|
||||
" nnoremap <silent>coq :setlocal :copwn
|
||||
" nnoremap <silent>[oq :copen<CR>
|
||||
" nnoremap <silent>]oq :cclose<CR>
|
||||
" [b]uild [p]roject
|
||||
nnoremap <leader>bp :Neomake<CR>
|
||||
|
||||
" insert a hashbang for the current filetype
|
||||
inoreabbrev <expr>#!! '#!/usr/bin/env' . (empty(&filetype) ? '' : ' '.&filetype)
|
||||
|
||||
|
||||
" ---------
|
||||
" Functions
|
||||
" ---------
|
||||
|
@ -325,47 +394,53 @@ endfunction
|
|||
" --------
|
||||
" autocmds
|
||||
" --------
|
||||
augroup vimrc
|
||||
au!
|
||||
" email buffer
|
||||
au BufRead,BufNewFile *mutt-* setf mail
|
||||
autocmd FileType c,cpp setl errorformat=%f:%l:%c:\ %t%s:\ %m
|
||||
autocmd FileType haskell,lhaskell setlocal omnifunc=necoghc#omnifunc
|
||||
autocmd FileType gitcommit nnoremap <buffer> <silent> cA :<C-U>Gcommit --amend --date="$(date)"<CR>
|
||||
|
||||
" error format for clang
|
||||
au FileType c,cpp setl errorformat=%f:%l:%c:\ %t%s:\ %m
|
||||
au FileType haskell,lhaskell setlocal omnifunc=necoghc#omnifunc
|
||||
autocmd FileType markdown setlocal tw=80
|
||||
autocmd BufReadPost fugitive:// setlocal bufhidden=delete
|
||||
|
||||
" for some reason polyglot sets it to javascript.jsx and ignores
|
||||
" g:polyglot_disabled, so use an autocmd to set the correct filetype
|
||||
au FileType javascript.jsx setl ft=javascript
|
||||
" autocmd FileType GV
|
||||
" \ set foldlevel=1
|
||||
" \| nnoremap <buffer> q :qa<cr>
|
||||
" \| nmap <buffer> j j<cr>
|
||||
" \| nmap <buffer> k k<cr>
|
||||
|
||||
" configuration for TeX/LaTeX files
|
||||
au FileType tex call s:latex_setup()
|
||||
" for some reason polyglot sets it to javascript.jsx and ignores
|
||||
" g:polyglot_disabled, so use an autocmd to set the correct filetype
|
||||
au FileType javascript.jsx setl ft=javascript
|
||||
|
||||
" amend commit
|
||||
au FileType gitcommit nnoremap <buffer> <silent> cA :<C-U>Gcommit --amend --date="$(date)"<CR>
|
||||
" augroup vimrc
|
||||
" au!
|
||||
" " email buffer
|
||||
" au BufRead,BufNewFile *mutt-* setf mail
|
||||
|
||||
" unset paste when leaving insert mode
|
||||
au InsertLeave * silent! set nopaste
|
||||
" " error format for clang
|
||||
" " configuration for TeX/LaTeX files
|
||||
" au FileType tex call s:latex_setup()
|
||||
|
||||
" close preview window after completion is done
|
||||
au CompleteDone * pclose!
|
||||
" " amend commit
|
||||
|
||||
if exists('g:plugs["vim-dirvish"]')
|
||||
au FileType dirvish silent keeppatterns g@\v/\.[^\/]+/?$@d
|
||||
" " unset paste when leaving insert mode
|
||||
" au InsertLeave * silent! set nopaste
|
||||
|
||||
" list directories first
|
||||
au FileType dirvish silent :sort r /[^\/]$/
|
||||
" " close preview window after completion is done
|
||||
" au CompleteDone * pclose!
|
||||
|
||||
" Enable :Gstatus and friends
|
||||
au FileType dirvish call fugitive#detect(@%)
|
||||
au FileType dirvish nnoremap <silent><buffer> gr :<C-u>Dirvish %<CR>
|
||||
au FileType dirvish nnoremap <silent><buffer>
|
||||
\ gh :silent keeppatterns g@\v/\.[^\/]+/?$@d<CR>
|
||||
endif
|
||||
augroup END
|
||||
" if exists('g:plugs["vim-dirvish"]')
|
||||
" au FileType dirvish silent keeppatterns g@\v/\.[^\/]+/?$@d
|
||||
|
||||
" insert a hashbang for the current filetype
|
||||
inoreabbrev <expr>#!! '#!/usr/bin/env' . (empty(&filetype) ? '' : ' '.&filetype)
|
||||
" " list directories first
|
||||
" au FileType dirvish silent :sort r /[^\/]$/
|
||||
|
||||
" " Enable :Gstatus and friends
|
||||
" au FileType dirvish call fugitive#detect(@%)
|
||||
" au FileType dirvish nnoremap <silent><buffer> gr :<C-u>Dirvish %<CR>
|
||||
" au FileType dirvish nnoremap <silent><buffer>
|
||||
" \ gh :silent keeppatterns g@\v/\.[^\/]+/?$@d<CR>
|
||||
" endif
|
||||
" augroup END
|
||||
|
||||
" --------------------
|
||||
" plugin configuration
|
||||
|
@ -388,20 +463,92 @@ endif
|
|||
" ctrlp
|
||||
" -----
|
||||
if exists('g:plugs["ctrlp.vim"]')
|
||||
if executable('ag')
|
||||
let g:ctrlp_user_command = 'ag &s -l --nocolor -g ""'
|
||||
|
||||
" prefer ripgrep and if that's not available, try ag.
|
||||
if executable('rg')
|
||||
let s:ctrlp_command = 'rg %s --files --color=never --glob ""'
|
||||
let g:ctrlp_use_caching = 0
|
||||
elseif executable('ag')
|
||||
let s:ctrlp_command = 'ag %s -l --nocolor -g ""'
|
||||
let g:ctrlp_use_caching = 0
|
||||
else
|
||||
s:ctrlp_command = 'find %s -type f'
|
||||
endif
|
||||
|
||||
let g:ctrlp_match_func = { 'match': 'cpsm#CtrlPMatch' }
|
||||
let g:ctrlp_extensions = ['tag', 'line']
|
||||
" what commands ctrlp should use to find files
|
||||
let g:ctrlp_user_command = {
|
||||
\ 'types': {
|
||||
\ 1: ['.git', 'cd %s && git ls-files -co --exclude-standard'],
|
||||
\ 2: ['.hg', 'hg --cwd %s locate -I .'],
|
||||
\ },
|
||||
\ 'fallback': s:ctrlp_command
|
||||
\ }
|
||||
|
||||
" let g:ctrlp_match_func = { 'match': 'cpsm#CtrlPMatch' }
|
||||
let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' }
|
||||
|
||||
" what ctrlp extensions to load
|
||||
let g:ctrlp_extensions = [
|
||||
\ 'tag', 'buffertag', 'quickfix', 'dir', 'changes',
|
||||
\ 'line', 'mixed'
|
||||
\ ]
|
||||
|
||||
" default binding for CtrlP
|
||||
let g:ctrlp_map = '<C-p>'
|
||||
let g:ctrlp_cmd = 'CtrlP'
|
||||
|
||||
let g:ctrlp_working_path_mode = 'ca'
|
||||
let g:ctrlp_open_new_file = 'h'
|
||||
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:10,results:10'
|
||||
|
||||
nnoremap <silent><C-b> :<C-U>CtrlPBuffer<cr>
|
||||
nnoremap <silent><C-t> :<C-u>CtrlPTag<cr>
|
||||
let g:ctrlp_follow_symlinks = 1
|
||||
|
||||
" don't show hidden files
|
||||
let g:ctrlp_show_hidden = 0
|
||||
|
||||
" maximum depth of a directory tree to search
|
||||
let g:ctrlp_max_depth = 32
|
||||
|
||||
" set local directory to the directory of the currently open file, unless
|
||||
" it's the subdirectory of vim's current working dir.
|
||||
let g:ctrlp_working_path_mode = 'ca'
|
||||
|
||||
" open new files in horizontal splits
|
||||
let g:ctrlp_open_new_file = 'h'
|
||||
|
||||
" jump to buffer if file is a already open.
|
||||
let g:ctrlp_switch_buffer = 'et'
|
||||
|
||||
" windows for ctrlp to reuse if possible
|
||||
let g:ctrlp_reuse_window = 'netrw\|help\|quickfix'
|
||||
|
||||
" match window settings
|
||||
let g:ctrlp_match_window = 'bottom,order:tt,min:1,max:10,results:10'
|
||||
|
||||
" show $HOME as ~
|
||||
let g:ctrlp_tilde_home = 1
|
||||
|
||||
" " only show recent files in the current working dir
|
||||
" let g:ctrlp_mruf_relative = 1
|
||||
|
||||
" mappings
|
||||
nnoremap <leader>f :CtrlP<CR>
|
||||
nnoremap <leader>b :CtrlPBuffer<CR>
|
||||
nnoremap <leader>m :CtrlPMRUFiles<CR>
|
||||
nnoremap <leader>l :CtrlPLine<CR>
|
||||
nnoremap <leader>t :CtrlPTag<CR>
|
||||
|
||||
if exists('g:plugs["ctrlp-funky"]')
|
||||
let g:ctrlp_funky_matchtype = 'path'
|
||||
|
||||
" search across multiple buffers
|
||||
let g:ctrlp_funky_multi_buffers = 1
|
||||
|
||||
" set filetype for match window
|
||||
let g:ctrlp_funky_syntax_highlight = 1
|
||||
|
||||
" mappings
|
||||
nnoremap <leader>fu :CtrlPFunky<CR>
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
" ------
|
||||
|
@ -412,6 +559,47 @@ if exists('g:plugs["tagbar"]')
|
|||
let g:tagbar_autofocus = 1
|
||||
let g:tagbar_autoclose = 1
|
||||
|
||||
let g:tagbar_ctags_bin="/usr/bin/ctags"
|
||||
|
||||
let g:tagbar_type_haskell = {
|
||||
\ 'ctagsbin' : 'hasktags',
|
||||
\ 'ctagsargs' : '-x -c -o-',
|
||||
\ 'kinds' : [
|
||||
\ 'm:modules:0:1',
|
||||
\ 'd:data: 0:1',
|
||||
\ 'd_gadt: data gadt:0:1',
|
||||
\ 't:type names:0:1',
|
||||
\ 'nt:new types:0:1',
|
||||
\ 'c:classes:0:1',
|
||||
\ 'cons:constructors:1:1',
|
||||
\ 'c_gadt:constructor gadt:1:1',
|
||||
\ 'c_a:constructor accessors:1:1',
|
||||
\ 'ft:function types:1:1',
|
||||
\ 'fi:function implementations:0:1',
|
||||
\ 'o:others:0:1'
|
||||
\ ],
|
||||
\ 'sro' : '.',
|
||||
\ 'kind2scope' : {
|
||||
\ 'm' : 'module',
|
||||
\ 'c' : 'class',
|
||||
\ 'd' : 'data',
|
||||
\ 't' : 'type'
|
||||
\ },
|
||||
\ 'scope2kind' : {
|
||||
\ 'module' : 'm',
|
||||
\ 'class' : 'c',
|
||||
\ 'data' : 'd',
|
||||
\ 'type' : 't'
|
||||
\ }
|
||||
\ }
|
||||
|
||||
let g:tagbar_type_make = {
|
||||
\ 'kinds': [
|
||||
\ 'm:macros',
|
||||
\ 't:targets'
|
||||
\ ]
|
||||
\ }
|
||||
|
||||
" toggle tagbar
|
||||
nnoremap <F2> :TagbarToggle<CR>
|
||||
endif
|
||||
|
@ -423,18 +611,17 @@ if exists('g:plugs["vimtex"]')
|
|||
let g:tex_flavor = 'latex'
|
||||
|
||||
" enable latexmk compilation
|
||||
let g:vimtex_build_dir = './build'
|
||||
let g:vimtex_latexmk_enabled = 1
|
||||
let g:vimtex_latexmk_optipons = ' ... -synctex=1 ...'
|
||||
|
||||
let g:vimtex_view_method = 'zathura'
|
||||
let g:vimtex_view_enabled = 0
|
||||
|
||||
let g:vimtex_indent_enabled = 0
|
||||
let g:vimtex_complete_enabled = 1
|
||||
let g:vimtex_complete_close_braces = 1
|
||||
let g:vimtex_fold_enabled = 1
|
||||
|
||||
" don't open documents in viewer by default
|
||||
let g:vimtex_view_enabled = 0
|
||||
|
||||
" enable vimtex mappings
|
||||
let g:vimtex_mappings_enabled = 1
|
||||
endif
|
||||
|
@ -443,14 +630,94 @@ endif
|
|||
" vim-lightline
|
||||
" -------------
|
||||
if exists('g:plugs["lightline.vim"]')
|
||||
let g:lightline = { 'colorscheme': 'base16' }
|
||||
let g:bufferline_echo = 0
|
||||
|
||||
let g:bufferline_active_buffer_let = ''
|
||||
let g:bufferline_active_buffer_right = ''
|
||||
let g:bufferline_show_bufnr = 0
|
||||
let g:bufferline_fname_mod = ':~:.'
|
||||
let g:bufferline_pathshorten = 1
|
||||
|
||||
|
||||
" \ 'colorscheme': 'tender',
|
||||
let g:lightline = {
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ],
|
||||
\ [ 'readonly', 'filename', 'modified' ],
|
||||
\ [ 'ctrlpmark' ] ],
|
||||
\ },
|
||||
\ 'component_function': {
|
||||
\ 'readonly': 'StatuslineReadonly',
|
||||
\ 'ctrlpmark': 'StatuslineCtrlP'
|
||||
\ },
|
||||
\ 'component_expand': {
|
||||
\ 'tabs': 'lightline#tabs'
|
||||
\ },
|
||||
\ 'enabled': {
|
||||
\ 'statusline': 1,
|
||||
\ 'tabline':1
|
||||
\ },
|
||||
\ 'separator': {
|
||||
\ 'left': '',
|
||||
\ 'right': ''
|
||||
\ },
|
||||
\ }
|
||||
|
||||
|
||||
function! StatuslineReadonly()
|
||||
return &ft !~? 'help' && &readonly ? '⭤' : ''
|
||||
endfunction
|
||||
|
||||
function! StatuslineCtrlP()
|
||||
if expand('%:t') =~ 'ControlP' && has_key(g:lightline, 'ctrlp_item')
|
||||
call lightline#link('iR'[g:lightline.ctrlp_regex])
|
||||
return lightline#concatenate([g:lightline.ctrlp_prev, g:lightline.ctrlp_item
|
||||
\ , g:lightline.ctrlp_next], 0)
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let g:ctrlp_status_func = {
|
||||
\ 'main': 'CtrlPStatusFunc_1',
|
||||
\ 'prog': 'CtrlPStatusFunc_2',
|
||||
\ }
|
||||
|
||||
function! CtrlPStatusFunc_1(focus, byfname, regex, prev, item, next, marked)
|
||||
let g:lightline.ctrlp_regex = a:regex
|
||||
let g:lightline.ctrlp_prev = a:prev
|
||||
let g:lightline.ctrlp_item = a:item
|
||||
let g:lightline.ctrlp_next = a:next
|
||||
return lightline#statusline(0)
|
||||
endfunction
|
||||
|
||||
function! CtrlPStatusFunc_2(str)
|
||||
return lightline#statusline(0)
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
" ----------
|
||||
" vim-dirvish
|
||||
" ----------
|
||||
" if exists('g:plugs["vim-dirvish"]')
|
||||
" endif
|
||||
if exists('g:plugs["vim-dirvish"]')
|
||||
endif
|
||||
|
||||
" ------------
|
||||
" vim-surround
|
||||
" ------------
|
||||
|
||||
if exists('g:plugs["vim-surround"]')
|
||||
let g:surround_{char2nr('-')} = "<% \r %>"
|
||||
let g:surround_{char2nr('=')} = "<%= \r %>"
|
||||
let g:surround_{char2nr('8')} = "/* \r */"
|
||||
let g:surround_{char2nr('s')} = " \r"
|
||||
let g:surround_{char2nr('^')} = "/^\r$/"
|
||||
|
||||
let g:surround_108 = "\\begin{\1environment: \1}\r\\end{\1\r}.*\r\1}"
|
||||
|
||||
let g:surround_indent = 1
|
||||
endif
|
||||
|
||||
" -----------
|
||||
" haskell-vim
|
||||
|
@ -468,6 +735,9 @@ endif
|
|||
" deoplete
|
||||
" --------
|
||||
if exists('g:plugs["deoplete.nvim"]')
|
||||
|
||||
" here be dragons...
|
||||
|
||||
if !exists('g:deoplete#omni#input_patterns')
|
||||
let g:deoplete#omni#input_patterns = {}
|
||||
endif
|
||||
|
@ -497,10 +767,13 @@ if exists('g:plugs["deoplete.nvim"]')
|
|||
" use smartcase
|
||||
let g:deoplete#enable_smart_case = 1
|
||||
|
||||
" skip the host check
|
||||
let g:deoplete#host_skip_check = 1
|
||||
|
||||
" omni funcs
|
||||
let g:deoplete#omni#functions.html = 'htmlcomplete#CompleteTags'
|
||||
let g:deoplete#omni#functions.css = 'csscomplete#CompleteCSS'
|
||||
let g:deoplete#omni#functions.xml = 'xmlcomplete#CompleteTags'
|
||||
let g:deoplete#omni#functions.css = 'csscomplete#CompleteCSS'
|
||||
let g:deoplete#omni#functions.xml = 'xmlcomplete#CompleteTags'
|
||||
|
||||
" LaTeX completionn
|
||||
let g:deoplete#omni_patterns.tex =
|
||||
|
@ -591,11 +864,18 @@ if exists('g:plugs["deoplete.nvim"]')
|
|||
endif
|
||||
endif
|
||||
|
||||
" -------------
|
||||
" vim-gutentags
|
||||
" -------------
|
||||
|
||||
if exists('g:plugs["vim-gutentags"]')
|
||||
let g:gutentags_ctags_executable_haskell = 'hasktags'
|
||||
endif
|
||||
|
||||
" -------
|
||||
" ack.vim
|
||||
" -------
|
||||
if exists('g:plugs["ack.vim"]')
|
||||
" let g:ackpg = 'ag --vimgrep'
|
||||
let g:ackpreg = 'rg --vimgrep --no-heading'
|
||||
endif
|
||||
|
||||
|
@ -628,36 +908,89 @@ if exists('g:plugs["vim-github-dashboard"]')
|
|||
let g:github_dashboard = { 'username': 'zyeri' }
|
||||
endif
|
||||
|
||||
if exists('g:plugs["ctrlsf.vim"]')
|
||||
nmap <C-F>f <Plug>CtrlSFPrompt
|
||||
vmap <C-F>f <Plug>CtrlSFVwordPath
|
||||
vmap <C-F>F <Plug>CtrlSFVwordExec
|
||||
nmap <C-F>n <Plug>CtrlSFCwordPath
|
||||
nmap <C-F>p <Plug>CtrlSFPwordPath
|
||||
nnoremap <C-F>o :CtrlSFOpen<CR>
|
||||
nnoremap <C-F>t :CtrlSFToggle<CR>
|
||||
inoremap <C-F>t <Esc>:CtrlSFToggle<CR>
|
||||
nmap <C-F>l <Plug>CtrlSFQuickfixPrompt
|
||||
vmap <C-F>l <Plug>CtrlSFQuickfixVwordPath
|
||||
vmap <C-F>L <Plug>CtrlSFQuickfixVwordExec
|
||||
endif
|
||||
|
||||
|
||||
" ----------
|
||||
" ListToggle
|
||||
" ----------
|
||||
if exists('g:plugs["ListToggle"]')
|
||||
let g:lt_location_list_toggle_map = '<leader>ll'
|
||||
let g:lt_quickfix_list_toggle_map = '<leader>qf'
|
||||
endif
|
||||
|
||||
if exists('g:plugs["vim-pandoc"]')
|
||||
" enabled modules
|
||||
let g:pandoc#keyboard#use_default_mappings = 1
|
||||
" formatting options
|
||||
" let g:pandoc#formatting#mode = "ha"
|
||||
" let g:pandoc#formatting#textwidth = 72
|
||||
" -------
|
||||
" neomake
|
||||
" -------
|
||||
if exists('g:plugs["neomake"]')
|
||||
let g:neomake_echo_current_error = 1
|
||||
let g:neomake_open_list = 2
|
||||
|
||||
" what LaTeX engine should be used
|
||||
let g:pandoc#command#latex_engine = "lualatex"
|
||||
let g:neomake_make_maker = {
|
||||
\ 'exe': 'make',
|
||||
\ 'args': ['--build'],
|
||||
\ 'errorformat': '%f:%l:%c: %m',
|
||||
\ }
|
||||
let g:neomake_makeclean_maker = {
|
||||
\ 'exe': 'make',
|
||||
\ 'args': ['clean']
|
||||
\ }
|
||||
|
||||
let g:neomale_cpp_maker = {
|
||||
\ 'args': ['-fsyntax-only', '-Wall', '-Wextra'],
|
||||
\ 'errorformat':
|
||||
\ '%-G%f:%s:,' .
|
||||
\ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' .
|
||||
\ '%-G%f:%l: %#error: %#for each function it appears%.%#,' .
|
||||
\ '%-GIn file included%.%#,' .
|
||||
\ '%-G %#from %f:%l\,,' .
|
||||
\ '%f:%l:%c: %trror: %m,' .
|
||||
\ '%f:%l:%c: %tarning: %m,' .
|
||||
\ '%I%f:%l:%c: note: %m,' .
|
||||
\ '%f:%l:%c: %m,' .
|
||||
\ '%f:%l: %trror: %m,' .
|
||||
\ '%f:%l: %tarning: %m,'.
|
||||
\ '%I%f:%l: note: %m,'.
|
||||
\ '%f:%l: %m',
|
||||
\ }
|
||||
let g:neomake_cpp_enabled_makers = [ 'gcc' ]
|
||||
|
||||
endif
|
||||
|
||||
" -----------
|
||||
" vim-airline
|
||||
" -----------
|
||||
" if exists('g:plugs["vim-airline"]')
|
||||
" let g:airline_theme='hybrid'
|
||||
" let g:airline_powerline_fonts = 1
|
||||
|
||||
" " collapse inactive buffer sectionsa
|
||||
" let g:airline_inactive_collapse = 1
|
||||
" endif
|
||||
|
||||
" --------
|
||||
" nerdtree
|
||||
" --------
|
||||
if exists('g:plugs["nerdtree"]')
|
||||
nnoremap <C-\> :NERDTreeToggle<CR>
|
||||
inoremap <C-\> <Esc>:NERDTreeToggle<CR>
|
||||
|
||||
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
|
||||
endif
|
||||
|
||||
" ---------
|
||||
" codi.vim
|
||||
" ---------
|
||||
|
||||
if exists('g:plugs["codi.vim"]')
|
||||
|
||||
" use python 3
|
||||
let g:codi#interpreters = {
|
||||
\ 'python': {
|
||||
\ 'bin': 'python3',
|
||||
\ 'prompt': '^\(>>>\|\.\.\.\) ',
|
||||
\ },
|
||||
\ }
|
||||
|
||||
" left-align the codi buffer
|
||||
let g:codi#rightalign = 0
|
||||
|
||||
if exists('g:plugs["vim-pandoc-syntax"]')
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -1,213 +1,252 @@
|
|||
-- {{{ imports
|
||||
{-# OPTIONS -fno-warn-missing-signatures #-}
|
||||
|
||||
import System.IO
|
||||
import System.Exit
|
||||
-- | Note: I copied the default configuration and (heavily) modified it
|
||||
-- to ensure that everything was working correctly; I did this because I
|
||||
-- was having issues with layouts not working correctly and I wanted to
|
||||
-- ensure I was doing everything right. Also, nice comments explaining
|
||||
-- what everything is doing is always a good thing.
|
||||
|
||||
import XMonad
|
||||
import XMonad.Core
|
||||
import XMonad.Config
|
||||
|
||||
import XMonad.Layout.Spacing
|
||||
import XMonad.Layout.Grid
|
||||
import XMonad.Layout.NoBorders
|
||||
import XMonad.Layout.IM
|
||||
import XMonad.Layout.PerWorkspace
|
||||
import XMonad.Layout.SimplestFloat
|
||||
import XMonad.Layout.ThreeColumns
|
||||
|
||||
import XMonad.Hooks.DynamicLog
|
||||
import XMonad.Hooks.DynamicBars
|
||||
import XMonad.Hooks.ManageDocks
|
||||
import XMonad.Hooks.ManageHelpers
|
||||
import XMonad.Hooks.EwmhDesktops
|
||||
import XMonad.Hooks.SetWMName
|
||||
import XMonad.Hooks.UrgencyHook
|
||||
import XMonad.Hooks.Place
|
||||
|
||||
import XMonad.Actions.CycleWS
|
||||
import XMonad.Actions.GridSelect
|
||||
|
||||
import XMonad.Util.Loggers
|
||||
import XMonad.Util.Run
|
||||
import XMonad.Util.EZConfig(additionalKeysP)
|
||||
import XMonad.Util.SpawnOnce
|
||||
|
||||
import XMonad.Layout
|
||||
import XMonad.Operations
|
||||
import XMonad.ManageHook
|
||||
import qualified XMonad.StackSet as W
|
||||
import qualified Data.Map as M
|
||||
import Data.Bits ((.|.))
|
||||
import Data.Monoid
|
||||
import qualified Data.Map as M
|
||||
import System.Exit
|
||||
|
||||
-- }}}
|
||||
-- {{{ options
|
||||
import Graphics.X11.Xlib
|
||||
import Graphics.X11.Xlib.Extras
|
||||
|
||||
-- {{{ core stuff
|
||||
-- | The default number of workspaces (virtual screens) and their names.
|
||||
-- By default we use numeric strings, but any string may be used as a
|
||||
-- workspace name. The number of workspaces is determined by the length
|
||||
-- of this list.
|
||||
--
|
||||
-- A tagging example:
|
||||
--
|
||||
-- > workspaces = ["web", "irc", "code" ] ++ map show [4..9]
|
||||
--
|
||||
myWorkspaces :: [WorkspaceId]
|
||||
myWorkspaces = map show [1 .. 9 :: Int]
|
||||
|
||||
myTerminal = "/usr/bin/termite"
|
||||
myModMask = mod4Mask
|
||||
myBorderWidth = 1
|
||||
myNormalBorderColor = "#282A2E"
|
||||
myFocusedBorderColor = "#373B41"
|
||||
myFocusFollowsMouse = False
|
||||
-- | modMask lets you specify which modkey you want to use. The default
|
||||
-- is mod1Mask ("left alt"). You may also consider using mod3Mask
|
||||
-- ("right alt"), which does not conflict with emacs keybindings. The
|
||||
-- "windows key" is usually mod4Mask.
|
||||
--
|
||||
myDefaultModMask :: KeyMask
|
||||
myDefaultModMask = mod1Mask
|
||||
|
||||
-- clickable workspaces (xmobar)
|
||||
myWorkspaces = clickable $ map show [1..9]
|
||||
where clickable l = [ "<action=`xdotool key super+" ++ show (n) ++ "`>" ++ ws ++ "</action>" | (i,ws) <- zip [1..9] l, let n = i ]
|
||||
-- | Width of the window border in pixels.
|
||||
--
|
||||
myBorderWidth :: Dimension
|
||||
myBorderWidth = 1
|
||||
|
||||
-- | Border colors for unfocused and focused windows, respectively.
|
||||
--
|
||||
myNormalBorderColor, myFocusedBorderColor :: String
|
||||
myNormalBorderColor = "gray" -- "#dddddd"
|
||||
myFocusedBorderColor = "red" -- "#ff0000" don't use hex, not <24 bit safe
|
||||
|
||||
------------------------------------------------------------------------
|
||||
-- Window rules
|
||||
|
||||
-- | Execute arbitrary actions and WindowSet manipulations when managing
|
||||
-- a new window. You can use this to, for example, always float a
|
||||
-- particular program, or have a client always appear on a particular
|
||||
-- workspace.
|
||||
--
|
||||
-- To find the property name associated with a program, use
|
||||
-- xprop | grep WM_CLASS
|
||||
-- and click on the client you're interested in.
|
||||
--
|
||||
myManageHook :: ManageHook
|
||||
myManageHook = composeAll
|
||||
[ className =? "MPlayer" --> doFloat
|
||||
, className =? "Gimp" --> doFloat ]
|
||||
|
||||
------------------------------------------------------------------------
|
||||
-- Logging
|
||||
|
||||
-- | Perform an arbitrary action on each internal state change or X event.
|
||||
-- Examples include:
|
||||
--
|
||||
-- * do nothing
|
||||
--
|
||||
-- * log the state to stdout
|
||||
--
|
||||
-- See the 'DynamicLog' extension for examples.
|
||||
--
|
||||
myLogHook :: X ()
|
||||
myLogHook = return ()
|
||||
|
||||
------------------------------------------------------------------------
|
||||
-- Event handling
|
||||
|
||||
-- | Defines a custom handler function for X Events. The function should
|
||||
-- return (All True) if the default handler is to be run afterwards.
|
||||
-- To combine event hooks, use mappend or mconcat from Data.Monoid.
|
||||
myHandleEventHook :: Event -> X All
|
||||
myHandleEventHook _ = return (All True)
|
||||
|
||||
-- | Perform an arbitrary action at xmonad startup.
|
||||
myStartupHook :: X ()
|
||||
myStartupHook = return ()
|
||||
|
||||
------------------------------------------------------------------------
|
||||
-- Extensible layouts
|
||||
--
|
||||
-- You can specify and transform your layouts by modifying these values.
|
||||
-- If you change layout bindings be sure to use 'mod-shift-space' after
|
||||
-- restarting (with 'mod-q') to reset your layout state to the new
|
||||
-- defaults, as xmonad preserves your old layout settings by default.
|
||||
--
|
||||
|
||||
-- | The available layouts. Note that each layout is separated by |||, which
|
||||
-- denotes layout choice.
|
||||
myLayout = tiled ||| Mirror tiled ||| Full
|
||||
where
|
||||
-- default tiling algorithm partitions the screen into two panes
|
||||
tiled = Tall nmaster delta ratio
|
||||
|
||||
-- The default number of windows in the master pane
|
||||
nmaster = 1
|
||||
|
||||
-- Default proportion of screen occupied by master pane
|
||||
ratio = 1/2
|
||||
|
||||
-- Percent of screen to increment by when resizing panes
|
||||
delta = 3/100
|
||||
|
||||
------------------------------------------------------------------------
|
||||
-- Key bindings:
|
||||
|
||||
-- | The preferred terminal program, which is used in a binding below and by
|
||||
-- certain contrib modules.
|
||||
myTerminal :: String
|
||||
myTerminal = "termite"
|
||||
|
||||
-- | Whether focus follows the mouse pointer.
|
||||
myFocusFollowsMouse :: Bool
|
||||
myFocusFollowsMouse = True
|
||||
|
||||
-- | Whether a mouse click select the focus or is just passed to the window
|
||||
myClickJustFocuses :: Bool
|
||||
myClickJustFocuses = True
|
||||
|
||||
|
||||
-- }}}
|
||||
-- {{{ layouts
|
||||
-- | The xmonad key bindings. Add, modify or remove key bindings here.
|
||||
--
|
||||
-- (The comment formatting character is used when generating the manpage)
|
||||
--
|
||||
myKeys :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
|
||||
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
|
||||
-- launching and killing programs
|
||||
[ ((modMask .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf) -- %! Launch terminal
|
||||
, ((modMask, xK_p ), spawn "dmenu_run") -- %! Launch dmenu
|
||||
, ((modMask .|. shiftMask, xK_p ), spawn "gmrun") -- %! Launch gmrun
|
||||
, ((modMask .|. shiftMask, xK_c ), kill) -- %! Close the focused window
|
||||
|
||||
myLayouts = tiled |||
|
||||
Mirror tiled |||
|
||||
threecol |||
|
||||
Grid |||
|
||||
Full
|
||||
where
|
||||
-- default tiling algorithm partitions the screen into two panes
|
||||
tiled = Tall nmaster delta ratio
|
||||
, ((modMask, xK_space ), sendMessage NextLayout) -- %! Rotate through the available layout algorithms
|
||||
, ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf) -- %! Reset the layouts on the current workspace to default
|
||||
|
||||
threecol = ThreeColMid nmaster delta ratio
|
||||
, ((modMask, xK_n ), refresh) -- %! Resize viewed windows to the correct size
|
||||
|
||||
-- the default number of windows in the master pane
|
||||
nmaster = 1
|
||||
-- move focus up or down the window stack
|
||||
, ((modMask, xK_Tab ), windows W.focusDown) -- %! Move focus to the next window
|
||||
, ((modMask .|. shiftMask, xK_Tab ), windows W.focusUp ) -- %! Move focus to the previous window
|
||||
, ((modMask, xK_j ), windows W.focusDown) -- %! Move focus to the next window
|
||||
, ((modMask, xK_k ), windows W.focusUp ) -- %! Move focus to the previous window
|
||||
, ((modMask, xK_m ), windows W.focusMaster ) -- %! Move focus to the master window
|
||||
|
||||
-- percent of the screen occupied by the master pane (60%)
|
||||
ratio = 3/5
|
||||
-- modifying the window order
|
||||
, ((modMask, xK_Return), windows W.swapMaster) -- %! Swap the focused window and the master window
|
||||
, ((modMask .|. shiftMask, xK_j ), windows W.swapDown ) -- %! Swap the focused window with the next window
|
||||
, ((modMask .|. shiftMask, xK_k ), windows W.swapUp ) -- %! Swap the focused window with the previous window
|
||||
|
||||
-- percent of the screen to increment by when resizing panes
|
||||
delta = 3/100
|
||||
-- resizing the master/slave ratio
|
||||
, ((modMask, xK_h ), sendMessage Shrink) -- %! Shrink the master area
|
||||
, ((modMask, xK_l ), sendMessage Expand) -- %! Expand the master area
|
||||
|
||||
-- layout to use for the workspace containing chat clients
|
||||
imLayout = withIM (30/100) (ClassName "telegram-desktop") Grid
|
||||
-- floating layer support
|
||||
, ((modMask, xK_t ), withFocused $ windows . W.sink) -- %! Push window back into tiling
|
||||
|
||||
-- }}}
|
||||
-- {{{ gridselect configuration
|
||||
-- increase or decrease number of windows in the master area
|
||||
, ((modMask , xK_comma ), sendMessage (IncMasterN 1)) -- %! Increment the number of windows in the master area
|
||||
, ((modMask , xK_period), sendMessage (IncMasterN (-1))) -- %! Deincrement the number of windows in the master area
|
||||
|
||||
myGSConfig = defaultGSConfig
|
||||
{ gs_cellheight = 128
|
||||
, gs_cellwidth = 256
|
||||
, gs_cellpadding = 5
|
||||
}
|
||||
-- quit, or restart
|
||||
, ((modMask .|. shiftMask, xK_q ), io (exitWith ExitSuccess)) -- %! Quit xmonad
|
||||
, ((modMask , xK_q ), spawn "if type xmonad; then xmonad --recompile && xmonad --restart; else xmessage xmonad not in \\$PATH: \"$PATH\"; fi") -- %! Restart xmonad
|
||||
|
||||
-- }}}
|
||||
-- , ((modMask .|. shiftMask, xK_slash ), spawn ("echo \"" ++ help ++ "\" | xmessage -file -")) -- %! Run xmessage with a summary of the default keybindings (useful for beginners)
|
||||
-- -- repeat the binding for non-American layout keyboards
|
||||
-- , ((modMask , xK_question), spawn ("echo \"" ++ help ++ "\" | xmessage -file -"))
|
||||
]
|
||||
++
|
||||
-- mod-[1..9] %! Switch to workspace N
|
||||
-- mod-shift-[1..9] %! Move client to workspace N
|
||||
[((m .|. modMask, k), windows $ f i)
|
||||
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
|
||||
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
|
||||
++
|
||||
-- mod-{w,e,r} %! Switch to physical/Xinerama screens 1, 2, or 3
|
||||
-- mod-shift-{w,e,r} %! Move client to screen 1, 2, or 3
|
||||
[((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
|
||||
| (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
|
||||
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
|
||||
|
||||
-- }}}
|
||||
-- {{{ keybinds
|
||||
|
||||
myAdditionalKeys =
|
||||
[ ("<XF86MonBrightnessUp>", spawn "light -A 10")
|
||||
, ("<XF86MonBrightnessDown>", spawn "light -U 10")
|
||||
, ("<XF86AudioRaiseVolume>", spawn "pactl set-sink-volume 1 +2%")
|
||||
, ("<XF86AudioLowerVolume>", spawn "pactl set-sink-volume 1 -2%")
|
||||
, ("<XF86AudioMute>", spawn "pactl set-sink-mute 1 toggle")
|
||||
, ("<XF86AudioPlay>", spawn "mpc toggle")
|
||||
, ("<XF86AudioNext>", spawn "mpc next")
|
||||
, ("<XF86AudioPrev>", spawn "mpc prev")
|
||||
, ("<XF86AudioStop>", spawn "mpc stop")
|
||||
, ("<XF86Sleep>", spawn "systemctl suspend")
|
||||
, ("M-p", spawn "dmenu_run -fn 'Roboto Mono-10' -o .85 -q -i -h 20")
|
||||
, ("M-b", sendMessage ToggleStruts)
|
||||
, ("M-]", nextWS)
|
||||
, ("M-[", prevWS)
|
||||
, ("M-g", goToSelected $ myGSConfig)
|
||||
-- | Mouse bindings: default actions bound to mouse events
|
||||
myMouseBindings :: XConfig Layout -> M.Map (KeyMask, Button) (Window -> X ())
|
||||
myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList
|
||||
-- mod-button1 %! Set the window to floating mode and move by dragging
|
||||
[ ((modMask, button1), \w -> focus w >> mouseMoveWindow w
|
||||
>> windows W.shiftMaster)
|
||||
-- mod-button2 %! Raise the window to the top of the stack
|
||||
, ((modMask, button2), windows . (W.shiftMaster .) . W.focusWindow)
|
||||
-- mod-button3 %! Set the window to floating mode and resize by dragging
|
||||
, ((modMask, button3), \w -> focus w >> mouseResizeWindow w
|
||||
>> windows W.shiftMaster)
|
||||
-- you may also bind events to the mouse scroll wheel (button4 and button5)
|
||||
]
|
||||
|
||||
-- }}}
|
||||
-- {{{ hooks
|
||||
-- -- | The default set of configuration values itself
|
||||
-- { borderWidth = borderWidth
|
||||
-- , workspaces = workspaces
|
||||
-- , layoutHook = layout
|
||||
-- , terminal = terminal
|
||||
-- , normalBorderColor = normalBorderColor
|
||||
-- , focusedBorderColor = focusedBorderColor
|
||||
-- , modMask = defaultModMask
|
||||
-- , keys = keys
|
||||
-- , logHook = logHook
|
||||
-- , startupHook = startupHook
|
||||
-- , mouseBindings = mouseBindings
|
||||
-- , manageHook = manageHook
|
||||
-- , handleEventHook = handleEventHook
|
||||
-- , focusFollowsMouse = focusFollowsMouse
|
||||
-- , clickJustFocuses = clickJustFocuses
|
||||
-- }
|
||||
|
||||
-- {{{ manage hook
|
||||
|
||||
myManageHook = (composeAll . concat $
|
||||
[ [ className =? "chromium" --> doShift (myWorkspaces !! 0)
|
||||
, className =? "google-chrome" --> doShift (myWorkspaces !! 0)
|
||||
, className =? "qutebrowser" --> doShift (myWorkspaces !! 0)
|
||||
, className =? "emacs" --> doShift (myWorkspaces !! 2)
|
||||
, className =? "gvim" --> doShift (myWorkspaces !! 2)
|
||||
, className =? "telegram-desktop" --> doShift (myWorkspaces !! 7)
|
||||
, className =? "Slack" --> doShift (myWorkspaces !! 7)
|
||||
, className =? "discord" --> doShift (myWorkspaces !! 7)
|
||||
, className =? "VirtualBox" --> doCenterFloat
|
||||
, resource =? "stalonetray" --> doIgnore
|
||||
]
|
||||
, [ className =? c --> doFullFloat | c <- myFullFloats ]
|
||||
|
||||
-- Google Chrome app windows
|
||||
, [ title =? t --> doFloat | t <- myChromeApps ]
|
||||
|
||||
-- misc.
|
||||
, [ isFullscreen --> doFullFloat
|
||||
, isDialog --> doCenterFloat
|
||||
, manageDocks
|
||||
]
|
||||
])
|
||||
where
|
||||
myFullFloats = [ "mpv" , "Vlc" ]
|
||||
myChromeApps = [ "Authy" ]
|
||||
|
||||
-- }}}
|
||||
-- {{{ log hook
|
||||
|
||||
myLogHook h = dynamicLogWithPP $ xmobarPP
|
||||
{ ppTitle = xmobarColor "#c5c8c6" "" . shorten 80
|
||||
, ppOutput = hPutStrLn h
|
||||
, ppLayout = (\layout -> case layout of
|
||||
"SmartSpacing 5 Tall" -> "Tall"
|
||||
"SmartSpacing 5 Mirror Tall" -> "Mirror Tall"
|
||||
"SmartSpacing 5 ThreeCol" -> "ThreeCol"
|
||||
"SmartSpacing 5 Grid" -> "Grid"
|
||||
"SmartSpacing 5 Full" -> "Full")
|
||||
main = xmonad $ defaultConfig
|
||||
{ borderWidth = myBorderWidth
|
||||
, workspaces = myWorkspaces
|
||||
, layoutHook = myLayout
|
||||
, terminal = myTerminal
|
||||
, normalBorderColor = myNormalBorderColor
|
||||
, focusedBorderColor = myFocusedBorderColor
|
||||
, modMask = myDefaultModMask
|
||||
, keys = myKeys
|
||||
, logHook = myLogHook
|
||||
, startupHook = myStartupHook
|
||||
, mouseBindings = myMouseBindings
|
||||
, manageHook = myManageHook
|
||||
, handleEventHook = myHandleEventHook
|
||||
, focusFollowsMouse = myFocusFollowsMouse
|
||||
, clickJustFocuses = myClickJustFocuses
|
||||
}
|
||||
|
||||
-- }}}
|
||||
-- {{{ startup hook
|
||||
|
||||
-- startup applications
|
||||
myStartupHook = do
|
||||
-- start dropbox
|
||||
spawnOnce "/usr/bin/dropbox"
|
||||
|
||||
-- start the notification daemon
|
||||
spawnOnce "/usr/bin/dunst"
|
||||
|
||||
-- restore the wallpaper
|
||||
spawnOnce "/usr/bin/nitrogen --restore"
|
||||
|
||||
-- start the compositing engine
|
||||
spawnOnce "/usr/bin/compton --config ~/.config/compton.conf"
|
||||
|
||||
-- }}}
|
||||
-- {{{ layout hook
|
||||
|
||||
-- combine the layouts together to make the layoutHook
|
||||
myLayoutHook = avoidStruts
|
||||
$ onWorkspace (myWorkspaces !! 7) imLayout
|
||||
$ smartSpacing 5
|
||||
$ smartBorders
|
||||
$ myLayouts
|
||||
|
||||
-- }}}
|
||||
|
||||
-- }}}
|
||||
-- {{{ main
|
||||
|
||||
main = do
|
||||
xmproc <- spawnPipe "/usr/bin/xmobar ~/.xmonad/xmobarrc"
|
||||
|
||||
xmonad $ withUrgencyHook NoUrgencyHook $ ewmh defaultConfig
|
||||
{ terminal = myTerminal
|
||||
, modMask = myModMask
|
||||
, borderWidth = myBorderWidth
|
||||
, normalBorderColor = myNormalBorderColor
|
||||
, focusedBorderColor = myFocusedBorderColor
|
||||
, focusFollowsMouse = myFocusFollowsMouse
|
||||
, workspaces = myWorkspaces
|
||||
|
||||
-- hooks
|
||||
, handleEventHook = fullscreenEventHook
|
||||
, layoutHook = myLayoutHook
|
||||
, startupHook = setWMName "LG3D" <+> myStartupHook
|
||||
, manageHook = manageDocks <+> myManageHook
|
||||
, logHook = myLogHook xmproc <+> ewmhDesktopsLogHook
|
||||
} `additionalKeysP` myAdditionalKeys
|
||||
|
||||
-- }}}
|
||||
|
||||
-- vim: foldenable foldmethod=marker
|
||||
|
|
Loading…
Reference in New Issue