Skip to content

Instantly share code, notes, and snippets.

@iha2
Last active November 9, 2021 19:22
Show Gist options
  • Save iha2/8438ad70a0c9e3439bb4dc0f1e6ea0c4 to your computer and use it in GitHub Desktop.
Save iha2/8438ad70a0c9e3439bb4dc0f1e6ea0c4 to your computer and use it in GitHub Desktop.
scripts
set nocompatible
set nowrap
set number
set showmode
set tw=80
set smartcase
set smarttab
set autoindent
set smartindent
set softtabstop=2
set shiftwidth=2
set expandtab
set incsearch
set history=1000
set completeopt=menuone,menu,longest
set wildmenu
set wildmode=longest,list,full
set completeopt+=longest
set noswapfile
set t_Co=256
set cmdheight=1
set autoread
let mapleader='\'
call plug#begin('~/.cache/plug')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Syntax highlighting plugins
Plug 'HerringtonDarkholme/yats.vim'
Plug 'MarcWeber/vim-addon-mw-utils'
Plug 'airblade/vim-gitgutter'
" NERDTree plugins
Plug 'preservim/nerdtree'
Plug 'scrooloose/nerdcommenter'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'ryanoasis/vim-devicons'
Plug 'tomtom/tlib_vim'
Plug 'godlygeek/tabular'
Plug 'ervandew/supertab'
Plug 'Shougo/vimproc.vim'
Plug 'vim-airline/vim-airline'
Plug 'sheerun/vim-polyglot'
"navigation
Plug 'christoomey/vim-tmux-navigator'
" color schemes
Plug 'joshdick/onedark.vim'
Plug 'ayu-theme/ayu-vim'
"searching
Plug '/usr/local/opt/fzf', { 'do': 'fzf#install()' }
Plug 'junegunn/fzf.vim'
" random"
Plug 'xolox/vim-misc'
" asynchronous linting
Plug 'dense-analysis/ale'
" haskell syntax highlighting
Plug 'neovimhaskell/haskell-vim'
" auto save functionality
Plug '907th/vim-auto-save'
" snippit functionality
Plug 'SirVer/ultisnips'
" multiple cursor functionality
Plug 'terryma/vim-multiple-cursors'
" making searching and motions easier
Plug 'easymotion/vim-easymotion'
" clojure plugins
Plug 'Olical/conjure', {'tag': 'v4.11.0'}
Plug 'tpope/vim-dispatch'
Plug 'clojure-vim/vim-jack-in'
Plug 'radenling/vim-dispatch-neovim'
Plug 'luochen1990/rainbow'
Plug 'tpope/vim-fireplace'
Plug 'eraserhd/parinfer-rust', {'do': 'cargo build --release'}
Plug 'tpope/vim-salve'
call plug#end()
filetype plugin indent on
syntax on
" ayu colorsetup
set termguicolors " enable true colors support
"let ayucolor="light" " for light version of theme
let ayucolor="mirage" " for mirage version of theme
" let ayucolor="dark" " for dark version of theme
" line color explicitly defined
highlight LineNr guifg=orange
" allows alt to work for vim
map <m-a> ggVG
"fzf fuzzy finder
let g:fzf_buffers_jump = 1
" search in project
nnoremap <C-f> :Rg<CR>
nnoremap <C-p> :Files<CR>
nnoremap <A-b> :Buffers<CR>
" turns off highlight searching
set hls!
command! -bang -nargs=* Rg call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case ".shellescape(<q-args>), 1, {'options': '--delimiter : --nth 4..'}, <bang>0)
" set search visual highlight
vnoremap // y/\V<C-R>=escape(@",'/\')<CR><CR>
" NERDTREE -- file and folder navigator
let g:NERDTreeGitStatusWithFlags = 1
let g:NERDTreeChDirMode = 2
let g:NERDTreeIgnore = ['^node_modules', '.DS_Store']
let g:NERDTreeWinPos= "right"
let g:NERDTreeShowHidden=1
au VimEnter * NERDTree
noremap <C-b> :NERDTreeToggle<CR>
map <leader>r :NERDTreeFind<cr>
colorscheme ayu
" ------CLOJURE-------
nnoremap <leader>R :Require<cr>
let g:coc_global_extensions = [
\ 'coc-snippets',
\ 'coc-pairs',
\ 'coc-tsserver',
\ 'coc-eslint',
\ 'coc-prettier',
\ 'coc-json',
\ 'coc-conjure'
\ ]
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
let g:coc_watch_extensions = ['coc-conjure']
" Lint configuration - clj-kondo
" clj-kondo should be installed on operating system path
let g:ale_linters = {
\ 'clojure': ['clj-kondo']
\}
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" Remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
nmap <F2> <Plug>(coc-rename)
command! -nargs=0 Prettier :CocCommand prettier.formatFile
vmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
" Mapping for tmux navigator
let g:tmux_navigator_no_mappings = 1
nnoremap <silent> <C-h> :TmuxNavigateLeft<CR>
nnoremap <silent> <C-k> :TmuxNavigateDown<CR>
nnoremap <silent> <C-j> :TmuxNavigateUp<CR>
nnoremap <silent> <C-l> :TmuxNavigateRight<CR>
nnoremap <silent> <C-/> :TmuxNavigatePrevious<CR>
let g:haskell_tabular = 1
vnoremap a= :Tabularize /=<CR>
vnoremap a; :Tabularize /::<CR>
vnoremap a- :Tabularize /-><CR>
" haskell vim settings
let g:haskell_enable_quantification = 1 " to enable highlighting of `forall`
let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec`
let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc`
let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern`
let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles
let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static`
let g:haskell_backpack = 1 " to enable highlighting of backpack keywords<Paste>
nnoremap <silent> <tab> :if &modifiable && !&readonly && &modified <CR> :write<CR> :endif<CR>:bnext<CR>
nnoremap <silent> <s-tab> :if &modifiable && !&readonly && &modified <CR> :write<CR> :endif<CR>:bprevious<CR>
"nnoremap <C-o> :bnext<CR>
"nnoremap <C-i> :bprevious<CR>
nnoremap <A-j> :m +1<CR>
nnoremap <A-k> :m -2<CR>
"rainbow parantheses
"let g:rainbow_active = 1
" TYPESCRIPT CONFIGURATION
" Vim assumes *.ts files are xml files. This sets them to typescripts files
autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript
autocmd BufNewFile,BufRead *.tsx let b:tsx_ext_found = 1
autocmd BufNewFile,BufRead *.tsx set filetype=typescript.tsx
let g:typescript_compiler_options = ''
let g:typescript_compiler_binary = 'tsc'
" remap yank to system clipboard
noremap <Leader>y "*y
noremap <Leader>p "*p
noremap <Leader>Y "+y
noremap <Leader>P "+p
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" HASKELL SUPERTAB
let g:SuperTabDefaultCompletionType = '<c-x><c-o>'
if has("gui_running")
imap <c-space> <c-r>=SuperTabAlternateCompletion("\<lt>c-x>\<lt>c-o>")<cr>
else " no gui
if has("unix")
inoremap <Nul> <c-r>=SuperTabAlternateCompletion("\<lt>c-x>\<lt>c-o>")<cr>
endif
endif
let g:haskellmode_completion_ghc = 1
autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
" <Ctrl-l> redraws the screen and removes any search highlighting.
nnoremap <silent> <A-h> :nohl<CR><A-h>)
" UltiSnip configuration
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
" Allow CoC to control snippet expand
inoremap <silent><expr> <TAB>
\ pumvisible() ? coc#_select_confirm() :
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
let g:coc_snippet_next = '<tab>'
" Check if NERDTree is open or active
function! IsNERDTreeOpen()
return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1)
endfunction
" Call NERDTreeFind iff NERDTree is active, current window contains a modifiable
" file, and we're not in vimdiff
function! SyncTree()
if &modifiable && IsNERDTreeOpen() && strlen(expand('%')) > 0 && !&diff
NERDTreeFind
wincmd p
endif
endfunction
" Highlight currently open buffer in NERDTree
autocmd BufEnter * call SyncTree()
alias vim="nvim"
alias js-start="yarn start"
alias reload="source ~/.zshrc"
alias cljs-sandbox="source ~/bin/cljs-sandbox.sh"
alias work="cd ~/Work/hers"
alias emacs="emacs -nw"
alias dsg="cd /Volumes/DSG/dsg-design-system"
alias tmux="TERM=screen-256color-bce tmux"
SCRIPTHOME='~/bin/scripts'
if [ -f $HOME/.zshrc ] && [ -f $HOME/.tmux.conf ] && [ -f $HOME/.vimrc ]; then
rm ~/.zshrc
rm ~/.vimrc
rm ~/.tmux.conf
fi
ln -s $SCRIPTHOME/zshrc ~/.zshrc
ln -s $SCRIPTHOME/vimrc ~/.vimrc
ln -s $SCRIPTHOME/tmux.conf ~/.tmux.conf
#tmux configuration files
#Scrollback/History limit
set -g history-limit 10000
# easier and faster switching between next/prev window
bind C-p previous-window
bind C-n next-window
# set only on OS X where it's required
unbind C-b
set -g prefix '`'
bind-key '`' send-prefix
bind '`' next-window
#show buffer
bind 'b' list-buffers
#vi mode for tmux
#tmux package
set -g @plugin 'tmux-plugins/tpm'
set -g default-terminal "xterm-256color"
set -ga terminal-overrides ",*256col*:Tc"
#allows mouse highlighting
#set-option -g mouse on
#set-window-option -g mode-keys vi
bind j resize-pane -D 10
bind k resize-pane -U 10
bind l resize-pane -R 10
bind h resize-pane -L 10
# 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="/Users/iheatu/.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="random"
# 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"
source "$HOME/bin/alias.sh"
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
export PATH="$HOME/.local/bin/stack:$PATH"
export FZF_DEFAULT_COMMAND='ack --type f'
[ -f "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}/.ghcup/env" ] && source "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}/.ghcup/env"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment