Skip to content

Instantly share code, notes, and snippets.

@adithyaov
Last active August 12, 2020 02:34
Show Gist options
  • Save adithyaov/2fcbd10820a3b983567ec1cd711ea121 to your computer and use it in GitHub Desktop.
Save adithyaov/2fcbd10820a3b983567ec1cd711ea121 to your computer and use it in GitHub Desktop.
Dot files
# Launch Zsh
if [ -t 1 ]; then
exec zsh
fi
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
# Desktop place :-)
alias desktop='cd /mnt/c/Users/mota/Desktop'
alias prog='cd /mnt/c/Users/mota/Desktop/LinuxWorkStation/Prog'
# Cabal && Ghc
# alias ghcCabal='/opt/ghc/bin/cabal'
# alias ghc='/opt/ghc/bin/ghc'
# alias cabal='/opt/cabal/bin/cabal'
export PATH=$PATH:/home/creed/haskell/cabal/bin/
export PATH=$PATH:/home/creed/.cabal/bin/
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Cabal with diff versions
GHC822=/opt/ghc/8\.2\.2/bin/ghc
GHC863=/opt/ghc/8\.6\.3/bin/ghc
# Entering the nix environment
alias enter-nix='source ~/.nix-profile/etc/profile.d/nix.sh'
# Adding .local/bin to PATH
export PATH=/home/creed/.local/bin:$PATH
# Unset <c-s>
stty -ixon
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
syntax on
filetype plugin indent on
call plug#begin(stdpath('data') . '/plugged')
Plug 'tpope/vim-surround'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'neovimhaskell/haskell-vim'
Plug 'ervandew/supertab'
Plug 'godlygeek/tabular'
Plug 'airblade/vim-gitgutter'
Plug 'vim-syntastic/syntastic'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'moll/vim-bbye'
Plug 'jreybert/vimagit'
Plug 'mhartington/oceanic-next'
Plug 'vim-ctrlspace/vim-ctrlspace'
call plug#end()
" Tab specific option
set tabstop=4 softtabstop=0 expandtab shiftwidth=2 smarttab
" Number option
set number
" haskell-vim
let g:haskell_enable_quantification = 1 " highlighting of `forall`
let g:haskell_enable_recursivedo = 1 " highlighting of `mdo` and `rec`
let g:haskell_enable_arrowsyntax = 1 " highlighting of `proc`
let g:haskell_enable_pattern_synonyms = 1 " highlighting of `pattern`
let g:haskell_enable_typeroles = 1 " highlighting of type roles
let g:haskell_enable_static_pointers = 1 " highlighting of `static`
let g:haskell_backpack = 1 " highlighting of backpack keywords
" Easy init.vim access
nnoremap <c-l> e
nnoremap <c-h> b
nnoremap <c-j> 10j
nnoremap <c-k> 10k
vnoremap <c-l> e
vnoremap <c-h> b
vnoremap <c-j> 10j
vnoremap <c-k> 10k
nnoremap <c-a> 0
nnoremap <c-e> g_
vnoremap <c-a> 0
vnoremap <c-e> g_
onoremap <c-a> 0
onoremap <c-e> g_
nnoremap <leader>ev :e $MYVIMRC<cr>GGo
nnoremap <Leader>sv :source $MYVIMRC<CR>
map <leader>sp :setlocal spell! spelllang=en_us<cr>
nnoremap <leader>t :tabnew<cr>
nnoremap <c-s> :w<cr>
nnoremap <c-s> :w<cr>
nnoremap <c-x><c-x> :Bdelete<cr>
nnoremap <c-x><c-d> :q<cr>
inoremap <c-s> <esc>:w<cr>
inoremap <c-x><c-x> <esc>:Bdelete<cr>
vnoremap <leader>=1 :Tabularize /=<cr>
vnoremap <leader>=2 :Tabularize /==<cr>
let g:ctrlp_custom_ignore = 'dist\|dist-newstyle\|\.git\|_cache\|_site'
let g:gitgutter_map_keys = 0
vmap <leader>y :w! /mnt/c/Users/mota/Desktop/tmp/vitmp<CR>
nmap <leader>p :r! cat /mnt/c/Users/mota/Desktop/tmp/vitmp<CR>
let g:airline#extensions#tabline#enabled = 0
" let g:airline_theme='oceanicnext'
" let g:airline#extensions#tabline#show_tab_nr = 1
" let g:airline#extensions#tabline#tab_nr_type = 1
" let g:airline#extensions#tabline#fnamemod = ':t'
set showtabline=0
set nocompatible
set hidden
let g:CtrlSpaceDefaultMappingKey = "<c-p>"
" Get used to ctrl-space
" noremap <right> :tabn<cr>
" noremap <left> :tabp<cr>
if executable("ag")
let g:CtrlSpaceGlobCommand = 'ag -l --nocolor -g ""'
endif
nnoremap <silent> <c-o>:CtrlSpace O<cr>
tnoremap <c-p> <c-\><c-n>:CtrlSpace<cr>
set cursorline
nnoremap <leader>gv :Magit<cr>
" For Nvim
"
tnoremap <esc> <c-\><c-n>
inoremap <A-right> <esc><c-w>l
inoremap <A-left> <esc><c-w>h
inoremap <A-up> <esc><c-w>k
inoremap <A-down> <esc><c-w>j
vnoremap <A-right> <esc><c-w>l
vnoremap <A-left> <esc><c-w>h
vnoremap <A-up> <esc><c-w>k
vnoremap <A-down> <esc><c-w>j
nnoremap <A-right> <c-w>l
nnoremap <A-left> <c-w>h
nnoremap <A-up> <c-w>k
nnoremap <A-down> <c-w>j
tnoremap <A-right> <c-\><c-n><c-w>l
tnoremap <A-left> <c-\><c-n><c-w>h
tnoremap <A-up> <c-\><c-n><c-w>k
tnoremap <A-down> <c-\><c-n><c-w>j
nnoremap <silent> <C-right> :vertical res +5<cr>
nnoremap <silent> <C-left> :vertical res -5<cr>
nnoremap <silent> <C-up> :res -5<cr>
nnoremap <silent> <C-down> :res +5<cr>
nnoremap <silent> `\ :vsplit<cr>
nnoremap <silent> `- :split<cr>
if (has("termguicolors"))
set termguicolors
endif
" Theme
syntax enable
colorscheme OceanicNext
set colorcolumn=80
set textwidth=80
" Get the first terminal from the buffer list in the given tab
function! InitTermV()
if !exists("t:in_ter")
let t:in_ter = 0
let t:buf_to = -1
endif
endfunction
function! GetTTBId()
for _x in ctrlspace#api#BufferList(tabpagenr())
if _x["text"] =~ "^term://\.//"
return _x["index"]
endif
endfor
return -1
endfunction
function! ToggleTerm()
if t:in_ter == 0
let t:buf_to = bufnr("%")
let l:tid = GetTTBId()
if l:tid isnot -1
execute "buffer " . l:tid
else
execute "terminal"
endif
let t:in_ter = 1
else
execute "buffer " . t:buf_to
let t:in_ter = 0
endif
endfunction
function! InitNToggleTerm()
call InitTermV()
call ToggleTerm()
endfunction
nnoremap <silent> <m-return> <esc>:call InitNToggleTerm()<cr>
tnoremap <silent> <m-return> <c-\><c-n>:call InitNToggleTerm()<cr>
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/creed/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="avit"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS=true
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# ---------------------------- MY CONFIG ----------------------------
# Desktop place :-)
alias desktop='cd /mnt/c/Users/mota/Desktop'
alias prog='cd /mnt/c/Users/mota/Desktop/LinuxWorkStation/Prog'
alias l='vim .log'
alias vim='nvim'
export PATH=$PATH:/home/creed/.cabal/bin/
export PATH=$PATH:/home/creed/haskell/cabal/bin/
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Cabal with diff versions
GHC865=/opt/ghc/8\.6\.5/bin/ghc
GHC_LIVE=/mnt/c/Users/mota/Desktop/LinuxWorkStation/Prog/ghc/inplace/bin/ghc-stage2
# Entering the nix environment
alias enter-nix='source ~/.nix-profile/etc/profile.d/nix.sh'
# Adding .local/bin to PATH
export PATH=/home/creed/.local/bin:$PATH
# Unset <c-s>
stty -ixon
# Entering the nix environment
alias enter-nix='source ~/.nix-profile/etc/profile.d/nix.sh'
# For vim colors to work properly
export TERM=screen-256color
# Tmux usage
#[[ -z "$TMUX" && -n "$USE_TMUX" ]] && {
# [[ -n "$ATTACH_ONLY" ]] && {
# tmux a 2>/dev/null || {
# cd && exec tmux
# }
# exit
# }
#
# tmux new-window -c "$PWD" 2>/dev/null && exec tmux a
# exec tmux
#}
# export LS_COLORS="$LS_COLORS:ow=7:tw=7:"
export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33'
export GIT_EDITOR='nvr --remote-wait-silent'
alias eme='
export DISPLAY=:0.0
export LIBGL_ALWAYS_INDIRECT=1
setxkbmap -layout us
setsid emacs
'
# export DISPLAY=:0.0
# export LIBGL_ALWAYS_INDIRECT=1
#
# setxkbmap -option caps:swapescape
#
# # Map an unused modifier's keysym to the spacebar's keycode and make it a
# # control modifier. It needs to be an existing key so that emacs won't
# # spazz out when you press it. Hyper_L is a good candidate.
# spare_modifier="Hyper_L"
# xmodmap -e "keycode 65 = $spare_modifier"
# xmodmap -e "remove mod4 = $spare_modifier" # hyper_l is mod4 by default
# xmodmap -e "add Control = $spare_modifier"
#
# # Map space to an unused keycode (to keep it around for xcape to
# # use).
# xmodmap -e "keycode any = space"
#
# # Finally use xcape to cause the space bar to generate a space when tapped.
# xcape -e "$spare_modifier=space"
if [[ $TERM = dumb ]]; then
unset zle_bracketed_paste
fi
[ -f "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}/.ghcup/env" ] && source "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}/.ghcup/env"
if [ -e /home/creed/.nix-profile/etc/profile.d/nix.sh ]; then . /home/creed/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer
eval "$(direnv hook zsh)"
;; Minimal UI
(scroll-bar-mode -1)
(tool-bar-mode -1)
(menu-bar-mode -1)
(global-display-line-numbers-mode)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; Package configs
(require 'package)
(setq package-enable-at-startup nil)
(setq package-archives '(("org" . "http://orgmode.org/elpa/")
("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")))
(package-initialize)
;; Remapping bindings to the max
(global-set-key (kbd "C-c SPC") 'set-mark-command)
(global-set-key (kbd "C-l") 'delete-backward-char)
(global-set-key (kbd "M-l") 'backward-kill-word)
;; scroll one line at a time (less "jumpy" than defaults)
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
(setq scroll-step 1) ;; keyboard scroll one line at a time
;; Bootstrap `use-package`
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(require 'use-package)
(global-set-key (kbd "M-o") 'other-window)
(global-set-key (kbd "C-f") 'forward-char)
;; (define-key isearch-mode-map "\C-f" 'isearch-repeat-forward)
(define-key isearch-mode-map "\C-n" 'isearch-repeat-forward)
(global-set-key (kbd "C-b") 'backward-char)
;; (define-key isearch-mode-map "\C-b" 'isearch-repeat-backward)
(define-key isearch-mode-map "\C-p" 'isearch-repeat-backward)
(global-set-key (kbd "M-f") 'forward-word)
(global-set-key (kbd "M-b") 'backward-word)
(global-set-key (kbd "M-n") 'forward-paragraph)
(global-set-key (kbd "M-p") 'backward-paragraph)
;; (global-set-key (kbd "C-j") 'backward-delete-char)
;; (global-set-key (kbd "C-d") 'backward-delete-char)
;; (global-set-key (kbd "M-d") 'ivy-backward-kill-word)
(global-set-key (kbd "C-s") 'isearch-forward)
(global-set-key (kbd "C-r") 'isearch-backward)
(setq search-whitespace-regexp ".*?")
(define-key isearch-mode-map [remap isearch-delete-char] 'isearch-del-char)
(progn
(setq show-paren-style 'parenthesis)
(show-paren-mode 1))
(defun goto-prog-dir ()
"Change directory to the Desktop/LinuxWorkStation/Prog"
(interactive)
(cd "/mnt/c/Users/mota/Desktop/LinuxWorkStation/Prog"))
(defalias 'open 'find-file)
(defalias 'openo 'find-file-other-window)
(defalias 'prog 'goto-prog-dir)
(define-key key-translation-map (kbd "C-c x") (kbd "C-x"))
;; (global-set-key (kbd "C-f") 'forward-word)
;; (global-set-key (kbd "M-f") 'forward-char)
;; (global-set-key (kbd "C-b") 'backward-word)
;; (global-set-key (kbd "M-b") 'backward-char)
(setq-default fill-column 80)
(use-package ahk-mode
:ensure t)
(use-package column-enforce-mode
:ensure t
:config (global-column-enforce-mode t))
(use-package eshell-git-prompt
:ensure t
:config (eshell-git-prompt-use-theme 'robbyrussell))
(use-package csharp-mode
:ensure t)
(use-package highlight-indent-guides
:ensure t
:config (setq highlight-indent-guides-method 'fill))
;; Themes START --------------------------------------------
(use-package rebecca-theme :ensure t)
(use-package dracula-theme :ensure t)
(use-package srcery-theme :ensure t)
(load-theme 'srcery t)
;; Themes END ----------------------------------------------
(use-package impatient-mode
:ensure t
:config
(defun markdown-html (buffer)
(princ (with-current-buffer buffer
(format "<!DOCTYPE html><html><title>Impatient Markdown</title><xmp theme=\"united\" style=\"display:none;\"> %s </xmp><script src=\"http://strapdownjs.com/v/0.2/strapdown.js\"></script></html>" (buffer-substring-no-properties (point-min) (point-max))))
(current-buffer))))
(setq ring-bell-function 'ignore)
(use-package expand-region
:ensure t
:config
(pending-delete-mode t)
(global-set-key (kbd "C-=") 'er/expand-region)
(global-set-key (kbd "<C-return>") 'er/expand-region)
(global-set-key (kbd "C--") 'er/contract-region))
(use-package ivy
:ensure t
:config
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq ivy-count-format "(%d/%d) "))
(use-package swiper
:ensure t)
(use-package counsel
:ensure t
:config
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "C-c g") 'counsel-git))
(use-package magit
:ensure t
:config
(global-set-key (kbd "C-x g") 'magit-status))
(use-package haskell-mode
:ensure t
:config
(setq haskell-tags-on-save nil
tags-revert-without-query t
haskell-indentation-mode nil
haskell-compile-cabal-build-command "cabal v2-build"))
(use-package hindent
:ensure t
:config (add-hook 'haskell-mode-hook #'hindent-mode))
; (use-package flymake-hlint
; :ensure t
; :config (add-hook 'haskell-mode-hook 'flymake-hlint-load))
(use-package projectile
:ensure t
:config
(projectile-mode +1)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(setq projectile-completion-system 'ivy))
(use-package org
:ensure t)
(use-package multiple-cursors
:ensure t
:config
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this))
(use-package avy
:ensure t
:config
(setq avy-keys '(?a ?s ?d ?f ?q ?w ?e ?r ?n ?m ?g ?h ?j ?k ?l))
(setq avy-background t)
(setq avy-orders-alist '((avy-goto-word-0 . avy-order-closest)))
(setq avy-all-windows nil)
(global-set-key (kbd "M-RET") 'avy-goto-word-0))
(windmove-default-keybindings 'meta)
(setq projectile-project-search-path '("/mnt/c/Users/mota/Desktop/LinuxWorkStation/Prog/"))
(defun open-my-init-file ()
"Open the init file."
(interactive)
(find-file user-init-file))
(use-package crux
:ensure t
:bind (("C-a" . crux-move-beginning-of-line)))
(defun smarter-move-point ()
"Move point to the first non-whitespace character on this line.
If point is already there, move to the beginning of the line.
If point is already there, move to the end of line.
Effectively toggle between the first non-whitespace character,
the beginning of the line and the end of the line."
(interactive)
(let ((orig-point (point)))
(if (= orig-point (point-at-bol))
(move-end-of-line 1)
(progn (back-to-indentation)
(when (= orig-point (point))
(move-beginning-of-line 1))))))
(global-set-key (kbd "C-o") 'smarter-move-point)
(defun buffer-list-switch ()
"Switch to buffer list and activate the window"
(interactive)
(list-buffers)
(select-window (get-buffer-window "*Buffer List*" 0))
)
(global-set-key (kbd "C-x C-b") 'buffer-list-switch)
(use-package hydra
:ensure t
:config
(global-set-key
(kbd "C-c m")
(defhydra hydra-movement (:body-pre (set-mark-command nil))
"Hydra navigation"
("f" forward-char)
("F" forward-word)
("b" backward-char)
("B" backward-word)
("p" previous-line)
("n" next-line)
("P" backward-paragraph)
("N" forward-paragraph)
("a" crux-move-beginning-of-line)
("e" move-end-of-line)
("q" nil)
("v" scroll-up-command)
("V" scroll-down-command)
("m" avy-goto-word-0 :color blue)
)))
(setq-default custom-file (expand-file-name ".custom.el" user-emacs-directory))
(when (file-exists-p custom-file)
(load custom-file))
;; ===================================================================
;; Haskell auto show core script
(defun produce-core (file-path &optional ghc-path args)
(let* ((check-nil (lambda (x y) (if x x y)))
(gp (funcall check-nil ghc-path "ghc"))
(aa (funcall check-nil args ""))
(cmd (concat gp " " file-path " -ddump-simpl -ddump-to-file " aa))
(so (shell-command-to-string cmd))
(res (with-temp-buffer (insert-file-contents (concat (substring file-path 0 -2) "dump-simpl") nil) (buffer-string)))
(cb (current-buffer)))
(progn (with-help-window "*core*" (princ res))
(switch-to-buffer "*core*")
(haskell-mode)
(switch-to-buffer cb))))
(defun current-core ()
(interactive)
(produce-core (buffer-file-name) "ghc" "-dsuppress-all -O2"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment