diff --git a/.Xresources b/.Xresources index 9a03b89..198afbc 100755 --- a/.Xresources +++ b/.Xresources @@ -1,34 +1,40 @@ -Xft.antialias: 1 -Xft.autohint: 0 -Xft.dpi: 98 -Xft.hinting: 1 -Xft.hintstyle: hintfull -Xft.lcdfilter: lcddefault -Xft.rgba: rgb +! -*- mode: conf-xdefaults -*- +! vim: ft=xdefaults cms=!\ %s -URxvt.font: xft:Roboto Mono:style=regular:size=10:antialias=true:hinting=hintfull -URxvt.boldFont: xft:Roboto Mono:stlye=bold:size=10:antialias=true:hinting=hintfull +! Emacs +Emacs.menuBar: true +Emacs.toolBar: false +Emacs.verticalScrollBars: false -URxvt.skipBuiltinGlyphs: true -URxvt.secondaryScreen: true -URxvt.secondaryScroll: false -URxvt.iso14755: false -URxvt.iso14755_52: false -URxvt.scrollBar: false -URxvt.scrollTtyOutput: false -URxvt.scrollWithBuffer: true -URxvt.scrollTtyKeypress: true -URxvt.cursorBlink: true -URxvt.urgentOnBell: true -URxvt.buffered: true +! xft +Xft.dpi: 96 +Xft.rgba: rgb +Xft.hinting: 1 +Xft.autohint: 0 +Xft.antialias: 1 +Xft.hintstyle: hintslight +Xft.lcdfilter: lcddefault -URxvt.saveLines: 1000 -URxvt.depth: 32 +! URxvt +URxvt*font: xft:Iosevka:size=12:antialias=true +URxvt*boldFont: xft:Iosevka:bold:size=12:antialias=true + +URxvt*saveLines: 5000 +URxvt*secondaryScreen: true +URxvt*scrollWithBuffer: true +URxvt*scrollTtyKeypress: true +URxvt*scrollTtyOutput: false +URxvt*secondaryScroll: false +URxvt*scrollBar: false + +URxvt*iso14755: false +URxvt*iso14755_52: false + +URxvt*url-launcher: /usr/bin/xdg-open ! https://github.com/chriskempson/base16-xresources ! Base16 Tomorrow Night ! Scheme: Chris Kempson (http://chriskempson.com) - #define base00 #1d1f21 #define base01 #282a2e #define base02 #373b41 diff --git a/.config/Code/User/settings.json b/.config/Code/User/settings.json new file mode 100644 index 0000000..10e8ea9 --- /dev/null +++ b/.config/Code/User/settings.json @@ -0,0 +1,120 @@ +{ + "editor.fontFamily": "Iosevka", + "editor.fontSize": 16, + "editor.fontLigatures": false, + "editor.cursorStyle": "block", + "editor.accessibilitySupport": "off", + "editor.cursorBlinking": "blink", + "editor.lineNumbers": "relative", + "editor.minimap.enabled": false, + "editor.mouseWheelZoom": true, + "editor.roundedSelection": false, + "editor.smoothScrolling": false, + "editor.stablePeek": true, + "editor.suggestSelection": "recentlyUsedByPrefix", + + "files.associations": { + "Pipfile": "toml", + "Vagrantfile": "ruby" + }, + + "terminal.external.linuxExec": "/usr/bin/termite", + "terminal.external.osxExec": "iTerm2.app", + + "workbench.iconTheme": "vscode-icons", + "workbench.startupEditor": "none", + "workbench.commandPalette.history": 500, + "workbench.commandPalette.preserveInput": true, + "workbench.editor.enablePreview": false, + "workbench.editor.enablePreviewFromQuickOpen": false, + "workbench.editor.labelFormat": "medium", + "workbench.editor.revealIfOpen": true, + "workbench.editor.tabCloseButton": "left", + "workbench.statusBar.feedback.visible": false, + "workbench.tree.horizontalScrolling": true, + "workbench.view.alwaysShowHeaderActions": true, + + "window.newWindowDimensions": "inherit", + "window.restoreWindows": "none", + "window.title": "${dirty}${activeEditorMedium}${separator}${rootName}${separator}${appName}", + + "files.insertFinalNewline": true, + "files.trimTrailingWhitespace": true, + "files.trimFinalNewlines": true, + "files.useExperimentalFileWatcher": false, + + "explorer.sortOrder": "default", + + "search.exclude": { + "**/node_modules": true, + "**/venv/**": true, + "**/.tox/**": true, + "**/.pytest_cache/**": true, + "**/.vagrant/**": true + }, + + "search.location": "sidebar", + "search.smartCase": true, + "search.useRipgrep": true, + + "html.format.indentInnerHtml": true, + "html.suggest.angular1": false, + "html.suggest.ionic": false, + + "extensions.ignoreRecommendations": true, + + "python.autoComplete.showAdvancedMembers": true, + "python.autoComplete.preloadModules": [ + "flask", + "sqlalchemy" + ], + + "python.disablePromptForFeatures": [ + "pylint" + ], + + "python.formatting.provider": "yapf", + "python.linting.pylamaEnabled": true, + "python.linting.pydocstyleEnabled": false, + "python.linting.mypyEnabled": true, + + "python.linting.mypyArgs": [ + "--ignore-missing-imports", + "--follow-imports=silent" + ], + + "python.linting.ignorePatterns": [ + ".vscode/*.py", + "**/site-packages/**/*.py", + "**/venv/**", + ".tox/**" + ], + + "python.venvPath": "~/.local/share/virtualenvs", + + "python.workspaceSymbols.enabled": true, + "python.workspaceSymbols.exclusionPatterns": [ + "**/site-packages/**" + ], + + "C_Cpp.clang_format_path": "/usr/bin/clang-format", + "C_Cpp.clang_format_style": "file", + "C_Cpp.default.cStandard": "c11", + "C_Cpp.default.cppStandard": "c++17", + "C_Cpp.default.intelliSenseMode": "clang-x64", + + "liveshare.connectionMode": "auto", + + "git.defaultCloneDirectory": "/home/alex/projects", + "git.enableCommitSigning": true, + "git.path": "/usr/bin/git", + + "vim.neovimPath": "/usr/bin/nvim", + "vim.enableNeovim": true, + "vim.cmdLineInitialColon": true, + "vim.hlsearch": true, + "vim.statusBarColorControl": true, + "vim.textwidth": 72, + "vim.useSystemClipboard": true, + "files.autoSave": "off" +} diff --git a/.config/compton.conf b/.config/compton.conf new file mode 100644 index 0000000..eaf0a5a --- /dev/null +++ b/.config/compton.conf @@ -0,0 +1,66 @@ +# -*- mode: conf -*- +# vim: ft=conf : + +backend = "glx"; +vsync = "opengl-swc"; + +shadow = true; +no-dock-shadow = true; +no-dnd-shadow = true; +clear-shadow = true; + +shadow-radius = 10; +shadow-offset-x = -5; +shadow-offset-y = 0; +shadow-opacity = 0.8; +shadow-red = 0.11; +shadow-green = 0.12; +shadow-blue = 0.13; +shadow-exclude = [ + "name = 'Notification'", + "_GTK_FRAME_EXTENTS@:c", + "_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'", + "_NET_WM_STATE@:32a *= '_NET_WM_STATE_STICKY'", +]; +shadow-ignore-shaped = true; + +alpha-step = 0.06; +blur-background = false; +blur-background-fixed = true; +blur-kern = "7x7box"; +blur-background-exclude = [ + "window_type = 'dock'", + "window_type = 'desktop'", + "_GTK_FRAME_EXTENTS@:c" +]; + +opacity-rule = [ +]; + +fading = false; +fade-delta = 7; +fade-in-step = 0.05; +fade-out-step = 0.05; +fade-exclude = []; + +mark-wmwin-focused = true; +mark-ovredir-focused = true; +use-ewmh-active-win = true; +detect-rounded-corners = true; +detect-client-opacity = true; +refresh-rate = 0; +dbe = false; +paint-on-overlay = true; +glx-no-stencil = true; +glx-copy-from-front = false; +glx-swap-method = "undefined"; +sw-opti = true; +unredir-if-possible = false; +focus-exclude = []; +detect-transient = true; +detect-client-leader = true; +invert-color-include = []; + +wintypes: { + tooltip = { fade = true; shadow = false; opacity = 1.00; focus = true; }; +}; diff --git a/.config/gtk-3.0/settings.ini b/.config/gtk-3.0/settings.ini new file mode 100644 index 0000000..e65e6a5 --- /dev/null +++ b/.config/gtk-3.0/settings.ini @@ -0,0 +1,15 @@ +[Settings] +gtk-theme-name=Arc-Dark +gtk-icon-theme-name=Paper +gtk-font-name=Noto Sans 11 +gtk-cursor-theme-size=0 +gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ +gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR +gtk-button-images=0 +gtk-menu-images=0 +gtk-enable-event-sounds=1 +gtk-enable-input-feedback-sounds=1 +gtk-xft-antialias=1 +gtk-xft-hinting=1 +gtk-xft-hintstyle=hintslight +gtk-xft-rgba=rgb diff --git a/.config/i3/config b/.config/i3/config new file mode 100644 index 0000000..2bd37f6 --- /dev/null +++ b/.config/i3/config @@ -0,0 +1,184 @@ +# i3 config file (v4) +# +# Please see https://i3wm.org/docs/userguide.html for a complete reference! + +# note: I have no idea what I'm doing. + +set $mod Mod4 + +font pango:iosevka 12 + +floating_modifier $mod +focus_follows_mouse no + +# start a terminal +bindsym $mod+Shift+Return exec --no-startup-id termite +bindsym $mod+Control+Return exec --no-startup-id urxvt + +# kill focused window +bindsym $mod+Shift+c kill + +# start rofi (a program launcher) +bindsym $mod+p exec --no-startup-id rofi -show run + +# change focus +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right + +# move focused window +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right + +# split in horizontal orientation +bindsym $mod+Control+h split h + +# split in vertical orientation +bindsym $mod+Control+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +bindsym $mod+d focus child + +# Define names for default workspaces for which we configure key bindings later on. +# We use variables to avoid repeating the names in multiple places. +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" + +workspace $ws1 output DP-2 +workspace $ws2 output DP-2 +workspace $ws3 output DP-2 +workspace $ws4 output DP-2 +workspace $ws5 output DP-2 +workspace $ws6 output DP-2 +workspace $ws7 output DP-2 +workspace $ws8 output DP-2 +workspace $ws9 output DP-2 +workspace $ws10 output DP-2 + +# switch to workspace +bindsym $mod+1 workspace $ws1 +bindsym $mod+2 workspace $ws2 +bindsym $mod+3 workspace $ws3 +bindsym $mod+4 workspace $ws4 +bindsym $mod+5 workspace $ws5 +bindsym $mod+6 workspace $ws6 +bindsym $mod+7 workspace $ws7 +bindsym $mod+8 workspace $ws8 +bindsym $mod+9 workspace $ws9 +bindsym $mod+0 workspace $ws10 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace $ws1 +bindsym $mod+Shift+2 move container to workspace $ws2 +bindsym $mod+Shift+3 move container to workspace $ws3 +bindsym $mod+Shift+4 move container to workspace $ws4 +bindsym $mod+Shift+5 move container to workspace $ws5 +bindsym $mod+Shift+6 move container to workspace $ws6 +bindsym $mod+Shift+7 move container to workspace $ws7 +bindsym $mod+Shift+8 move container to workspace $ws8 +bindsym $mod+Shift+9 move container to workspace $ws9 +bindsym $mod+Shift+0 move container to workspace $ws10 + +# nagivate between workspaces +bindsym $mod+bracketleft workspace prev +bindsym $mod+bracketright workspace next + +bindsym $mod+Shift+Tab workspace prev +bindsym $mod+Tab workspace next + +bindsym $mod+q reload +bindsym $mod+Shift+r restart +bindsym $mod+Shift+q exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" + +mode "resize" { + bindsym $mod+h resize shrink width 5 px or 5 ppt + bindsym $mod+j resize grow height 5 px or 5 ppt + bindsym $mod+k resize shrink height 5 px or 5 ppt + bindsym $mod+l resize grow width 5 px or 5 ppt + + bindsym Return mode "default" + bindsym Escape mode "default" +} + +bindsym $mod+r mode "resize" + +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 1 +2% +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 1 -2% +bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 1 toggle + +bindsym XF86MonBrightnessUp exec --no-startup-id light -A 1.5% +bindsym XF86MonBrightnessDown exec --no-startup-id light -U 1.5% + +bindsym XF86AudioPlay exec playerctl play +bindsym XF86AudioPause exec playerctl pause +bindsym XF86AudioNext exec playerctl next +bindsym XF86AudioPrev exec playerctl previous + +set $bg-color #2f343f +set $inactive-bg-color #2f343f +set $text-color #f3f4f5 +set $inactive-text-color #676E7D +set $urgent-bg-color #E53935 + +# window colors +# border background text indicator +client.focused $bg-color $bg-color $text-color #00ff00 +client.unfocused $inactive-bg-color $inactive-bg-color $inactive-text-color #00ff00 +client.focused_inactive $inactive-bg-color $inactive-bg-color $inactive-text-color #00ff00 +client.urgent $urgent-bg-color $urgent-bg-color $text-color #00ff00 + + +bar { + status_command i3blocks -c ~/.config/i3/i3blocks.conf + position top + colors { + background $bg-color + separator #757575 + focused_workspace $bg-color $bg-color $text-color + inactive_workspace $inactive-bg-color $inactive-bg-color $inactive-text-color + urgent_workspace $urgent-bg-color $urgent-bg-color $text-color + } +} + + +for_window [window_role="pop-up"] floating enable +for_window [window_role="task_dialog"] floating enable +for_window [title="Preferences$"] floating enable + +set $default_gaps_inner 12 +set $default_gaps_outer 0 + +gaps inner $default_gaps_inner +gaps outer $default_gaps_outer + +popup_during_fullscreen smart +new_window pixel 0 +workspace_auto_back_and_forth yes diff --git a/.config/i3/i3blocks.conf b/.config/i3/i3blocks.conf new file mode 100644 index 0000000..69ce652 --- /dev/null +++ b/.config/i3/i3blocks.conf @@ -0,0 +1,18 @@ +command=/usr/lib/i3blocks/$BLOCK_NAME +separator_block_width=15 +markup=none + +[iface] +label= +instance=enp025 +color=#00FF00 +interval=10 + +[battery] +label= +interval=30 + +[time] +command=date '+%b %d %I:%M:%S' +interval=1 +label= diff --git a/.config/mpd/mpd.conf b/.config/mpd/mpd.conf index 0aacfc2..fadfd64 100644 --- a/.config/mpd/mpd.conf +++ b/.config/mpd/mpd.conf @@ -1,4 +1,4 @@ -music_directory "~/media/music" +music_directory "~/media/music/library" playlist_directory "~/.config/mpd/playlists" pid_file "~/.config/mpd/pid" state_file "~/.config/mpd/state" @@ -14,9 +14,7 @@ audio_output { type "pulse" name "PulseAudio" mixer_type "software" - - # use the equalizer+bs2b sink instead of defaul; - sink "crossfeed" + sink "equalizer" } # output for ncmpcpp visualizer diff --git a/.config/ncmpcpp/bindings b/.config/ncmpcpp/bindings new file mode 100644 index 0000000..4433acf --- /dev/null +++ b/.config/ncmpcpp/bindings @@ -0,0 +1,35 @@ +# -*- mode: conf -*- +# vim: ft=conf : + +def_key "+" + show_clock + +def_key "=" + volume_up + +def_key "j" + scroll_down + +def_key "k" + scroll_up + +def_key "ctrl-u" + page_up + +def_key "ctrl-d" + page_down + +def_key "h" + previous_column + +def_key "l" + next_column + +def_key "." + show_lyrics + +def_key "n" + next_found_item + +def_key "N" + previous_found_item diff --git a/.config/ncmpcpp/config b/.config/ncmpcpp/config index 26e9384..8018fbc 100644 --- a/.config/ncmpcpp/config +++ b/.config/ncmpcpp/config @@ -1,58 +1,53 @@ -# TODO: figure out what half this crap does (I forgot) and -# reconfig/remove/reorganize. +# -*- mode: conf -*- +# vim: set ft=conf : -ncmpcpp_directory = ~/.config/ncmpcpp -mpd_host = localhost -mpd_port = 6600 -mpd_connection_timeout = 5 -mpd_music_dir = ~/media/music -mpd_crossfade_time = 0 +ncmpcpp_directory = ~/.config/ncmpcpp +lyrics_directory = ~/.local/share/lyrics +mpd_host = 127.0.0.1 +mpd_port = 6600 +mpd_connection_timeout = 5 +mpd_music_dir = ~/media/music/library +mpd_crossfade_time = 0 +media_library_primary_tag = album_artist +mouse_support = yes +cyclic_scrolling = yes +follow_now_playing_lyrics = yes +fetch_lyrics_for_current_song_in_background = yes +regular_expressions = perl -visualizer_fifo_path = /tmp/mpd.fifo -visualizer_output_name = my_fifo -visualizer_in_stereo = yes -visualizer_sample_multiplier = .8 -visualizer_sync_interval = 15 -visualizer_type = spectrum -visualizer_look = -+ -visualizer_color = blue, cyan, green, yellow, magenta, red +playlist_display_mode = "columns" +search_engine_display_mode = "columns" +browser_display_mode = "columns" +titles_visibility = "yes" +incremental_seeking = "yes" +autocenter_mode = "yes" +header_visibility = "yes" +statusbar_visibility = "yes" +display_bitrate = "yes" +ignore_leading_the = "yes" +enable_window_title = "yes" +progressbar_look = "·· " -song_list_format = {%a - }{%t}|{$8%f$9}$R{$3(%l)$9} -song_status_format = {{%a{ "%b"{ (%y)}} - }{%t}}|{%f} -song_library_format = {%n - }{%t}|{%f} -now_playing_suffix = $/b -song_columns_list_format = (20)[red]{a} (6f)[green]{NE} (50)[blue]{t|f:Title} (20)[yellow]{b} (7f)[magenta]{l} +# formats +song_list_format = "{%a - }{%t}|{$8%f$9}$R{$3(%l)$9}" +song_library_format = "{%n - }{%t}|{%f}" +song_status_format = "{{%a{ %b{ (%y)}} - }{%t}}|{%f}" +song_columns_list_format = "(20)[red]{a} (6f)[green]{NE} (50)[blue]{t|f:Title} (20)[yellow]{b} (7f)[magenta]{l}" -browser_display_mode = columns -search_engine_display_mode = columns -playlist_editor_display_mode = columns - -incremental_seeking = yes -autocenter_mode = yes -centered_cursor = yes -progressbar_boldness = yes -user_interface = classic -header_visibility = yes -statusbar_visibility = yes -titles_visibility = yes -header_text_scrolling = yes -display_volume_level = yes -display_bitrate = yes -mouse_support = no -colors_enabled = yes -header_window_color = white -volume_color = green -state_line_color = red -main_window_color = magenta -color1 = green -color2 = red -main_window_highlight_color = green -progressbar_color = black -progressbar_elapsed_color = green -statusbar_color = green -alternative_ui_separator_color = black -active_column_color = red -window_border_color = magenta -active_window_border = green - -# vim: ft=conf +song_window_title_format = "{%b}" +alternative_header_first_line_format = "{$b$6%a$9} $1««$9 {$6%t$9}" +alternative_header_second_line_format = "{$5%b$9} $1»»$9 {$5(%y)$9}" +alternative_ui_separator_color = "black" +playlist_separate_albums = "no" +colors_enabled = "yes" +empty_tag_color = "blue" +header_window_color = "black" +volume_color = "black" +display_volume_level = "yes" +state_line_color = "cyan" +state_flags_color = "red" +color1 = "white" +color2 = "blue" +progressbar_color = "cyan" +window_border_color = "red" +active_window_border = "red" diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 436ccde..4124d5f 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -51,14 +51,6 @@ call plug#begin('~/.config/nvim/plugged') Plug 'equalsraf/neovim-gui-shim' endif - Plug 'tweekmonster/helpful.vim' - Plug 'tweekmonster/startuptime.vim' - - " if has('nvim') && s:platform ==? 'linux' - " " Plug 'Shougo/denite.nvim', { 'do': ':UpdateRemotePlugins' } - " Plug 'nixprime/cpsm' - " endif - Plug 'ctrlpvim/ctrlp.vim' Plug 'FelikZ/ctrlp-py-matcher' Plug 'tacahiroy/ctrlp-funky' @@ -66,77 +58,33 @@ call plug#begin('~/.config/nvim/plugged') Plug 'mileszs/ack.vim' Plug 'majutsushi/tagbar' Plug 'romainl/vim-qf' - " Plug 'mtth/scratch.vim' - " Plug 'airblade/vim-gitgutter' - " Plug 'ludovicchabant/vim-gutentags' Plug 'junegunn/gv.vim' - " Plug 'jreybert/vimagit' - " Plug 'jceb/vim-orgmode' - " Plug 'chrisbra/nrrwrgn' - " Plug 'jmcantrell/vim-virtualenv' - " Plug 'gregsexton/gitv' - " Plug 'mhinz/vim-startify' - " Plug 'unblevable/quick-scope' - " Plug 'vim-airline/vim-airline' | Plug 'vim-airline/vim-airline-themes' - " Plug 'itchyny/lightline.vim' + Plug 'vim-airline/vim-airline' | Plug 'vim-airline/vim-airline-themes' if has('nvim') - " Plug 'neomake/neomake' - " Plug 'w0rp/ale' - " completion Plug 'roxma/python-support.nvim' Plug 'roxma/nvim-completion-manager' - " Plug 'roxma/ncm-github' - " Plug 'roxma/nvim-cm-tern', { 'do': 'npm install' } - Plug 'fgrsnau/ncm-otherbuf' Plug 'Shougo/neco-syntax' Plug 'Shougo/neoinclude.vim' - " Plug 'mhartington/nvim-typescript', { 'do': 'npm install typescript' } + Plug 'roxma/ncm-clang' Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' - " Rust - Plug 'rust-lang/rust.vim' - Plug 'racer-rust/vim-racer' - Plug 'roxma/nvim-cm-racer' - - " Python - " Plug 'davidhalter/jedi-vim' - " Plug 'tell-k/vim-autopep8' - " Plug 'jmcantrell/vim-virtualenv' - - " C/C++ - " Plug 'roxma/clang_complete' - Plug 'roxma/ncm-clang' endif - " Plug 'roxma/vim-tmux-clipboard' - " Plug 'tmux-plugins/vim-tmux-focus-events' - " Plug 'whatyouhide/vim-tmux-syntax' - Plug 'othree/html5.vim' Plug 'mattn/emmet-vim' Plug 'chr4/nginx.vim' - " Plug 'Shougo/neco-vim' Plug 'lervag/vimtex' Plug 'neovimhaskell/haskell-vim' - Plug 'chrisbra/csv.vim' - - " Plug 'veegee/vim-pic' Plug 'pearofducks/ansible-vim' Plug 'lifepillar/pgsql.vim' - " Plug 'leafgarland/typescript-vim' - Plug 'vim-pandoc/vim-pandoc' - Plug 'vim-pandoc/vim-pandoc-syntax' - Plug 'jparise/vim-graphql' - " Plug 'kovetskiy/sxhkd-vim' - " Plug 'mboughaba/i3config.vim' - " Plug 'pangloss/vim-javascript' + Plug 'vim-pandoc/vim-pandoc' | Plug 'vim-pandoc/vim-pandoc-syntax' Plug 'sheerun/vim-polyglot' Plug 'nickhutchinson/vim-cmake-syntax' call plug#end() @@ -162,9 +110,6 @@ set background=dark let base16colorspace=256 silent! colorscheme base16-tomorrow-night -" let g:onedark_termcolors=256 -" silent! colorscheme onedark - if has('shada') set shada=!,'100,<100,s100,h endif @@ -180,14 +125,6 @@ else runtime macros/matchit.vim endif -" if executable("rg") -" set grepprg=rg\ --vimgrep\ --no-heading -" set grepformat=%f:%l:%c:%m,%f:%l:%m -" elseif executable ('ag') -" set grepprg=ag\ --vimgrep -" set grepformat=%f:%l:%c:%m,%f:%l:%m -" endif - " persistent undo if has('persistent_undo') set undodir=$HOME/.local/share/nvim/undo @@ -210,7 +147,6 @@ set number set showmatch set ignorecase set smartcase -" set shiftwidth=4 tabstop=4 softtabstop=4 set splitright set splitbelow set noswapfile @@ -282,7 +218,6 @@ let g:tex_comment_nospell = 1 let g:netrw_banner = 0 let g:netrw_keepdir = 0 let g:netrw_liststyle = 3 -" let g:netrw_sort_options = 'i' let g:netrw_winsize = -28 let g:netrw_sort_sequence = '[\/]$,*' let g:netrw_browse_split = 3 @@ -312,9 +247,6 @@ endfunction command! -range=% HighlightRepeats ,call HighlightRepeats() -" display the callstrack for recent exceptions -command! Backtrace call exception#trace() - " :Grep command! -nargs=1 -bar Grep execute 'silent! grep! ' | redraw! | copen @@ -374,20 +306,12 @@ augroup vimrc autocmd BufEnter term://* startinsert endif - " autocmd FileType help let b:helpful=1 - - " " TODO: remove this when I'm done taking the course - " autocmd BufRead,BufNewFIle *.s set ft=pic8 - " autocmd BufRead,BufNewFile *.js set ft=javascript - autocmd FileType gitcommit \ nnoremap cA \ :Gcommit --amend --date="$(date)" autocmd FileType GV setlocal foldlevel=1 - " autocmd BufRead,BufNewFile *.csv set ft=csv - " delete fugitive buffer when hidden autocmd BufReadPost fugitive:// setlocal bufhidden=delete @@ -425,6 +349,7 @@ if exists('g:plugs["vim-polyglot"]') \ 'javascript', \ 'rust', \ 'tex', + \ 'latex', \ 'markdown', \ 'haskell', \ 'lhaskell' @@ -447,26 +372,16 @@ if exists('g:plugs["ctrlp.vim"]') let g:ctrlp_reuse_window = 'netrw\|help\|quickfix' let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:15,results:15' - " mappings - " nnoremap :ctrlpbuffer - " nnoremap :ctrlpline " leader mappings let g:ctrlp_map = '' nnoremap . :CtrlPTag - " nnoremap p :ctrlp - " nnoremap b :ctrlpbuffer - " nnoremap o :ctrlpmrufiles - nnoremap b :CtrlPBuffer nnoremap r :CtrlPMRUFiles nnoremap f :CtrlPFunky nnoremap :CtrlPFunky nnoremap :CtrlPLine - " nnoremap :CtrlPMRUFiles - - if exists('g:plugs["ctrlp-funky"]') let g:ctrlp_funky_matchtype = 'path' let g:ctrlp_funky_multi_buffers = 1 @@ -516,7 +431,6 @@ endif if exists('g:plugs["gutentags"]') " let g:gutentags_generate_on_empty_buffer = 1 let g:gutentags_ctags_tagfile = '.tags' - let g:gutentags_ctags_exclude = ['*node_modules*', 'tmp*', "package*json"] endif @@ -709,22 +623,6 @@ if exists('g:plugs["vim-airline"]') " let g:airline#extensions#tabline#fnamemod = ':t' endif -" }}} -" lightline {{{ - -" if exists('g:plugs["lightline.vim"]') -" let g:lightline = -" \ { 'colorscheme': '', - -" endif - -" }}} -" csv.vim {{{ - -if exists('g:plugs["csv.vim"]') - let g:csv_delim=',' -endif - " }}} " vim-gitgutter {{{ @@ -749,34 +647,6 @@ if exists('g:plugs["scratch.vim"]') xmap gS (scratch-selection-clear) endif -" }}} -" vim-virtualenv {{{ - -if exists('g:plugs["vim-virtualenv"]') - " TODO: configure this -endif - -" }}} -" vim-ctrlspace {{{ - -if exists('g:plugs["vim-ctrlspace"]') - if s:platform ==? 'linux' - let g:CtrlSpaceFileEngine = 'file_engine_linux_amd64' - - if executable('rg') - let g:CtrlSpaceGlobCommand = 'rg -l --color=never -g ""' - endif - endif - - nnoremap :CtrlSpace O -endif - -" }}} -" vimagit {{{ - -if exists('g:plugs["vimagit"]') -endif - " }}} " denite.nvim {{{ @@ -796,8 +666,6 @@ if exists('g:plugs["denite.nvim"]') call denite#custom#map('insert', '', '', 'noremap') call denite#custom#source('file_mru', 'matchers', ['matcher_fuzzy', 'matcher_project_files']) - " call denite#custom#source('file_rec', 'matchers', ['matcher_cpsm']) - endif " }}} @@ -811,13 +679,6 @@ if exists('g:plugs["vim-pandoc"]') let g:pandoc#syntax#codeblocks#embeds#langs = ['bash=sh', 'bat=dosbatch'] endif -" }}} -" quick-scope {{{ - -if exists('g:plugs["quick-scope"]') - let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] -endif - " }}} " pgsql.vim {{{ @@ -829,7 +690,7 @@ endif " vim-virtualenv {{{ if exists('g:plugs["vim-virtualenv"]') - let g:virtualenv_directory = $HOME . "/.venvs" + let g:virtualenv_directory = $HOME . "/.local/share/virtualenvs" endif " }}} diff --git a/.config/pulse/default.pa b/.config/pulse/default.pa index cee8ca0..68e6e9b 100644 --- a/.config/pulse/default.pa +++ b/.config/pulse/default.pa @@ -8,10 +8,6 @@ load-module module-equalizer-sink sink_name=equalizer load-module module-dbus-protocol -# load bs2b ladspa sink using the equalizer as its master so that we -# have the equalizer and bs2b active on on a single sink -load-module module-ladspa-sink sink_name=crossfeed master=equalizer plugin=bs2b label=bs2b control=650,9.5 - # prevent laptop from being loud if headphones are accidentially # unplugged. load-module module-switch-on-port-available diff --git a/.config/rofi/config.rasi b/.config/rofi/config.rasi new file mode 100644 index 0000000..e2ebf7a --- /dev/null +++ b/.config/rofi/config.rasi @@ -0,0 +1,129 @@ +configuration { + modi: "window,run,drun"; + width: 50; + lines: 15; + columns: 1; + font: "Iosevka 12"; + bw: 1; + location: 0; + padding: 5; + yoffset: 0; + xoffset: 0; + fixed-num-lines: true; + show-icons: true; + terminal: "termite"; + ssh-client: "ssh"; + ssh-command: "{terminal} -e {ssh-client} {host}"; + run-command: "{cmd}"; + run-list-command: ""; + run-shell-command: "{terminal} -e {cmd}"; + window-command: "xkill -id {window}"; + /* drun-icon-theme: ; */ + disable-history: false; + sort: false; + levenshtein-sort: false; + case-sensitive: false; + cycle: true; + sidebar-mode: true; + eh: 1; + auto-select: false; + parse-hosts: false; + parse-known-hosts: true; + combi-modi: "window,run,drun"; + matching: "fuzzy"; + tokenize: true; + m: "-5"; + line-margin: 2; + line-padding: 1; + /* filter: ; */ + separator-style: "solid"; + hide-scrollbar: true; + fullscreen: false; + fake-transparency: false; + dpi: -1; + threads: 0; + scrollbar-width: 8; + scroll-method: 1; + fake-background: "screenshot"; + window-format: "{w} {i}{c} {t}"; + click-to-exit: true; + show-match: true; + /* theme: ; */ + color-normal: "#00383c4a, #c4cbd4, #96404552, #4084d6, #f9f9f9"; + color-urgent: "#002d303b, #cc6666, #e52d303b, #a54242, #f9f9f9"; + color-active: "#002d303b, #b5bd68, #e42d303b, #8c9440, #f9f9f9"; + color-window: "#f22d303b, #7c8389, #1d1f21"; + max-history-size: 25; + pid: "/run/user/1000/rofi.pid"; + /* display-window: ; */ + /* display-windowcd: ; */ + /* display-run: ; */ + /* display-ssh: ; */ + /* display-drun: ; */ + /* display-combi: ; */ + /* display-keys: ; */ + kb-primary-paste: "Control+V,Shift+Insert"; + kb-secondary-paste: "Control+v,Insert"; + kb-clear-line: "Control+w"; + kb-move-front: "Control+a"; + kb-move-end: "Control+e"; + kb-move-word-back: "Alt+b"; + kb-move-word-forward: "Alt+f"; + kb-move-char-back: "Left,Control+b"; + kb-move-char-forward: "Right,Control+f"; + kb-remove-word-back: "Control+Alt+h,Control+BackSpace"; + kb-remove-word-forward: "Control+Alt+d"; + kb-remove-char-forward: "Delete,Control+d"; + kb-remove-char-back: "BackSpace,Control+h"; + kb-remove-to-eol: "Control+k"; + kb-remove-to-sol: "Control+u"; + kb-accept-entry: "Control+j,Control+m,Return,KP_Enter"; + kb-accept-custom: "Control+Return"; + kb-accept-alt: "Shift+Return"; + kb-delete-entry: "Shift+Delete"; + kb-mode-next: "Shift+Right,Control+Tab"; + kb-mode-previous: "Shift+Left,Control+ISO_Left_Tab"; + kb-row-left: "Control+Page_Up"; + kb-row-right: "Control+Page_Down"; + kb-row-up: "Up,Control+p,ISO_Left_Tab"; + kb-row-down: "Down,Control+n"; + kb-row-tab: "Tab"; + kb-page-prev: "Page_Up"; + kb-page-next: "Page_Down"; + kb-row-first: "Home,KP_Home"; + kb-row-last: "End,KP_End"; + kb-row-select: "Control+space"; + kb-screenshot: "Alt+S"; + kb-toggle-case-sensitivity: "grave,dead_grave"; + kb-toggle-sort: "Alt+grave"; + kb-cancel: "Escape,Control+g,Control+bracketleft"; + kb-custom-1: "Alt+1"; + kb-custom-2: "Alt+2"; + kb-custom-3: "Alt+3"; + kb-custom-4: "Alt+4"; + kb-custom-5: "Alt+5"; + kb-custom-6: "Alt+6"; + kb-custom-7: "Alt+7"; + kb-custom-8: "Alt+8"; + kb-custom-9: "Alt+9"; + kb-custom-10: "Alt+0"; + kb-custom-11: "Alt+exclam"; + kb-custom-12: "Alt+at"; + kb-custom-13: "Alt+numbersign"; + kb-custom-14: "Alt+dollar"; + kb-custom-15: "Alt+percent"; + kb-custom-16: "Alt+dead_circumflex"; + kb-custom-17: "Alt+ampersand"; + kb-custom-18: "Alt+asterisk"; + kb-custom-19: "Alt+parenleft"; + kb-select-1: "Super+1"; + kb-select-2: "Super+2"; + kb-select-3: "Super+3"; + kb-select-4: "Super+4"; + kb-select-5: "Super+5"; + kb-select-6: "Super+6"; + kb-select-7: "Super+7"; + kb-select-8: "Super+8"; + kb-select-9: "Super+9"; + kb-select-10: "Super+0"; +} diff --git a/.config/termite/config b/.config/termite/config index 8ffbd9d..d66744e 100755 --- a/.config/termite/config +++ b/.config/termite/config @@ -1,5 +1,5 @@ [options] -font = Roboto Mono 10 +font = Iosevka Term 12 scroll_on_output = false scroll_on_keystroke = true allow_bold = true @@ -15,9 +15,7 @@ cursor_shape = block foreground = #c5c8c6 foreground_bold = #c5c8c6 cursor = #c5c8c6 - -# use rgba for transparency -background = rgba(29, 31, 33, 0.95) +background = #1d1f21 # black color0 = #1d1f21 diff --git a/.config/user-dirs.dirs b/.config/user-dirs.dirs new file mode 100644 index 0000000..88da4f2 --- /dev/null +++ b/.config/user-dirs.dirs @@ -0,0 +1,15 @@ +# This file is written by xdg-user-dirs-update +# If you want to change or add directories, just edit the line you're +# interested in. All local changes will be retained on the next run. +# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped +# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an +# absolute path. No other format is supported. +# +XDG_DESKTOP_DIR="$HOME/desktop" +XDG_DOWNLOAD_DIR="$HOME/downloads" +XDG_TEMPLATES_DIR="$HOME/docs/templates" +XDG_PUBLICSHARE_DIR="$HOME/docs/public-share" +XDG_DOCUMENTS_DIR="$HOME/docs" +XDG_MUSIC_DIR="$HOME/media/music" +XDG_PICTURES_DIR="$HOME/media/pictures" +XDG_VIDEOS_DIR="$HOME/media/videos" diff --git a/.emacs.d/init.el b/.emacs.d/init.el new file mode 100644 index 0000000..929415f --- /dev/null +++ b/.emacs.d/init.el @@ -0,0 +1,1228 @@ +;;; -*- lexical-binding: t; -*- +;; here be dragons + +(when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) +(when (fboundp 'tool-bar-mode) (tool-bar-mode -1)) + +(eval-when-compile + (require 'cl-lib)) + +(require 'package) +(setq package-enable-at-startup nil) + +(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") + ("melpa" . "https://melpa.org/packages/") + ("org" . "https://orgmode.org/elpa/"))) +(package-initialize) + +(setq load-prefer-newer t) + +(when (not package-archive-contents) + (package-refresh-contents)) + +;; make sure use-package is available +(unless (package-installed-p 'use-package) + (package-refresh-contents) + (package-install 'use-package)) + +(eval-when-compile + (require 'use-package)) + +(unless (package-installed-p 'delight) + (package-install 'delight)) + +(unless (package-installed-p 'diminish) + (package-install 'diminish)) + +(require 'diminish) +(require 'bind-key) +(require 'delight) + +(setq use-package-always-ensure t + use-package-verbose nil) + +;; store customizations in an external file +(setq custom-file "~/.emacs.d/custom.el") +(load custom-file 'noerror 'nomessage) + +(setq visible-bell t) + +;; minibuffer garbage collection +(defun dotemacs/minibuffer-setup-hook () + "Set `GC-CONS-THRESHOLD' to `MOST-POSITIVE-FIXNUM'." + (setq gc-cons-threshold most-positive-fixnum)) + +(defun dotemacs/minibuffer-exit-hook () + "Set `GC-CONS-THRESHOLD' to a reasonable number." + (setq gc-cons-threshold (* 64 1024 1024))) + +(add-hook 'minibuffer-setup-hook #'dotemacs/minibuffer-setup-hook) +(add-hook 'minibuffer-exit-hook #'dotemacs/minibuffer-exit-hook) + +;; startup profiler +(use-package esup + :defer t) + +;; utility libraries +(use-package dash + :config + (eval-after-load 'dash '(dash-enable-font-lock))) + +(use-package dash-functional + :after dash) + +(use-package s) +(use-package f) + +;; custom paths for Emacs to store stuff +(defconst dotemacs/user-home-directory + (f-expand (getenv "HOME")) + "Home directory for the current user.") + +(defconst dotemacs/user-emacs-directory + (f-join dotemacs/user-home-directory ".emacs.d") + "Emacs directory for the current user.") + +(defconst dotemacs/user-dropbox-directory + (f-join dotemacs/user-home-directory "Dropbox") + "Dropbox directory for the current user.") + +(defconst dotemacs/user-org-directory + (f-join dotemacs/user-dropbox-directory "org") + "Directory to look for Org files.") + +(defconst dotemacs/user-local-directory + (f-join dotemacs/user-emacs-directory "local") + "Root directory for local Emacs files.") + +(defconst dotemacs/user-host-directory + (f-join dotemacs/user-local-directory (format "@%s" (system-name))) + "Directory for hostname-specific files.") + +(defconst dotemacs/user-etc-directory + (f-join dotemacs/user-host-directory "etc") + "Location for permanent files to be stored.") + +(defconst dotemacs/user-cache-directory + (f-join dotemacs/user-host-directory "cache") + "Location for cache files to be stored.") + +(defun dotemacs/ensure-local-folders () + (dolist (dir (list dotemacs/user-local-directory dotemacs/user-host-directory dotemacs/user-etc-directory dotemacs/user-cache-directory)) + (unless (file-directory-p dir) + (make-directory dir t)))) + +(dotemacs/ensure-local-folders) + +;; shorter confirmation prompts +(defalias 'yes-or-no-p 'y-or-n-p) + +;; general defaults +(setq-default ad-redefinition-action 'accept + apropos-do-all t + compilation-always-kill t + compilation-ask-about-save nil + compilation-scroll-output t + confirm-nonexistent-file-or-buffer t + enable-recursive-minibuffers nil + ;; keep the point out of the minibuffer + minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt) + vc-follow-symlinks t + save-interprogram-paste-before-kill t + sentence-end-double-space nil + ;; scrolling + scroll-conservatively 1001 + scroll-margin 0 + scroll-preserve-screen-position t + ;; whitespace + indent-tabs-mode nil + require-file-newline t + tab-always-indent t + tab-width 4 + echo-keystrokes 0.1 + browse-url-browser-function 'browse-url-generic + browse-url-generic-program "google-chrome-stable" + delete-by-moving-to-trash t + calendar-week-start-day 1 + frame-title-format '(buffer-file-name "%f" ("%b")) + custom-safe-themes t + ;; wrapping + truncate-lines t + truncate-partial-width-windows 50) + +(setq display-line-numbers-type 'relative) + +;; paths +(setq-default abbrev-file-name (f-join dotemacs/user-local-directory "abbrev.el") + auto-save-list-file-name `((".*" . ,(f-join dotemacs/user-cache-directory "autosave"))) + pcache-directory (f-join dotemacs/user-cache-directory "pcache") + server-auth-dir (f-join dotemacs/user-cache-directory "server") + url-cache-directory (f-join dotemacs/user-cache-directory "url") + url-configuration-directory (f-join dotemacs/user-etc-directory "url") + backup-directory-alist `((".*" . ,(f-join dotemacs/user-cache-directory "backups")))) + +;; history and backups +(setq-default auto-save-default nil + create-lockfiles nil + history-length 500 + history-delete-duplicates t + history-save-minibuffer-history t + make-backup-files nil) + +(setq savehist-file (f-join dotemacs/user-cache-directory "savehist") + savehist-save-minibuffer-history t + savehist-autosave-interval nil + savehist-additional-variables '(kill-ring search-ring regexp-search-ring) + save-place-file (f-join dotemacs/user-cache-directory "saveplace")) + +(use-package unkillable-scratch + :config + (setq unkillable-scratch-behavior 'bury) + (add-hook 'after-init-hook 'unkillable-scratch)) + +;; save-place.el +(setq save-place-file (f-join dotemacs/user-cache-directory "save-place") + save-place-forget-unreadable-files t) +(save-place-mode 1) + +(setq-default bookmark-default-file (f-join dotemacs/user-cache-directory "bookmarks") + bookmark-save-flag t) + +;; unique buffer names +(require 'uniquify) +(setq uniquify-buffer-name-style 'post-forward-angle-brackets + uniquify-separator "/" + uniquify-ignore-buffers-re "^\\*") + +;; recent files +(use-package recentf + :init (add-hook 'after-init-hook #'recentf-mode) + :config + (setq recentf-save-file (f-join dotemacs/user-cache-directory "recentf") + recentf-max-saved-items 300 + recentf-max-menu-items 0 + recentf-filename-handlers '(abbreviate-file-name) + recentf-exclude + (list "^/tmp/" "^/ssh:" "\\.?ido\\.last$" "\\.revive$" "/TAGS$" + "^/var/folders/.+$"))) + +(setq eshell-directory-name (concat dotemacs/user-cache-directory "eshell")) + +(use-package editorconfig + :demand t + :diminish editorconfig-mode + :mode ("\\.?editorconfig$" . editorconfig-conf-mode) + :config + (add-hook 'after-init-hook #'editorconfig-mode)) + +;; unicode +(when (fboundp 'set-charset-priority) + (set-charset-priority 'unicode)) +(setq locale-coding-system 'utf-8) +(set-terminal-coding-system 'utf-8) +(set-keyboard-coding-system 'utf-8) +(set-selection-coding-system 'utf-8) +(prefer-coding-system 'utf-8) + +(when (string-equal system-type "gnu/linux") + (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING) + select-enable-clipboard t + select-enable-primary t)) + +;; always prettify symbols +(when (fboundp 'global-prettify-symbols-mode) + (global-prettify-symbols-mode)) +(setq prettify-symbols-unprettify-at-point 'right-edge) + +;; show column and line numbers in the mode line +(column-number-mode) +(line-number-mode) + +;; highlight matching parens +(setq show-paren-delay 0.1 + show-paren-highlight-openparen t + show-paren-when-point-inside-paren t) +(show-paren-mode) + +(auto-compression-mode t) +(random t) + +;; reload files that have been modified outside of Emacs +(global-auto-revert-mode t) +(setq auto-revert-verbose nil) + +;; shift+{up,down,left,right} to navigate between windows +(require 'windmove) +(windmove-default-keybindings) + +;; show number of matches +(use-package anzu + :defer t + :diminish anzu-mode + :init + (setq anzu-cons-mode-line-p nil) + :config + (global-anzu-mode +1) + :bind (("M-%" . anzu-query-replace) + ("C-M-%" . anzu-query-replace-regexp))) + +;; disable annoying startup stuff +(advice-add #'display-startup-echo-area-message :override 'ignore) + +(setq inhibit-startup-message t + inhibit-startup-echo-area-message user-login-name + inhibit-default-init t + initial-major-mode 'fundamental-mode + initial-scratch-message nil) + +;; run Emacs as a server +(require 'server) +(unless (server-running-p) + (server-start)) + +(use-package color-theme-sanityinc-tomorrow + :defer t) + +(use-package doom-themes + :config + (load-theme 'doom-tomorrow-night t) + (doom-themes-neotree-config) + + (setq doom-neotree-enable-variable-pitch t + doom-neotree-file-icons 'simple + doom-neotree-line-spacing 2) + + (doom-themes-org-config)) + +(use-package all-the-icons + :disabled ) + +(use-package all-the-icons-dired + :disabled + :hook (dired-mode . all-the-icons-dired-mode) + :after (:all all-the-icons)) + +(use-package neotree + :disabled + :after (:all all-the-icons projectile) + :init + (setq neo-create-file-auto-open t + neo-banner-message nil + neo-smart-open nil + neo-show-updir-line nil + neo-mode-line-type 'neotree + neo-dont-be-alone t + neo-window-width 32 + neo-show-hidden-files t + neo-auto-indent-point t + neo-modern-sidebar t) + + (setq neo-theme + (if window-system 'icons 'arrow)) + + (setq projectile-switch-project-action 'neotree-projectile-action) + + :bind (([f2] . neotree-toggle) + ("C-c f t" . neotree-toggle))) + +(unless (package-installed-p 'hydra) + (package-install 'hydra)) + +(use-package hydra + :load-path "site-lisp/hydra") + +(use-package counsel) + +(use-package counsel-projectile + :after (:all counsel projectile) + :config + (counsel-projectile-mode)) + +(use-package swiper) + +(use-package avy) + +(use-package ivy + :load-path "site-lisp/swiper" + :diminish ivy-mode + :bind (("C-s" . swiper) + ("C-x C-f" . counsel-find-file) + ("C-c C-s" . counsel-ag) + ("C-c j" . counsel-git-grep) + ("C-x l" . counsel-locate) + ("C-c C-r" . ivy-resume) + :map ivy-mode-map + ("C-'" . ivy-avy)) + :config + (ivy-mode 1) + + (setq projectile-completion-system 'ivy) + (setq magit-completing-read-function 'ivy-completing-read) + + (setq ivy-count-format "(%d/%d) ") + (setq enable-recursive-minibuffers t) + (setq ivy-use-virtual-buffers t) + (setq ivy-height 10)) + +(defconst dotemacs/themes + '((sanityinc-tomorrow-day 'light) + (sanityinc-tomorrow-night 'dark) + (doom-tomorrow-night 'dark)) + "List of available themes.") + +(defun dotemacs/disable-all-themes () + "Disable all active themes." + (interactive) + (dolist (theme dotemacs/themes) + (disable-theme (car theme)))) + +(defun dotemacs/generate-theme-fn (theme-name dark) + (let ((theme-fn-name (intern (format "load-theme/%s" theme-name)))) + `(defun ,theme-fn-name () + (interactive) + ;; (setq dark-theme (equal ,dark 'dark)) + (dotemacs/disable-all-themes) + (load-theme ',theme-name t) + (with-eval-after-load 'smart-mode-line + (sml/apply-theme ,dark))))) + +(defmacro dotemacs/generate-all-theme-fns () + (declare (indent 4)) + `(progn ,@(mapcar + (lambda (x) + (dotemacs/generate-theme-fn (nth 0 x) (nth 1 x))) + dotemacs/themes))) + +(dotemacs/generate-all-theme-fns) + +(defun dotemacs/ivy-load-theme-action (x) + (funcall (intern (format "load-theme/%s" (car x))))) + +(defun dotemacs/ivy-load-theme () + "Use `ivy-read` select and load a theme." + (interactive) + (ivy-read "Select theme: " dotemacs/themes + :action (lambda (x) + (funcall (intern (format "load-theme/%s" (car x))))))) + +; ;; begin helm +; (use-package helm +; :diminish helm-mode +; :config +; (require 'helm) +; (require 'helm-config) + +; (global-set-key (kbd "C-c h") 'helm-command-prefix) +; (global-unset-key (kbd "C-x c")) + +; (setq helm-quick-update t +; helm-M-x-fuzzy-match t +; helm-apropos-fuzzy-match t +; helm-locate-fuzzy-sort-fn t +; helm-recentf-fuzzy-match t +; helm-buffers-fuzzy-matching t +; helm-move-to-line-cycle-in-source nil +; helm-display-header-line nil +; helm-display-function 'pop-to-buffer +; helm-ff-newfile-prompt-p nil +; helm-ff-skip-boring-files t +; helm-ff-search-library-in-sexp t +; helm-ff-file-name-history-use-recentf t +; helm-echo-input-in-header-line t +; helm-reuse-last-window-split-state nil +; helm-split-window-in-side-p t +; helm-autoresize-min-height 10) + +; (when (and (eq system-type 'gnu/linux) +; (executable-find "locate")) +; (setq helm-locate-command "locate %s -e -A --regex %s")) + +; (when (and (eq system-type 'gnu/linux) +; (executable-find "git")) +; (setq helm-ls-git-grep-command "git grep -n%cH --color=always --full-name -e %p %f")) + +; (helm-mode t) +; (helm-autoresize-mode) +; (helm-adaptive-mode t) +; :bind (("M-x" . helm-M-x) +; ("M-y" . helm-show-kill-ring) +; ("C-h a" . helm-apropos) +; ("C-x b" . helm-mini) +; ("C-x C-b" . helm-buffers-list) +; ("C-x C-l" . helm-locate) +; ("C-x C-m" . helm-man-woman) +; ("C-x C-f" . helm-find-files) +; ("C-x C-r" . helm-recentf) +; ;; ("C-c h o" . helm-occur) +; ;; ("C-c h x" . helm-register) +; ("C-c p h" . helm-projectile) +; ("C-c b p" . helm-browse-project) +; :map helm-map +; ("TAB" . helm-execute-persistent-action) +; ("C-z" . helm-select-action) +; ("M-i" . helm-previous-line) +; :map helm-command-prefix +; ("b" . helm-buffers-list) +; ("f" . helm-find-files) +; ("m" . helm-mini) +; ("o" . helm-imenu))) + +; (use-package helm-projectile +; :after (:all helm projectile) +; :init +; (setq projectile-completion-system 'helm +; projectile-switch-project-action 'helm-projectile) +; :config +; (helm-projectile-on)) + +; (use-package helm-swoop +; :after (:all helm) +; :init +; (setq helm-swoop-use-fuzzy-match t +; helm-swoop-split-direction 'split-window-vertically +; helm-swoop-split-with-multiple-windows nil +; helm-swoop-split-window-function #'pop-to-buffer +; helm-swoop-use-fuzzy-match t +; helm-swoop-speed-or-color t) +; :bind (("M-i" . helm-swoop) +; ("C-s" . helm-swoop) +; ("C-c M-i" . helm-multi-swoop) +; ("C-x M-i" . helm-multi-swoop-all))) + + +; (use-package helm-descbinds +; :after (:all helm) +; :config +; (add-hook 'after-init-hook #'helm-descbinds-mode) +; :bind (("C-h b" . helm-descbinds))) + +; (use-package helm-ls-git +; :after helm) + +; (use-package helm-flx +; :init +; (setq helm-flx-for-helm-find-files t +; helm-flx-for-helm-locate t) +; :config +; (helm-flx-mode +1)) + +; (use-package helm-ag +; :commands (helm-ag helm-projectile-ag) +; :init +; (setq helm-ag-insert-at-point 'symbol) +; :bind (("M-p" . helm-projectile-ag))) + +; ;; end helm + +(use-package ag + :init + (setq ag-highlight-search t + ag-reuse-window t + ag-reuse-buffers t)) + +(use-package exec-path-from-shell + :if (memq window-system '(mac ns x)) + :init + (setq exec-path-from-shell-check-startup-files nil) + :config + (exec-path-from-shell-copy-envs + '("WORKON_HOME" "PROJECT_HOME")) + (exec-path-from-shell-initialize)) + +;; python setup +(use-package python-mode + :mode ("\\.py\\'" . python-mode) + :config + (setq python-shell-completion-native-enable nil + python-shell-interpreter "python")) + +(use-package elpy + :config + (elpy-enable)) + +;; don't use native tooltips +(cond ((eq system-type 'gnu/linux) + (setq x-gtk-use-system-tooltips nil))) + +;; font Emacs should use +(cond ((member "Iosevka" (font-family-list)) + (set-frame-font "Iosevka-12") + (set-face-attribute 'default nil :font "Iosevka-12"))) + +;; prettier mode line +(use-package smart-mode-line + :init + (setq-default sml/theme 'dark + sml/vc-mode-show-backend t) + :config + (sml/setup)) + +;; dired +(require 'dired) +(require 'dired-x) + +(put 'dired-find-alternative-file 'disabled nil) + +(setq dired-recursive-deletes 'always + dired-recursive-copies 'always + dired-dwim-target t + dired-listing-switches "-laGh1v --group-directories-first") + +(use-package dired-narrow + :after dired + :bind (:map dired-mode-map + ("/" . dired-narrow))) + +(use-package peep-dired + :after dired + ;; don't access `dired-mode-map' until `peep-dired' is loaded + :defer t + :init + (setq peep-dired-cleanup-on-disable t) + :bind (:map dired-mode-map + ("P" . peep-dired))) + +;; manage popups +(use-package shackle + :init + (setq shackle-default-alignment 'below + shackle-rules + '(("*eshell*" :select t :other t) + ("*Help*" :select t :inhibit-window-quit t :other t) + ("*Messages*" :select nil :inhibit-window-quit t) + ("*magit-dispatch-popup*" :select t :align t) + (" *NeoTree*" :select t :align left :static t) + ("*compilation*" :size 0.25 :noselect t :autokill t :autoclose t) + ("*ert*" :same t :modeline t) + ("*info*" :size 0.5 :select t :autokill t) + ("*Backtrace*" :size 20 :noselect t) + ("*Warnings*" :size 12 :noselect t :autofit t) + ("*Messages*" :size 12 :noselect t) + ("*Help*" :size 0.3) + ("^\\*.*Shell Command.*\\*$" :regexp t :size 20 :noselect t :autokill t) + (apropos-mode :size 0.3 :autokill t :autoclose t) + (Buffer-menu-mode :size 20 :autokill t) + (comint-mode :noesc t) + (grep-mode :size 25 :noselect t :autokill t) + (profiler-report-mode :size 0.3 :regexp t :autokill t :modeline minimal) + (tabulated-list-mode :noesc t) + ("^ ?\\*" :regexp t :size 15 :noselect t :autokill t :autoclose t) + ("^\\*magit" :regexp t :size 0.5 :noesc t :autokill t))) + :config + (add-hook 'after-init-hook #'shackle-mode)) + +;; evil mode +(use-package evil + :disabled + :init + (setq evil-want-fine-undo 'fine + evil-default-cursor 'box + evil-move-beyond-eol t + evil-esc-delay 0 + evil-ex-substitute-global t + evil-ex-visual-char-range t + evil-symbol-word-search t + evil-want-C-u-scroll t + evil-want-Y-yank-to-eol t + evil-magic t + evil-echo-state t) + :config + ;; set initial state for specific modes + (cl-loop for (mode . state) + in '((help-mode . emacs) + (debugger-mode . emacs) + (dired-mode . emacs) + (tabulated-list-mode . emacs) + (view-mode . emacs) + (comint-mode . emacs) + (term-mode . emacs) + (calendar-mode . emacs) + (Man-mode . emacs) + (grep-mode . emacs) + (image-mode . emacs) + (paradox-menu-mode . emacs) + (epa-key-list-mode . emacs) + (dashboard-mode . emacs) + (neotree-mode . emacs) + (prodigy-mode . emacs) + (special-mode . emacs) + (messages-buffer-mode . emacs) + (flymake-diagnostics-buffer-mode . emacs) + (TeX-output-mode . emacs) + (esup-mode . emacs)) + do (evil-set-initial-state mode state)) + (evil-mode) + (evil-select-search-module 'evil-search-module 'evil-search)) + +(use-package evil-commentary + :diminish + :after evil + :config + (evil-commentary-mode +1)) + +(use-package evil-visualstar + :after evil + :config + (global-evil-visualstar-mode)) + +(use-package evil-anzu + :after evil) + +(use-package evil-matchit + :after evil + :config + (global-evil-matchit-mode)) + +(use-package evil-surround + :after evil + :config + (global-evil-surround-mode)) + +(use-package evil-search-highlight-persist + :after evil + :config + (global-evil-search-highlight-persist t)) + +(use-package undo-tree + :diminish + :init + (setq undo-tree-history-directory-alist `((".*" . ,(f-join dotemacs/user-cache-directory "undo-tree-history"))) + undo-tree-auto-save-history t)) + +(use-package general + :init + (setq general-default-keymaps 'evil-normal-state-map) + :config + (require 'general) + + (general-define-key "[ SPC" 'insert-newline-above + "] SPC" 'insert-newline-below)) + +(use-package move-text + :after general + :config + (general-define-key "[ e" 'move-text-up + "] e" 'move-text-down)) + +(use-package ag + :config + (setq ag-highlight-search t + ag-reuse-buffers t)) + +(use-package flycheck + :diminish flycheck-mode) + +(use-package flyspell + :commands (flyspell-mode flyspell-prog-mode) + :config + (setq ispell-program-name (executable-find "aspell") + ispell-extra-args '("--sug-mode=ultra"))) + +(use-package magit + :init + (setq magit-section-show-children-count t + magit-diff-arguments '("--histogram") + magit-ediff-dwim-show-on-hunks t + magit-repository-directories `(( ,(f-join (getenv "HOME") "src" "projects")) + ( ,(f-join (getenv "HOME") "src" "repos")))) + :config + (require 'with-editor) + (add-hook 'shell-mode-hook 'with-editor-export-editor) + (add-hook 'term-exec-hook 'with-editor-export-editor) + (add-hook 'eshell-mode-hook 'with-editor-export-editor) + :bind (("C-c g" . magit-status))) + +(use-package evil-magit + :disabled + :after (:all evil magit)) + +(use-package which-key + :diminish which-key-mode + :init + (setq which-key-popup-type 'minibuffer + which-key-add-column-padding 1 + which-key-max-display-columns nil + which-key-min-display-lines 5 + which-key-sort-uppercase-first nil + which-key-sort-order #'which-key-prefix-then-key-order) + :config + (set-face-attribute 'which-key-local-map-description-face nil :weight 'bold) + (which-key-setup-side-window-bottom) + (add-hook 'after-init-hook #'which-key-mode)) + +(use-package expand-region + :bind (("C-c C-+" . er/expand-region) + ("C-c C--" . er/contract-region))) + +(use-package eldoc + :diminish + :config + (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode) + (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode) + (add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)) + +(use-package projectile + :diminish + :init + (setq projectile-enable-caching t + projectile-cache-file (f-join dotemacs/user-cache-directory "projectile-cache.el") + projectile-known-projects-file (f-join dotemacs/user-cache-directory "projectile-projects.el")) + :config + (projectile-mode)) + +(use-package company + :diminish + :init + (setq company-dabbrev-downcase nil + company-dabbrev-ignore-case t + company-dabbrev-code-ignore-case t + company-dabbrev-code-everywhere t + company-idle-delay 1 + company-show-numbers t + company-minimum-prefix-length 2 + company-selection-wrap-around t + company-tooltip-limit 10 + company-begin-commands '(self-insert-command) + company-backends '((company-files + company-keywords + company-capf + company-yasnippet) + (company-abbrev)) + company-disabled-backends '(dabbrev) + company-transformers '(company-sort-by-occurrence + company-sort-by-backend-importance)) + :config + (global-company-mode) + :bind (("C-." . company-files) + ("M-" . company-complete) + ("C-c C-y" . company-yasnippet))) + +(use-package company-statistics + :after company + :config + (setq company-statistics-file (f-join dotemacs/user-cache-directory "company-statistics-cache.el")) + (add-hook 'after-init-hook #'company-statistics-mode)) + +(use-package cmake-mode) + +(use-package org + :diminish org-indent-mode + :config + (setq org-directory (f-expand "~/Dropbox/org") + org-agenda-files '("~/Dropbox/org/agenda.org") + org-default-notes-file "~/Dropbox/org/notes.org") + + ;; source code + (setq org-src-fontify-natively t + org-src-preserve-indentation t + org-src-window-setup 'current-window + org-src-strip-leading-and-trailing-blank-lines t) + + (setq org-agenda-custom-commands + '(("D" "Deadlines" + ((tags-todo "DEADLINE=\"\"" + ((org-agenda-overriding-header "Due today"))) + (tags-todo "DEADLINE<\"\"" + ((org-agenda-overriding-header "Late"))) + (tags-todo "+DEADLINE<\"<+5d>\"+DEADLINE>\"\"" + ((org-agenda-overriding-header "Very late"))))) + ("@" "Contexts" + ((tags-todo "@email" + ((org-agenda-overriding-header "Emails"))) + (tags-todo "@phone" + ((org-agenda-overriding-header "Phone"))))))) + + (setq org-todo-keywords + '((sequence "TODO(t)" "WAITING(w)" "SCHEDULED(s)" "ACTIVE(a)" "|" "DONE(d)" "CANCELED(c)"))) + + ;; capture templates + (setq org-capture-templates + '(("t" "Todo" entry (file+headline "~/Dropbox/org/agenda.org" "Tasks") + "* TODO %?\nAdded: %U\n" :prepend t :kill-buffer t))) + + ;; agenda + (setq org-agenda-show-all-dates t + org-deadline-warning-days 14) + + ;; dim blocked tasks + (setq org-agenda-dim-blocked-tasks t) + + ;; compact block agenda view + (setq org-agenda-compact-blocks t) + + ;; time + (setq org-clock-persist 'history) + (org-clock-persistence-insinuate) + (setq org-clock-out-remove-zero-time-clocks t) + (setq org-clock-out-when-done t) + (setq org-clock-report-include-clocking-task t) + (setq org-pretty-entities t) + + ;; resume clocking task on clock-in if the clock is open + (setq org-clock-in-resume t + ;; Save clock data and state changes and notes in the LOGBOOK drawer + org-clock-into-drawer t + ;; don't prompt to resume active clock + org-clock-persist-query-resume nil + ;; auto clock resolution for finding open clocks + org-clock-auto-clock-resolution '(when-no-clock-is-running) + ;; include current clocking task in clock reports + org-clock-report-include-clocking-task t + ;; round time + org-time-stamp-rounding-minutes '(1 1) + ;; keep tasks with dates on the global todo lists + org-agenda-todo-ignore-with-date nil + ;; keep tasks with deadlines on the global todo lists + org-agenda-todo-ignore-deadlines nil + ;; keep tasks with scheduled dates on the global todo lists + org-agenda-todo-ignore-scheduled nil + ;; keep tasks with timestamps on the global todo lists + org-agenda-todo-ignore-timestamp nil + ;; remove completed deadline tasks from the agenda view + org-agenda-skip-deadline-if-done t + ;; remove completed scheduled tasks from the agenda view + org-agenda-skip-scheduled-if-done t + ;; remove completed items from search results + org-agenda-skip-timestamp-if-done t + ;; show all future entries for repeating tasks + org-agenda-repeating-timestamp-show-all t + ;; show all agenda dates - even if they are empty + org-agenda-show-all-dates t) + + ;; sorting order for agenda tasks + (setq org-agenda-sorting-strategy + '((agenda habit-down time-up user-defined-up priority-down effort-up category-keep) + (todo category-up priority-down effort-up) + (tags category-up priority-down effort-up) + (search category-up))) + + ;; weekly agenda starts on Monday + (setq org-agenda-start-on-weekday 1) + + ;; don't hide leading stars + (setq org-hide-leading-stars nil) + + (setq org-blank-before-new-entry '((heading . nil) + (plain-list-item . auto))) + + (setq org-id-method (quote uuidgen)) + (setq org-deadline-warning-days 30) + ;; (setq org-table-export-default-format "orgtbl-to-tsv") + + ;; logging time + (setq org-log-done '(time)) + (setq org-log-into-drawer "LOGBOOK") + + (setq org-plantuml-jar-path "~/bin/plantuml.jar") + + (add-to-list 'org-structure-template-alist + (list "p" (concat ":PROPERTIES:\n" + "?\n" + ":END:"))) + + (add-to-list 'org-structure-template-alist + (list "eh" (concat ":EXPORT_FILE_NAME: ?\n" + ":EXPORT_TITLE:\n" + ":EXPORT_OPTIONS: toc:nil html-postamble:nil num:nil"))) + + ;; use my gpg key to encrypt any heading with the :crypt: tag + (require 'org-crypt) + (org-crypt-use-before-save-magic) + + (setq org-tags-exclude-from-inheritance '("crypt") + org-crypt-key "1C534F4138D5CCE4") + + (require 'ox-latex) + + (add-to-list 'org-latex-classes + '("beamer" + "\\documentclass\[presentation\]\{beamer\}" + ("\\section\{%s\}" . "\\section*\{%s\}") + ("\\subsection\{%s\}" . "\\subsection*\{%s\}") + ("\\subsubsection\{%s\}" . "\\subsubsection*\{%s\}"))) + + (use-package ob-http) + + (add-to-list 'org-src-lang-modes '("plantuml" . plantuml)) + + (org-babel-do-load-languages + 'org-babel-load-languages + '((emacs-lisp . t) + (http . t) + (haskell . t) + (python . t) + (sql . t) + (sqlite . t) + (plantuml . t))) + :bind (("C-c c" . org-capture) + ("C-c a" . org-agenda) + ("C-c l" . org-store-link))) + +(use-package htmlize + :after (:all org)) + +(use-package elfeed + :commands elfeed + :bind ("C-x w" . elfeed)) + +(use-package elfeed-org + :after elfeed + :init + (setq rmh-elfeed-org-files (list (f-expand "~/Dropbox/org/elfeed.org"))) + :config + (elfeed-org)) + +(use-package tramp + :init + (setq-default tramp-auto-save-directory (f-join dotemacs/user-cache-directory "tramp-auto-save/") + tramp-backup-directory-alist backup-directory-alist + tramp-persistency-file-name (f-join dotemacs/user-cache-directory "tramp-persistency.el")) + (setq tramp-default-method "ssh" + tramp-use-ssh-controlmaster-options "")) + +(use-package json-mode + :mode ("\\.json\\'" . json-mode)) + +(use-package plantuml-mode + :init + (setq plantuml-jar-path "~/bin/plantuml.jar") + :mode (("\\.plantuml\\'" . plantuml-mode) + ("\\.puml\\'" . plantuml-mode))) + +(use-package prodigy + :bind (("" . prodigy))) + +(use-package yasnippet + :defer t + :diminish yas-minor-mode + :init + (setq yas-snippet-dirs '("~/.emacs.d/snippets/private") + yas-indent-line nil) + :config + (yas-reload-all) + (yas-global-mode 1) + + (unbind-key "TAB" yas-minor-mode-map) + (unbind-key "" yas-minor-mode-map)) + +(use-package yasnippet-snippets + :after yasnippet) + +(use-package hippie-exp + :ensure nil + :defer t + :bind (("" . hippie-expand) + ("C-j" . hippie-expand)) + :config + (setq-default hippie-expand-try-functions-list '(yas-hippie-try-expand))) + +(use-package tex + :mode (("\\.tex\\'" . latex-mode)) + :ensure auctex + :config + ;; Update PDF buffers after successful LaTeX runs + (add-hook 'TeX-after-TeX-LaTeX-command-finished-hook #'TeX-revert-document-buffer) + + (setq TeX-save-query nil + TeX-auto-save t + TeX-parse-self t + TeX-PDF-mode t + TeX-source-correlate-mode t + TeX-source-correlate-start-server t + TeX-source-correlate-method 'synctex + LaTeX-fill-break-at-separators nil) + + (add-to-list 'TeX-view-program-selection + '(output-pdf "Zathura")) + + (setq-default TeX-master nil + TeX-engine 'luatex) + + ;; enable reftex integration + (add-hook 'LaTeX-mode-hook 'turn-on-reftex) + (setq reftex-plug-into-AUCTeX t) + + (add-hook 'LaTeX-mode-hook 'flyspell-mode) + (add-hook 'LaTeX-mode-hook 'flyspell-buffer) + (add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)) + +(use-package auctex-latexmk + :init + (setq auctex-latexmk-inherit-TeX-PDF-mode t) + :config + (auctex-latexmk-setup)) + +(use-package company-auctex + :mode (("\\.tex\\'" . latex-mode)) + :after (:all company auctex) + :config + (add-hook 'LaTeX-mode-hook #'company-auctex-init) + (add-hook 'TeX-mode-hook #'company-auctex-init)) + +(use-package markdown-mode + :commands (markdown-mode gfm-mode) + :mode (("README\\.md'" . gfm-mode) + ("\\.md\\'" . markdown-mode) + ("\\.markdown\\'" . markdown-mode))) + +(use-package haskell-mode + :mode (("\\.hs\"" . haskell-mode)) + :commands haskell-mode + :config + (require 'haskell-mode) + + (setq haskell-interactive-popup-errors nil + haskell-ask-also-kill-buffers nil + haskell-process-type 'auto) + + (add-hook 'haskell-mode-hook #'haskell-indentation-mode) + (add-hook 'haskell-mode-hook #'interactive-haskell-mode)) + +(use-package hindent + :diminish hindent-mode + :after haskell-mode + :config + (add-hook 'haskell-mode-hook #'hindent-mode)) + +(use-package yaml-mode + :mode ("\\.yml\\'" . yaml-mode)) + +(use-package ini-mode + :mode ("\\.ini\\'" . ini-mode)) + +(use-package toml-mode + :mode (("\\.toml\\'" . toml-mode) + ("Pipfile" . toml-mode))) + +(use-package js2-mode + :mode ("\\.js\\'" . js2-mode) + :interpreter ("node" . js2-mode)) + +(use-package tern + :after js2-mode) + +(use-package company-tern + :init + (add-to-list 'company-backends 'company-tern) + (add-hook 'js2-mode-hook 'tern-mode)) + +(use-package web-mode + :mode (("\\.html\\'" . web-mode)) + :init + (setq web-mode-style-padding 4 + web-mode-script-padding 4 + web-mode-css-indent-offset 4 + web-mode-code-indent-offset 4 + web-mode-markup-indent-offset 2 + web-mode-enable-auto-quoting nil + web-mode-comment-keywords t + web-mode-enable-css-colorization t + web-mode-enable-current-element-highlight t + web-mode-enable-heredoc-fontification t + web-mode-enable-comment-keywords t + web-mode-enable-current-element-highlight t + web-mode-enable-current-column-highlight t + web-mode-enable-column-highlight t + web-mode-engines-alist + '(("jinja" . "\\.html\\'"))) + :config + (add-hook 'web-mode-hook #'emmet-mode)) + +(use-package company-web + :after (:all company web-mode) + :config + (require 'company-web-html)) + +(use-package css-mode + :after web-mode + :mode ("\\.css$" . css-mode) + :config + (setq css-indent-offset 4)) + +(use-package sass-mode + :after web-mode + :mode ("\\.sass\\'" . sass-mode)) + +(use-package scss-mode + :after web-mode + :mode ("\\.scss\\'" . scss-mode)) + +(use-package emmet-mode + :after web-mode + :init + (setq-default emmet-move-cursor-between-quotes t) + :config + (add-hook 'sgml-mode-hook 'emmet-mode) + (add-hook 'css-mode-hook 'emmet-mode) + + (unbind-key "" emmet-mode-keymap) + (unbind-key "C-M-" emmet-mode-keymap) + (unbind-key "C-M-" emmet-mode-keymap)) + +(use-package rust-mode + :mode "\\.rs\\'" + :init + (setq rust-format-on-save t)) + +(use-package macrostep + :defer t + :bind (:map emacs-lisp-mode-map + ("C-c e" . macrostep-expand))) + +(use-package systemd) + +(use-package nginx-mode) + +(defun insert-newline-above (count) + "Insert one or several lines above the current point's line without changing +the current state and point position." + (interactive "p") + (dotimes (_ count) (save-excursion (evil-insert-newline-above)))) + +(defun insert-newline-below (count) + "Insert one or several lines below the current point's line without changing +the current state and point position." + (interactive "p") + (dotimes (_ count) (save-excursion (evil-insert-newline-below)))) + +(defun dotemacs/scale-font-size (direction) + "Scale the font. When DIRECTION is positive or zero, the font is scaled up, +otherwise it is scaled down." + (interactive) + (let ((scale 0.5)) + (if (eq direction 0) + (text-scale-set 0) + (if (< direction 0) + (text-scale-decrease scale) + (text-scale-increase scale))))) + +(defun dotemacs/increase-font-size () + "Increase font size." + (interactive) + (dotemacs/scale-font-size 1)) + +(defun dotemacs/decrease-font-size () + "Decrease font size." + (interactive) + (dotemacs/scale-font-size -1)) + +(defun dotemacs/reset-font-size () + "Reset font size." + (interactive) + (dotemacs/scale-font-size 0)) + +(defun dotemacs/rename-file-and-buffer (new-name) + "Renames both current buffer and file it's visiting to NEW-NAME." + (interactive "sNew name: ") + (let ((name (buffer-name)) + (filename (buffer-file-name))) + (if (not filename) + (message "Buffer '%s' is not visiting a file!" name) + (if (get-buffer new-name) + (message "A buffer named '%s' already exists!" new-name) + (progn + (rename-file filename new-name 1) + (rename-buffer new-name) + (set-visited-file-name new-name) + (set-buffer-modified-p nil)))))) + diff --git a/.gitconfig b/.gitconfig index bc1dc03..857cef3 100644 --- a/.gitconfig +++ b/.gitconfig @@ -4,16 +4,22 @@ [color] ui = auto -[user] - email = zyeryi@gmail.com - name = Alexander Schmidt +[url "ssh://git@github.com/"] + insteadOf = https://github.com/ + +[url "ssh://git@bitbucket.org/"] + insteadOf = https://bitbucket.org/ + +[url "ssh://git@gitlab.com/"] + insteadOf = https://gitlab.com [alias] - ls = log -n 16 --pretty=format:"%C(yellow)%h\\ %C(cyan)[%cn]\\ %C(reset)%s\\ %C(red)%d" --decorate - lo = log --pretty=format:"%C(yellow)%h\\ %C(cyan)[%cn]\\ %C(reset)%s\\ %C(red)%d" --decorate + ls = log -n 16 --pretty=format:"%C(yellow)%h\\ %C(cyan)[%cn]\\ %C(reset)%s\\ %C(red)%d" --decorate + lo = log --pretty=format:"%C(yellow)%h\\ %C(cyan)[%cn]\\ %C(reset)%s\\ %C(red)%d" --decorate ll = log --pretty=format:"%C(yellow)%h\\ %C(cyan)[%cn]\\ %C(reset)%s\\ %C(red)%ad" --decorate --date=short --stat tree = log --pretty=format:"%C(yellow)%h\\ %C(cyan)[%cn]\\ %C(reset)%s\\ %C(red)%d" --decorate --graph graph = log --graph --date-order --all --pretty=format:'%h %Cred%d %Cgreen%ad %Cblue%cn %Creset%s' --date=short + graph2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all unstage = reset HEAD st = status ch = checkout diff --git a/.gtkrc-2.0 b/.gtkrc-2.0 new file mode 100644 index 0000000..2583723 --- /dev/null +++ b/.gtkrc-2.0 @@ -0,0 +1,16 @@ +# vim: set ft=gtkrc : + +gtk-theme-name="Arc-Dark" +gtk-icon-theme-name="Paper" +gtk-font-name="Noto Sans 11" +gtk-cursor-theme-size=0 +gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ +gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR +gtk-button-images=0 +gtk-menu-images=0 +gtk-enable-event-sounds=1 +gtk-enable-input-feedback-sounds=1 +gtk-xft-antialias=1 +gtk-xft-hinting=1 +gtk-xft-hintstyle="hintslight" +gtk-xft-rgba="rgb" diff --git a/.inputrc b/.inputrc index d8594fe..cd13288 100644 --- a/.inputrc +++ b/.inputrc @@ -3,21 +3,31 @@ $include /etc/inputrc -set meta-flag on set input-meta on set output-meta on -set convert-meta on +set convert-meta off -set visible-stats on +set match-hidden-files on set page-completions on set completion-ignore-case on set completion-query-items 200 set show-all-if-ambiguous on set show-all-if-unmodified on set echo-control-characters off +set skip-completed-text on +set match-hidden-files off + +# colors +set colored-stats on +set visible-stats on +set mark-symlinked-directories on +set colored-completion-prefix on +set menu-complete-display-prefix on # vi-mode -set editing-mode vi +# set editing-mode vi + +set editing-mode emacs $if mode=vi set keymap vi-command @@ -30,3 +40,8 @@ $if mode=vi "\C-p": history-search-backward "\C-n": history-search-forward $endif + +$if mode=emacs + "\C-p": history-search-backward + "\C-n": history-search-forward +$endif diff --git a/.latexmkrc b/.latexmkrc new file mode 100644 index 0000000..953472a --- /dev/null +++ b/.latexmkrc @@ -0,0 +1,8 @@ +# -*-: mode perl -*- +# vi: set ft=perl : + +$pdflatex = 'lualatex -interaction=nonstopmode -file-line-error -shell-escape -synctex=1 %O %S'; +$bibtex = 'biber -u -U'; +$pdf_previewer = ''; +$pdf_mode = 1; + diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..9b478de --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +prefix=${HOME}/.npm-packages diff --git a/.pam_environment b/.pam_environment new file mode 100644 index 0000000..2e31e89 --- /dev/null +++ b/.pam_environment @@ -0,0 +1,2 @@ +SSH_AGENT_PID DEFAULT= +SSH_AUTH_SOCK DEFAULT="${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent.ssh" diff --git a/.stalonetrayrc b/.stalonetrayrc new file mode 100644 index 0000000..71eb56b --- /dev/null +++ b/.stalonetrayrc @@ -0,0 +1,19 @@ +# -*- mode: conf -*- +# vim: ft=config:tw=80:et:cms=#\ %s + +decorations none +transparent false +dockapp_mode none +fuzzy_edges 0 +geometry 8x1+825+0 +background "#1d1f21" +kludges force_icons_size +grow_gravity E +icon_gravity NE +icon_size 20 +sticky true +window_type dock +window_layer bottom +window_strut none +skip_taskbar true +sticky true diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..f88a3ca --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,62 @@ +# tmux.conf + +# bind prefix to C-a +unbind C-b +set -g prefix C-a +bind C-a send-prefix + +# split window in current dir +bind s split-window -v -c '#{pane_current_path}' +bind v split-window -h -c '#{pane_current_path}' + +bind S list-sessions + +# new window in current dir +bind c new-window -a -c '#{pane_current_path}' + +# toggle mouse +bind-key m run-shell "if [[ $(tmux show-options | grep 'mouse on') ]]; then export toggle=disabled; else export toggle=enabled; fi; tmux display-message \"mouse: \$toggle\"; tmux set-window-option mouse &> /dev/null" + +set -g default-terminal "tmux-256color" + +# display longer pane indicators +set -g display-panes-time 800 + +# renumber windows when one is closed +set -g renumber-windows on + +# start at 1 when assigning a pane index +set-window-option -g pane-base-index 1 + +# start at 1 when assigning a window index +set-option -g base-index 1 + +# use vi-style controls in copy mode +set-window-option -g mode-keys vi +set -g focus-events on + +set -g visual-activity on +set -g monitor-activity off + +set-option -g set-titles on +set-option -g set-titles-string '#S:#I.#P #W' + +# appearance +set -g status-right '#{prefix_highlight} | %a %Y-%m-%d %H:%M' + +# plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' + +set -g @plugin 'tmux-plugins/tmux-open' +set -g @plugin 'tmux-plugins/tmux-yank' +set -g @plugin 'tmux-plugins/tmux-copycat' + +set -g @plugin 'tmux-plugins/tmux-sidebar' +set -g @plugin 'tmux-plugins/tmux-pain-control' +set -g @plugin 'tmux-plugins/tmux-prefix-highlight' + +set -g @plugin 'seebi/tmux-colors-solarized' +set -g @colors-solarized 'dark' + +run '~/.tmux/plugins/tpm/tpm' diff --git a/.xmobarrc b/.xmobarrc old mode 100755 new mode 100644 index ce5435b..ba50b53 --- a/.xmobarrc +++ b/.xmobarrc @@ -1,12 +1,15 @@ -Config { font = "xft:Roboto Mono:size=10:medium:antialias=true" +-- -*- mode: haskell -*- +-- vi: set ft=haskell : + +Config { font = "xft:Iosevka:size=12:antialias=true" , additionalFonts = ["xft:FontAwesome-10"] - , bgColor = "#1d1f21" - , fgColor = "#c5c8c6" + , bgColor = "#1d1f21" + , fgColor = "#c5c8c6" , position = Top , border = NoBorder , commands = [ Run UnsafeStdinReader - , Run Date "%H:%M:%S - %y/%m/%d" "date" 10 + , Run Date "%F (%a) %T" "date" 10 , Run Battery [ "--template", "batt: " , "--Low", "10" , "--High", "80" @@ -21,10 +24,13 @@ Config { font = "xft:Roboto Mono:size=10:medium:antialias=true" , "-O" , "Charging" -- charged status , "-i" , "Charged"] 60 + -- , Run MPD ["-t", ": by <artist>"] 10 ] , sepChar = "%" , alignSep = "}{" , template = " %UnsafeStdinReader% }{ %battery% | %date% " } --- vim: ft=haskell + -- , Run MPD ["-t", + -- "<title> (<album>) <track>/<plength> <statei> [<flags>]", + -- "--", "-P", ">>", "-Z", "|", "-S", "><"] 10 diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs index 9b539ea..3c7fd67 100755 --- a/.xmonad/xmonad.hs +++ b/.xmonad/xmonad.hs @@ -1,73 +1,97 @@ --- xmonad.hs +{-# OPTIONS_GHC -fno-warn-missing-signatures -fno-warn-orphans #-} +{-# LANGUAGE TypeFamilies #-} -import XMonad hiding ( (|||) ) -import XMonad.Layout hiding ( (|||) ) +module Main (main) where + +import XMonad hiding ((|||)) +import XMonad.Layout hiding ((|||)) import XMonad.Operations --- Layout +-- layouts import XMonad.Layout.IM import XMonad.Layout.Gaps +import XMonad.Layout.Grid +import XMonad.Layout.ResizableTile +import XMonad.Layout.BinarySpacePartition +import XMonad.Layout.ThreeColumns +import XMonad.Layout.Fullscreen + import XMonad.Layout.Spacing import XMonad.Layout.Reflect +import XMonad.Layout.Renamed +import XMonad.Layout.ShowWName import XMonad.Layout.NoBorders -import XMonad.Layout.ResizableTile import XMonad.Layout.PerWorkspace -import XMonad.Layout.LayoutCombinators -import qualified XMonad.Layout.Renamed as R --- Hooks +import XMonad.Layout.LayoutCombinators +import XMonad.Layout.MultiToggle +import XMonad.Layout.MultiToggle.Instances + +-- hooks import XMonad.Hooks.DynamicLog +import XMonad.Hooks.ServerMode import XMonad.Hooks.DynamicBars import XMonad.Hooks.ManageDocks -import XMonad.Hooks.ManageHelpers -import XMonad.Hooks.EwmhDesktops -import XMonad.Hooks.ServerMode import XMonad.Hooks.UrgencyHook +import XMonad.Hooks.XPropManage +import XMonad.Hooks.ManageHelpers +import XMonad.Hooks.InsertPosition +import XMonad.Hooks.EwmhDesktops (ewmh) +import XMonad.Hooks.DynamicProperty --- Actions +-- actions +import XMonad.Actions.Submap import XMonad.Actions.CycleWS -import XMonad.Actions.RotSlaves +import XMonad.Actions.Promote import XMonad.Actions.Commands +import XMonad.Actions.TagWindows +import XMonad.Actions.RotSlaves +import XMonad.Actions.GridSelect import XMonad.Actions.PhysicalScreens import XMonad.Actions.DynamicWorkspaces -import XMonad.Actions.Commands -import qualified XMonad.Actions.FlexibleResize as FR +import XMonad.Actions.SwapWorkspaces +import XMonad.Actions.FindEmptyWorkspace +import XMonad.Actions.DynamicWorkspaceGroups +import XMonad.Actions.CopyWindow + +-- floating keys +import XMonad.Actions.FloatKeys import XMonad.Actions.FloatSnap --- import XMonad.Actions.CopyWindow --- import XMonad.Actions.Submap --- import XMonad.Actions.GridSelect --- import XMonad.Actions.CopyWindow --- import XMonad.Actions.WindowMenu +-- prompt +import XMonad.Prompt +import XMonad.Prompt.Pass +import XMonad.Prompt.Workspace +import XMonad.Prompt.RunOrRaise +import XMonad.Prompt.ConfirmPrompt --- Util +-- util import XMonad.Util.Run -import XMonad.Util.SpawnOnce import XMonad.Util.EZConfig import XMonad.Util.WorkspaceCompare +import XMonad.Util.Scratchpad import XMonad.Util.NamedScratchpad -import qualified XMonad.Util.ExtensibleState as XS - --- Prompt -import XMonad.Prompt -import XMonad.Prompt.Workspace - --- other -import qualified XMonad.StackSet as W -import qualified Data.Map as M - -import Data.Monoid -import Data.Ratio ((%)) +-- misc import System.IO import System.Exit +import System.Environment (getArgs) +import Control.Monad (when) + +import Data.List +import Data.Ratio ((%)) +import Data.Monoid + import Graphics.X11.Types +import Graphics.X11.Xinerama import Graphics.X11.ExtraTypes.XF86 -import qualified DBus as D -import qualified DBus.Client as D -import qualified Codec.Binary.UTF8.String as UTF8 +import qualified Data.Set as S +import qualified Data.Map as M +import qualified XMonad.StackSet as W +import qualified XMonad.Util.Timer as T +import qualified XMonad.Util.ExtensibleState as XS -- | The default number of workspaces (virtual screens) and their names. -- By default we use numeric strings, but any string may be used as a @@ -78,9 +102,8 @@ import qualified Codec.Binary.UTF8.String as UTF8 -- -- > workspaces = ["web", "irc", "code" ] ++ map show [4..9] -- --- workspaces' = map show [1 .. 9 :: Int] workspaces' :: [WorkspaceId] -workspaces' = map show [ 1..9 :: Int] +workspaces' = map show [ 1..9 :: Int ] -- | modMask lets you specify which modkey you want to use. The default -- is mod1Mask ("left alt"). You may also consider using mod3Mask @@ -93,7 +116,7 @@ modMask' = mod4Mask -- | Width of the window border in pixels. -- borderWidth' :: Dimension -borderWidth' = 1 +borderWidth' = 2 -- | Border colors for unfocused and focused windows, respectively. -- @@ -101,19 +124,6 @@ normalBorderColor', focusedBorderColor' :: String normalBorderColor' = "#1d1f21" focusedBorderColor' = "#969896" --- | The preferred terminal program, which is used in a binding below and by --- certain contrib modules. -terminal' :: String -terminal' = "/usr/bin/termite" - --- | Whether focus follows the mouse pointer. -focusFollowsMouse' :: Bool -focusFollowsMouse' = False - --- | Whether a mouse click select the focus or is just passed to the window -clickJustFocuses' :: Bool -clickJustFocuses' = True - ------------------------------------------------------------------------ -- Window rules @@ -125,35 +135,51 @@ clickJustFocuses' = True -- To find the property name associated with a program, use -- xprop | grep WM_CLASS -- and click on the client you're interested in. --- -- -avoidMaster :: W.StackSet i l a s sd -> W.StackSet i l a s sd -avoidMaster = W.modify' $ modifyFunc - where modifyFunc c@(W.Stack t [] (r:rs)) = W.Stack t [r] rs - modifyFunc c@_ = c - +-- manageHook' :: ManageHook -manageHook' = manageHooks' - <+> namedScratchpadManageHook scratchpads - <+> manageDocks - <+> transience' +manageHook' = composeAll + [ appName =? "discord" --> doShift (workspaces' !! 8) + , appName =? "google-chrome" --> doShift (workspaces' !! 0) + , appName =? "telegram-desktop" --> doShift (workspaces' !! 8) -manageHooks' :: ManageHook -manageHooks' = composeAll . concat $ - [ [ className =? c --> doShift (workspaces' !! 0) | c <- browsers ] - , [ className =? c --> doShift (workspaces' !! 7) | c <- chatClients ] - , [ className =? c --> doCenterFloat | c <- scratchpadFloats ] - , [ className =? c --> doCenterFloat | c <- centerFloats ] - , [ windowRole =? d --> doCenterFloat | d <- dialogs ] - , [ fmap not isDialog --> doF avoidMaster - , isDialog --> doCenterFloat - , isFullscreen --> doFullFloat - ] ] - where browsers = [ "Google-chrome" ] - chatClients = [ "TelegramDesktop", "discord", "Slack" ] - centerFloats = [ "Arandr", "VirtualBox" ] - dialogs = [ "GtkFileChooserDialog" ] - scratchpadFloats = [ "Zeal" ] - windowRole = stringProperty "WM_WINDOW_ROLE" + -- make these windows float around the center of the screen + , appName =? "imv" --> doFullFloat + , appName =? "zeal" --> doCenterFloat + , appName =? "arandr" --> doCenterFloat + , appName =? "synergy" --> doCenterFloat + , appName =? "pinentry" --> doCenterFloat + , appName =? "nitrogen" --> doCenterFloat + , appName =? "keepassxc" --> doCenterFloat + , appName =? "pavucontrol" --> doCenterFloat + , appName =? "gcr-prompter" --> doCenterFloat + , appName =? "nm-connection-editor" --> doCenterFloat + + , className =? "mpv" --> doFullFloat + + -- dialog windows + , windowRole =? "Preferences" --> doCenterFloat + , windowRole =? "GtkFileChooserDialog" --> doCenterFloat + + -- misc hooks + , isDialog --> doCenterFloat + , isFullscreen --> doFullFloat + , className =? "Dunst" --> doIgnore + , className =? "stalonetray" --> doIgnore + , resource =? "desktop_window" --> doIgnore + + -- avoid the master pane + , fmap not isDialog --> doF avoidMaster + , namedScratchpadManageHook namedScratchpads' + , scratchpadHook' + ] + +avoidMaster :: W.StackSet i l a s sd -> W.StackSet i l a s sd +avoidMaster = W.modify' $ \c -> case c of + W.Stack t [] (r:rs) -> W.Stack t [r] rs + otherwise -> c + +windowRole :: XMonad.Query String +windowRole = stringProperty "WM_WINDOW_ROLE" ------------------------------------------------------------------------ -- Logging @@ -168,42 +194,54 @@ manageHooks' = composeAll . concat $ -- See the 'DynamicLog' extension for examples. -- --- make a workspace clickable +logHook' :: X () +logHook' = multiPP focusedPP unfocusedPP + +-- | Make a workspace clickable clickable :: [Char] -> [Char] -clickable w = "<action=`xdotool key super+" ++ w ++ "`>" ++ w ++ "</action>" +clickable w = "<action=$(xdotool key super+" ++ w ++ ")>" ++ w ++ "</action>" +-- | Command to launch Xmobar with xmobarCommand :: Show a => a -> [Char] -xmobarCommand s = "/usr/bin/xmobar ~/.xmonad/xmobarrc --screen=" ++ show s +xmobarCommand s = "/usr/bin/xmobar $HOME/.xmobarrc --screen=" ++ show s +-- | Create a satusbar statusBarCreator :: DynamicStatusBar -statusBarCreator (S sid) = do +statusBarCreator (S sid) = do spawnPipe . xmobarCommand $ sid +-- | Remove a statusbar statusBarDestroyer :: DynamicStatusBarCleanup statusBarDestroyer = do return () -focusedStatusBarPP :: PP -focusedStatusBarPP = def - { ppCurrent = xmobarColor "#81A2BE" "" . wrap "[" "]" . clickable - , ppHidden = xmobarColor "#707880" "" . clickable - , ppHiddenNoWindows = wrap "" "" . clickable - , ppTitle = shorten 40 - , ppVisible = wrap "(" ")" . clickable - , ppUrgent = xmobarColor "#1d1f21" "#cc6666" - , ppWsSep = " " - , ppSep = " :: " - , ppOrder = \(ws:l:_:_) -> [ws, l] +-- | How workspaces should be sorted on the statusbar +workspaceSort :: X WorkspaceSort +workspaceSort = (. namedScratchpadFilterOutWorkspace) <$> getSortByIndex + +-- | Focused screen +focusedPP :: PP +focusedPP = def + { ppCurrent = xmobarColor "#81A2BE" "" . clickable . wrap "[" "]" + , ppVisible = xmobarColor "#969896" "" . clickable . wrap "(" ")" + , ppHidden = xmobarColor "#5F819D" "" . clickable + , ppUrgent = xmobarColor "#cc6666" "" . clickable . wrap " " " " + , ppHiddenNoWindows = xmobarColor "#969896" "" . clickable + , ppSort = workspaceSort + , ppTitle = shorten 32 } -unfocusedStatusBarPP :: PP -unfocusedStatusBarPP = def - { ppCurrent = wrap "[" "]" - , ppWsSep = " " +-- | Unfocused screen +unfocusedPP :: PP +unfocusedPP = def + { ppCurrent = xmobarColor "#81A2BE" "" . clickable . wrap "[" "]" + , ppVisible = xmobarColor "#969896" "" . clickable . wrap "(" ")" + , ppHidden = xmobarColor "#5F819D" "" . clickable + , ppUrgent = xmobarColor "#cc6666" "" . clickable . wrap " " " " + , ppHiddenNoWindows = xmobarColor "#969896" "" . clickable + , ppSort = workspaceSort + , ppTitle = shorten 32 } -logHook' = do - multiPP focusedStatusBarPP unfocusedStatusBarPP - ------------------------------------------------------------------------ -- Event handling @@ -211,10 +249,8 @@ logHook' = do -- return (All True) if the default handler is to be run afterwards. -- To combine event hooks, use mappend or mconcat from Data.Monoid. handleEventHook' :: Event -> X All -handleEventHook' = +handleEventHook' = do serverModeEventHookCmd' defaultCommands' - <+> fullscreenEventHook - <+> docksEventHook <+> dynStatusBarEventHook statusBarCreator statusBarDestroyer -- | Perform an arbitrary action at xmonad startup. @@ -222,9 +258,6 @@ startupHook' :: X () startupHook' = do dynStatusBarStartup statusBarCreator statusBarDestroyer - -- run startup script - spawnOnce "/home/alex/bin/xmonad-startup.sh" - ------------------------------------------------------------------------ -- Extensible layouts -- @@ -236,164 +269,289 @@ startupHook' = do -- | The available layouts. Note that each layout is separated by |||, which -- denotes layout choice. - -layoutHook' = avoidStruts . smartBorders - . spacing 10 . gaps [(U, 15), (D, 20), (L, 20), (R, 20)] - $ onWorkspace(workspaces' !! 7) telegramLayout +layoutHook' = avoidStruts + $ onWorkspace (workspaces' !! 8) telegram $ layouts where - layouts = resizable - ||| Mirror resizable - ||| noBorders Full + -- layout definitions + layouts' = resizable + ||| grid + ||| threecol + ||| threemid - -- resizable Tall layout - resizable = R.renamed [R.Replace "Tall"] $ ResizableTall nmaster delta ratio [] + -- add toggle modifiers + layouts = mirror' $ borders' $ fullscreen' $ layouts' - -- The default number of windows in the master pane - nmaster = 1 + -- toggle modifiers + mirror' = mkToggle (single MIRROR) + borders' = mkToggle (single NOBORDERS) + fullscreen' = mkToggle (single NBFULL) - -- Default proportion of screen occupied by master pane - ratio = toRational (2/(1 + sqrt 5 :: Double)) + -- rename a layout + named n = renamed [Replace n] - -- Percent of screen to increment by when resizing panes - delta = 3/100 + delta = (3%100) + ratio = toRational (2/(1 + sqrt 5 :: Double)) - -- use 35% of the screen for telegram - telegramLayout = R.renamed [R.Replace "IM" ] $ reflectHoriz $ withIM (35%100) (ClassName "TelegramDesktop") ( reflectHoriz $ resizable ||| Mirror resizable) + -- spacing and gaps + spacing' = spacing 5 + gaps' = gaps [(U, 10), (D, 10), (L, 10), (R, 10)] + + -- ResizableTall layout + resizable = named "Tall" + $ spacing' + $ gaps' + $ ResizableTall 1 delta ratio [] + + -- ThreeCol layout + threecol = named "ThreeCol" + $ spacing' + $ gaps' + $ ThreeCol 1 (3%100) (1%2) + + -- ThreeColMid layout + threemid = named "ThreeColMid" + $ spacing' + $ gaps' + $ ThreeColMid 1 (3%100) (1%2) + + -- Grid layout + grid = named "Grid" + $ spacing' + $ gaps' + $ Grid + + -- layout for telegram + telegramMatch = ClassName "TelegramDesktop" + telegram' = withIM (35%100) telegramMatch Grid + telegram = named "Grid" + $ reflectHoriz + $ spacing' + $ gaps' + $ telegram' + +------------------------------------------------------------------------ +-- Key bindings: + +-- | The preferred terminal program, which is used in a binding below and by +-- certain contrib modules. +terminal' :: String +terminal' = "/usr/bin/termite" + +-- | Whether focus follows the mouse pointer. +focusFollowsMouse' :: Bool +focusFollowsMouse' = False + +-- | Whether a mouse click select the focus or is just passed to the window +clickJustFocuses' :: Bool +clickJustFocuses' = True -- | 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 = modm}) = M.fromList $ - +-- keys' :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ()) -keys' conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ - [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf) -- %! Launch terminal - , ((modm, xK_p ), spawn "dmenu_run") -- %! Launch dmenu - , ((modm .|. shiftMask, xK_p ), spawn "gmrun") -- %! Launch gmrun - , ((modm .|. shiftMask, xK_c ), kill) -- %! Close the focused window +keys' = \c -> keybindings' c `M.union` mkKeymap c keymap' - , ((modm, xK_space ), sendMessage NextLayout) -- %! Rotate through the available layout algorithms - , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf) -- %! Reset the layouts on the current workspace to default - - , ((modm, xK_n ), refresh) -- %! Resize viewed windows to the correct size - - -- move focus up or down the window stack - , ((modm, xK_Tab ), windows W.focusDown) -- %! Move focus to the next window - , ((modm .|. shiftMask, xK_Tab ), windows W.focusUp ) -- %! Move focus to the previous window - , ((modm, xK_j ), windows W.focusDown) -- %! Move focus to the next window - , ((modm, xK_k ), windows W.focusUp ) -- %! Move focus to the previous window - , ((modm, xK_m ), windows W.focusMaster ) -- %! Move focus to the master window - - -- modifying the window order - , ((modm, xK_Return), windows W.swapMaster) -- %! Swap the focused window and the master window - , ((modm .|. shiftMask, xK_j ), windows W.swapDown ) -- %! Swap the focused window with the next window - , ((modm .|. shiftMask, xK_k ), windows W.swapUp ) -- %! Swap the focused window with the previous window - - -- resizing the master/slave ratio - , ((modm, xK_h ), sendMessage Shrink) -- %! Shrink the master area - , ((modm, xK_l ), sendMessage Expand) -- %! Expand the master area - - -- floating layer support - , ((modm, xK_t ), withFocused $ windows . W.sink) -- %! Push window back into tiling - - -- increase or decrease number of windows in the master area - , ((modm , xK_comma ), sendMessage (IncMasterN 1)) -- %! Increment the number of windows in the master area - , ((modm , xK_period), sendMessage (IncMasterN (-1))) -- %! Deincrement the number of windows in the master area +-- toggle floating for current window +toggleFloat w = windows (\s -> if M.member w (W.floating s) + then W.sink w s + else (W.float w (W.RationalRect (1%5) (1%5) (3%5) (3%5)) s)) +keymap' :: [(String, X ())] +keymap' = + [ ("M-<Return>", promote) -- quit, or restart - , ((modm .|. shiftMask, xK_q ), io (exitWith ExitSuccess)) -- %! Quit xmonad - , ((modm , xK_q ), spawn "if type xmonad; then xmonad --recompile && xmonad --restart; else xmessage xmonad not in \\$PATH: \"$PATH\"; fi") -- %! Restart xmonad<Paste> + , ("M-S-q", confirmPrompt promptConfig "Quit XMonad" $ io (exitWith ExitSuccess)) - , ((0, xF86XK_AudioRaiseVolume), spawn "pactl set-sink-volume 1 +2%") - , ((0, xF86XK_AudioLowerVolume), spawn "pactl set-sink-volume 1 -2%") - -- media keys - , ((0, xF86XK_AudioMute), spawn "pactl set-sink-mute 1 toggle") - , ((0, xF86XK_AudioNext), spawn "mpc -q next") - , ((0, xF86XK_AudioPrev), spawn "mpc -q prev") - , ((0, xF86XK_AudioPlay), spawn "mpc toggle") - , ((0, xF86XK_AudioStop), spawn "mpc stop") - -- - -- backlight - , ((0, xF86XK_MonBrightnessUp), spawn "light -A 1.5%") - , ((0, xF86XK_MonBrightnessDown), spawn "light -U 1.5%") + -- volume controls + , ("<XF86AudioMute>", spawn "pactl set-sink-mute 1 toggle") + , ("<XF86AudioRaiseVolume>", spawn "pactl set-sink-volume 1 +2%") + , ("<XF86AudioLowerVolume>", spawn "pactl set-sink-volume 1 -2%") - -- toggle struts 'n gaps - , ((modm, xK_b), sendMessage $ ToggleStruts) - , ((modm, xK_u), sendMessage $ ToggleGaps) + , ("<XF86AudioStop>", spawn "mpc stop") + , ("<XF86AudioNext>", spawn "mpc next") + , ("<XF86AudioPrev>", spawn "mpc prev") + , ("<XF86AudioPlay>", spawn "mpc toggle") + + -- backlight controls + , ("<XF86MonBrightnessUp>", spawn "light -A 1.5%") + , ("<XF86MonBrightnessDown>", spawn "light -U 1.5%") + + -- launch a terminal (urxvt) + , ("C-M-<Return>", spawn "urxvt") -- lock the screen - , ((controlMask .|. mod1Mask, xK_l), spawn "/home/alex/bin/lock") - - -- resize windows vertically - , ((modm .|. shiftMask, xK_l), sendMessage MirrorShrink) - , ((modm .|. shiftMask, xK_h), sendMessage MirrorExpand) - - -- rotate workspaces - , ((modm .|. shiftMask, xK_bracketleft ), rotAllUp) - , ((modm .|. shiftMask, xK_bracketright), rotAllDown) + , ("M-C-l", spawn "betterlockscreen -l") -- move between workspaces - , ((modm, xK_bracketleft ), moveTo Prev (WSIs notNSP)) - , ((modm, xK_bracketright ), moveTo Next (WSIs notNSP)) + , ("M-]", moveTo Next (WSIs notNSP')) + , ("M-[", moveTo Prev (WSIs notNSP')) - -- move between screens - , ((modm, xK_Right), nextScreen) - , ((modm, xK_Left), prevScreen) + , ("M-,", sendMessage (IncMasterN (-1))) + , ("M-.", sendMessage (IncMasterN 1)) - -- shift windows between screens - , ((modm .|. shiftMask, xK_Right), shiftNextScreen) - , ((modm .|. shiftMask, xK_Left), shiftPrevScreen) + , ("M-M1-h", sendMessage MirrorExpand) + , ("M-M1-l", sendMessage MirrorShrink) - , ((mod1Mask .|. controlMask .|. shiftMask, xK_Right), shiftToNext >> nextWS) - , ((mod1Mask .|. controlMask .|. shiftMask, xK_Left), shiftToPrev >> prevWS) + , ("M-<Up>", sendMessage MirrorExpand) + , ("M-<Down>", sendMessage MirrorShrink) + , ("M-<Left>", sendMessage Shrink) + , ("M-<Right>", sendMessage Expand) + -- toggles + , ("M-t f", sendMessage $ Toggle NBFULL) + , ("M-t m", sendMessage $ Toggle MIRROR) + , ("M-t b", sendMessage $ Toggle NOBORDERS) + , ("M-t g", sendMessage ToggleGaps) + , ("M-t s", sendMessage ToggleStruts) - -- swap current workspace with the previously displayed workspace - , ((modm, xK_z), namedScratchpadAction scratchpads "zeal") + -- sink the current floating window + , ("M-s t", withFocused $ windows . W.sink) - , ((modm .|. shiftMask, xK_m ), workspacePrompt def (windows . W.shift)) + -- float the current tiled window + , ("M-s f", withFocused toggleFloat) - , ((modm, xK_p), spawn "rofi -show run") - , ((modm .|. controlMask, xK_x), spawn "/home/alex/bin/lock") + -- scratchpads + , ("M-s v", namedScratchpadAction namedScratchpads' "pavucontrol") + , ("M-s k", namedScratchpadAction namedScratchpads' "keepassxc") + , ("M-s m", namedScratchpadAction namedScratchpads' "arandr") + , ("M-m", namedScratchpadAction namedScratchpads' "emacs") + + -- launchers + , ("M-p", spawn "rofi -show run") + , ("M-o", spawn "rofi -show combi") ] - ++ - [((mod4Mask .|. mask, key), f sc) - | (key, sc) <- zip [xK_w, xK_e] [0..] - , (f, mask) <- [(viewScreen, 0), (sendToScreen, shiftMask)]] - ++ + +-- default keys +keybindings' :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ()) +keybindings' conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ + [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf) + , ((modm .|. shiftMask, xK_c ), kill) + + , ((modm, xK_q), spawn "if type xmonad; then xmonad --recompile && xmonad --restart; else xmessage xmonad not in \\$PATH: \"$PATH\"; fi") -- %! Restart xmonad + , ((modm, xK_space ), sendMessage NextLayout) + , ((modm .|. shiftMask, xK_space), setLayout $ XMonad.layoutHook conf) + + -- make focused window always visible + , ((modm, xK_v), windows copyToAll) + + -- toggle window state back + , ((modm .|. shiftMask, xK_v), killAllOtherCopies) + + -- move focus up or down the window stack + , ((modm, xK_j), windows W.focusDown) + , ((modm, xK_k), windows W.focusUp) + + -- modifying the window order + , ((modm .|. shiftMask, xK_j), windows W.swapDown) + , ((modm .|. shiftMask, xK_k), windows W.swapUp) + + -- resizing the master/slave ratio + , ((modm, xK_h), sendMessage Shrink) + , ((modm, xK_l), sendMessage Expand) + ] + ++ + [((m .|. mod4Mask, 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)]] + ++ zip (zip (repeat (mod4Mask)) [xK_1..xK_9]) (map (withNthWorkspace W.greedyView) [0..]) - ++ + ++ zip (zip (repeat (mod4Mask .|. shiftMask)) [xK_1..xK_9]) (map (withNthWorkspace W.shift) [0..]) + ++ + [ ((modm .|. controlMask, k), windows $ swapWithCurrent i) | (i, k) <- zip workspaces' [xK_1 ..]] - -mouseBindings' (XConfig {XMonad.modMask = modm}) = M.fromList $ - [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w >> afterDrag (snapMagicMove (Just 50) (Just 50) w ))) - , ((modm, button2), (\w -> focus w >> windows W.swapMaster >> afterDrag (snapMagicResize [L,R,U,D] (Just 50) (Just 50) w ))) - , ((modm, button3), (\w -> focus w >> FR.mouseResizeWindow w >> afterDrag (snapMagicResize [L,R,U,D] (Just 50) (Just 50) w ))) +-- | Mouse bindings: default actions bound to mouse events +mouseBindings' :: XConfig Layout -> M.Map (KeyMask, Button) (Window -> X ()) +mouseBindings' (XConfig {XMonad.modMask = modm}) = M.fromList + [ ((modm, button1), \w -> focus w >> mouseMoveWindow w >> windows W.shiftMaster) + , ((modm, button2), windows . (W.shiftMaster .) . W.focusWindow) + , ((modm, button3), \w -> focus w >> mouseResizeWindow w >> windows W.shiftMaster) ] ---named scratchpads -scratchpads = [ NS "zeal" "zeal" (className =? "Zeal") defaultFloating ] --- Filter out the NSP workspace -notNSP = (return $ ("NSP" /=) . W.tag) :: X (WindowSpace -> Bool) - --- custom command list +-- | List of commands for ServerMode +-- TODO: add more commands to this to make xmonadctl a little more useful? defaultCommands' :: X [(String, X ())] defaultCommands' = do - return $ otherCommands - where - otherCommands = - [ - ("next-ws", moveTo Next (WSIs notNSP)) - , ("prev-ws", moveTo Prev (WSIs notNSP)) - ] + return $ + [ ("next-ws", moveTo Next (WSIs notNSP')) + , ("prev-ws", moveTo Prev (WSIs notNSP')) + -- grid commands + , ("grid-selected-focus", goToSelected $ gridSelectConfig colorizer') + , ("grid-selected-bring", bringSelected $ gridSelectConfig colorizer') + ] + +-- | Named scratchpads +namedScratchpads' :: [NamedScratchpad] +namedScratchpads' = + [ NS "keepassxc" "keepassxc" (appName =? "keepassxc") floating' + , NS "pavucontrol" "pavucontrol" (appName =? "pavucontrol") floating' + , NS "arandr" "arandr" (appName =? "arandr") floating' + , NS "emacs" "emacs" (appName =? "emacs") nonFloating + ] + where floating' = customFloating $ W.RationalRect 0.2 0.2 0.6 0.6 + +-- | Hook for managing scratchpads +scratchpadHook' :: ManageHook +scratchpadHook' = scratchpadManageHook $ W.RationalRect l t w h + where + h = 0.25 -- terminal height + w = 1 -- terminal width + t = 0 + l = 1 - w + +-- | Custom urgency hook +urgencyHook' = withUrgencyHook NoUrgencyHook + +-- | Check if a workspace is the named scratchpad workspace +notNSP' :: X (WindowSpace -> Bool) +notNSP' = (return $ ("NSP" /=) . W.tag) :: X (WindowSpace -> Bool) + +-- | Add a tag to a window +addTagHook :: String -> ManageHook +addTagHook tag = do + w <- ask + liftX $ addTag tag w + idHook + +-- | GridSelect colorizer +colorizer' :: Window -> Bool -> X (String, String) +colorizer' = colorRangeFromClassName + (0x00,0x00,0x00) -- lowest inactive bg + (0x1C,0x1C,0x1C) -- highest inactive bg + (0x44,0xAA,0xCC) -- active bg + (0xBB,0xBB,0xBB) -- inactive fg + (0x00,0x00,0x00) -- active fg + +-- | GridSelect configuration +gridSelectConfig :: t -> GSConfig Window +gridSelectConfig colorizer = (buildDefaultGSConfig colorizer') + { gs_font = "xft:Iosevka:size=10:style=regular:antialias=true" + , gs_cellpadding = 10 + , gs_cellheight = 50 + , gs_cellwidth = 200 + } + +-- | Prompt configuration +promptConfig :: XPConfig +promptConfig = def + { font = "xft:Iosevka:size=12:style=regular:antialias=true" + , position = CenteredAt (1%2) (1%2) + , historyFilter = deleteConsecutive + , historySize = 256 + , bgColor = "#1d1f21" + , fgColor = "#c5c8c6" + , height = 32 + , showCompletionOnTab = True + , maxComplRows = Just 8 + , promptBorderWidth = 4 + , changeModeKey = xK_grave + } + +-- | XMonad main :: IO () main = do - - xmonad $ withUrgencyHook NoUrgencyHook $ ewmh $ def + xmonad $ fullscreenSupport $ urgencyHook' $ docks $ ewmh $ def { terminal = terminal' , modMask = modMask' , borderWidth = borderWidth' @@ -403,10 +561,10 @@ main = do , clickJustFocuses = clickJustFocuses' , workspaces = workspaces' , layoutHook = layoutHook' - , logHook = logHook' , manageHook = manageHook' , handleEventHook = handleEventHook' , startupHook = startupHook' , keys = keys' , mouseBindings = mouseBindings' - } + , logHook = logHook' + } diff --git a/.xsession b/.xsession deleted file mode 100755 index a396f05..0000000 --- a/.xsession +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env sh -# TODO: rewrite this as a series of bash scripts that the various -# window managers I have installed execute upon startup so that they -# can each have different options. - -# load Xresources -[[ -f ~/.Xresources ]] && xrdb ~/.Xresources - -# notifications daemon -dunst & - -# load wallpapers -nitrogen --restore diff --git a/.zshrc b/.zshrc index 73b3837..4cbf69e 100644 --- a/.zshrc +++ b/.zshrc @@ -1,283 +1,208 @@ -# dotfiles location -export DOTFILES=~/.dotfiles +# ~/.zshrc -# locale options -export LANG=en_US.UTF-8 -export LC_CTYPE="en_US.UTF-8" +source $HOME/.zplug/init.zsh -# stops lag in vim +zplug themes/mh, from:oh-my-zsh, as:theme +zplug plugins/git, from:oh-my-zsh + +zplug zsh-users/zsh-completions +zplug zsh-users/zsh-history-substring-search +zplug zsh-users/zsh-syntax-highlighting, defer:2 + +zplug load + +ttyctl -f + +setopt PROMPT_SUBST +setopt auto_pushd +setopt pushd_ignore_dups +setopt long_list_jobs +setopt interactivecomments +setopt extended_glob +setopt equals +setopt complete_aliases +setopt multios +setopt autocd + +setopt append_history +setopt extended_history +setopt hist_expire_dups_first +setopt hist_ignore_dups +setopt hist_ignore_space +setopt hist_verify +setopt inc_append_history +setopt share_history + +# completion +zmodload -i zsh/complist + +setopt auto_menu +setopt complete_in_word +setopt always_to_end + +zstyle ":completion:*" menu select=2 +bindkey -M menuselect '^O' accept-and-infer-next-history +zstyle ':completion:*:*:*:*:*' menu select + +zstyle ':completion:*' rehash true +zstyle ':completion:*' use-cache true +zstyle ':completion:*' insert-tab pending + +# fuzzy completion +zstyle ':completion:*' completer _complete _match _approximate +zstyle ':completion:*:match:*' original only +zstyle ':completion:*approximate:*' max-errors 1 numeric + +# use a cache to speed things up +zstyle ':completion::complete:*' use-cache 1 +zstyle ':completion::complete:*' cache-path ~/.zsh/cache + +zstyle ':completion:*:default' group-name '' +zstyle ':completion:*:manuals' separate-sections true +zstyle ':completion:*:manuals.(^1*)' insert-sections true +zstyle ':completion:*' menu select +zstyle ':completion:*' verbose yes + +zstyle -e ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX + $#SUFFIX) / 3 )) )' +zstyle ':completion::approximate*:*' prefix-needed false + +zstyle ':completion:*:*:kill:*' menu yes select +zstyle ':completion:*:kill:*' force-list always + +# bindings +bindkey -v + +# C-x C-e to edit current line in $EDITOR +autoload -z edit-command-line +zle -N edit-command-line +bindkey "^X^E" edit-command-line + +bindkey -M viins '^W' backward-kill-word +bindkey -M viins '^H' backward-delete-char + +bindkey '^P' history-substring-search-up +bindkey '^N' history-substring-search-down + +bindkey -M vicmd 'k' history-substring-search-up +bindkey -M vicmd 'j' history-substring-search-down + +bindkey -M vicmd '/' history-incremental-pattern-search-backward +bindkey -M vicmd '?' history-incremental-pattern-search-forward + +# aliases + +# always sort directories first +alias ls='ls --color=auto --group-directories-first' +alias tree='tree --dirsfirst' +alias diff='diff --color=always' + +# short forms with useful flags +alias l='ls -h -S -I ".git"' +alias t='tree -I ".git"' + +# ps with cgroups +alias psc='ps xawf -eo pid,user,cgroup,args' + +# misc + +# commands/functions +ranger-cd () { + tempfile="$(mktemp -t tmp.XXXXXX)" + /usr/bin/ranger --choosedir="$tempfile" "${@:-$(pwd)}" + test -f "$tempfile" && + if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then + cd -- "$(cat "$tempfile")" + fi + rm -f -- "$tempfile" +} + +fkill () { + pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}') + + if [ "x$pid" != "x" ] + then + kill -${1:-9} $pid + fi +} + +fuck () { + TF_PREVIOUS=$(fc -ln 1 | tail -n 1); + TF_CMD=$( + TF_ALIAS=fuck + TF_SHELL_ALIAS=$(alias) + PYTHONIOENCODING=utf-8 + thefuck $TF_PREVIOUS THEFUCK_ARGUMENT_PLACEHOLDER $* + ) && eval $TF_CMD + test -n "$TF_CMD" && print -s $TF_CMD +} + + +# termite ctrl+shift+t support +if [[ $TERM == xterm-termite ]] ; then + . /etc/profile.d/vte.sh + __vte_osc7 +fi + +export NPM_PACKAGES="${HOME}/.npm-packages" +export GOPATH="${HOME}/src/go" +typeset -U path + +path=( + $HOME/bin + $HOME/.zplug/bin + $HOME/.cargo/bin + $NPM_PACKAGES/bin + $path[@] +) + +fpath=( + $HOME/.zsh/zfunc + $fpath +) + +# pager +export PAGER=less +export LESS='-R -f -X -i -P ?f%f:(stdin). ?lb%lb?L/%L.. [?eEOF:?pb%pb\%..]' +export LESSCHARSET='utf-8' +export MANPAGER="/usr/bin/nvim -c 'set ft=man' -" + +# history +export HISTFILE=~/.zsh_history +export HISTSIZE=10000 +export SAVEHIST=100000 +export LISTMAX=100 + +export DIRSTACKSIZE=20 + +# disable history in root +if [[ $UID == 0 ]] ; then + unset HISTFILE + export SAVEHIST=0 +fi + +# system editor +export EDITOR=/usr/bin/nvim + +# fix tmux lag export KEYTIMEOUT=1 -# set $TERM -export TERM=screen-256color - -# command for fzf to use -export FZF_DEFAULT_COMMAND='(git ls-tree -r --name-only HEAD || ag -g "") 2> /dev/null' - -# change the mode indication that vim-mode uses -export MODE_INDICATOR="%{$fg_bold[yellow]%} [% NORMAL]% %{$reset_color%}" - -# make ~/bin most preferred in PATH -export PATH="$HOME/bin:$PATH" - -# --- - -# get the name of the branch we are on -function git_prompt_info() { - if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then - ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ - ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 - echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" - fi -} - - -# Checks if working tree is dirty -parse_git_dirty() { - local STATUS='' - local FLAGS - FLAGS=('--porcelain') - if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then - if [[ $POST_1_7_2_GIT -gt 0 ]]; then - FLAGS+='--ignore-submodules=dirty' - fi - if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then - FLAGS+='--untracked-files=no' - fi - STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1) - fi - if [[ -n $STATUS ]]; then - echo "$ZSH_THEME_GIT_PROMPT_DIRTY" - else - echo "$ZSH_THEME_GIT_PROMPT_CLEAN" - fi -} - -# get the difference between the local and remote branches -git_remote_status() { - remote=${$(command git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/} - if [[ -n ${remote} ]] ; then - ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l) - behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l) - - if [ $ahead -eq 0 ] && [ $behind -eq 0 ] - then - git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE" - elif [ $ahead -gt 0 ] && [ $behind -eq 0 ] - then - git_remote_status="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE" - git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}" - elif [ $behind -gt 0 ] && [ $ahead -eq 0 ] - then - git_remote_status="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE" - git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}" - elif [ $ahead -gt 0 ] && [ $behind -gt 0 ] - then - git_remote_status="$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE" - git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}" - fi - - if [ $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ] - then - git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX" - fi - - echo $git_remote_status - fi -} - -# Gets the number of commits ahead from remote -function git_commits_ahead() { - if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then - COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ') - echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$COMMITS$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX" - fi -} - -# Outputs if current branch is ahead of remote -function git_prompt_ahead() { - if [[ -n "$(command git rev-list origin/$(current_branch)..HEAD 2> /dev/null)" ]]; then - echo "$ZSH_THEME_GIT_PROMPT_AHEAD" - fi -} - -# Outputs if current branch is behind remote -function git_prompt_behind() { - if [[ -n "$(command git rev-list HEAD..origin/$(current_branch) 2> /dev/null)" ]]; then - echo "$ZSH_THEME_GIT_PROMPT_BEHIND" - fi -} - -# Outputs if current branch exists on remote or not -function git_prompt_remote() { - if [[ -n "$(command git show-ref origin/$(current_branch) 2> /dev/null)" ]]; then - echo "$ZSH_THEME_GIT_PROMPT_REMOTE_EXISTS" - else - echo "$ZSH_THEME_GIT_PROMPT_REMOTE_MISSING" - fi -} - -# Formats prompt string for current git commit short SHA -function git_prompt_short_sha() { - SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" -} - -# Formats prompt string for current git commit long SHA -function git_prompt_long_sha() { - SHA=$(command git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" -} - -# Get the status of the working tree -git_prompt_status() { - INDEX=$(command git status --porcelain -b 2> /dev/null) - STATUS="" - if $(echo "$INDEX" | command grep -E '^\?\? ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" - fi - if $(echo "$INDEX" | grep '^A ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" - elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" - fi - if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" - elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" - elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" - fi - if $(echo "$INDEX" | grep '^R ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS" - fi - if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" - elif $(echo "$INDEX" | grep '^D ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" - elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" - fi - if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then - STATUS="$ZSH_THEME_GIT_PROMPT_STASHED$STATUS" - fi - if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" - fi - if $(echo "$INDEX" | grep '^## .*ahead' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS" - fi - if $(echo "$INDEX" | grep '^## .*behind' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS" - fi - if $(echo "$INDEX" | grep '^## .*diverged' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS" - fi - echo $STATUS -} - -#compare the provided version of git to the version installed and on path -#prints 1 if input version <= installed version -#prints -1 otherwise -function git_compare_version() { - local INPUT_GIT_VERSION=$1; - local INSTALLED_GIT_VERSION - INPUT_GIT_VERSION=(${(s/./)INPUT_GIT_VERSION}); - INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null)); - INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]}); - - for i in {1..3}; do - if [[ $INSTALLED_GIT_VERSION[$i] -gt $INPUT_GIT_VERSION[$i] ]]; then - echo 1 - return 0 - fi - if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then - echo -1 - return 0 - fi - done - echo 0 -} - -#this is unlikely to change so make it all statically assigned -POST_1_7_2_GIT=$(git_compare_version "1.7.2") -#clean up the namespace slightly by removing the checker function -unset -f git_compare_version - -# --- - -# ls colors -autoload -U colors && colors -export LSCOLORS="Gxfxcxdxbxegedabagacad" - -# Enable ls colors -if [ "$DISABLE_LS_COLORS" != "true" ] -then - # Find the option for using colors in ls, depending on the version: Linux or BSD - if [[ "$(uname -s)" == "NetBSD" ]]; then - # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors); - # otherwise, leave ls as is, because NetBSD's ls doesn't support -G - gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty' - elif [[ "$(uname -s)" == "OpenBSD" ]]; then - # On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base, - # with color and multibyte support) are available from ports. "colorls" - # will be installed on purpose and can't be pulled in by installing - # coreutils, so prefer it to "gls". - gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty' - colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G' - else - ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' - fi +unset SSH_AGENT_PID +if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then + export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh" fi -#setopt no_beep -setopt auto_cd -setopt multios -setopt cdablevars +# Set GPG TTY +export GPG_TTY=$(tty) -if [[ x$WINDOW != x ]] -then - SCREEN_NO="%B$WINDOW%b " -else - SCREEN_NO="" -fi +# Refresh gpg-agent tty in case user switches into an X session +gpg-connect-agent updatestartuptty /bye >/dev/null -# Apply theming defaults -PS1="%n@%m:%~%# " +# fzf +source /usr/share/fzf/key-bindings.zsh +source /usr/share/fzf/completion.zsh -# git theming default: Variables for theming the git info prompt -ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name -ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt -ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty -ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean +export RANGER_LOAD_DEFAULT_RC=false -# Setup the prompt with pretty colors -setopt prompt_subst +BASE16_SHELL="$HOME/.config/base16-shell/" +[ -n "$PS1" ] && [ -s $BASE16_SHELL/profile_helper.sh ] && eval "$($BASE16_SHELL/profile_helper.sh)" -# --- - - -# disable annoying things -setopt no_beep - -# disable ^S -setopt no_flowcontrol - -# --- - -# enable prompt and colors -autoload -U compinit promptinit colors -compinit && promptinit && colors - -# bindings for history-substring -bindkey '^P' history-substring-search-up -bindkey '^N' histroy-substring-search-down - -# load local shell configuration if present -if [[ -f ~/.zshrc.local ]] -then - source ~/.zshrc.local -fi - -# load fzf -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh - -prompt walters