Skip to content

Instantly share code, notes, and snippets.

@amiralles
Last active February 16, 2022 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amiralles/dda6dd86893e3b944f6d728afd00cd3d to your computer and use it in GitHub Desktop.
Save amiralles/dda6dd86893e3b944f6d728afd00cd3d to your computer and use it in GitHub Desktop.
execute pathogen#infect()
syntax on
syntax enable
filetype plugin indent on
colorscheme monokai_pro
set cursorline
highlight CursorLine ctermbg=333333
highlight ColorColumn ctermbg=999999
set encoding=utf-8
set path+=**
set formatoptions=l
set lbr
command WQ wq
command Wq wq
command WA wa
command Wa wa
command W w
command Q q
set laststatus=2
set statusline=%<%f\ %h%m%r%=%-.(Line\ %l,%c%)\ %P\ |
set nu
let mapleader = ","
set columns=120
set lines=38
set tabstop=2
set shiftwidth=2
set softtabstop=2
set wildmenu
set t_Co=256
"==================================================
"turns off blinking
set visualbell t_vb= " turn off error beep/flash
set novisualbell " turn off visual bell
"==================================================
"
set wildignore+=*.dll,*.exe,.git,*.pdb,*.resx,*.git,tmp,node_modules
set wildignore=*.o,*.obj,*~ "stuff to ignore when tab completing
set wildignore+=*sass-cache*
set wildignore+=*DS_Store*
set wildignore+=vendor/rails/**
set wildignore+=vendor/cache/**
set wildignore+=*.gem
set wildignore+=log/**
set wildignore+=tmp/**
set wildignore+=*.png,*.jpg,*.gif
set wildignore+=*.rbenv/**
set wildignore+=doc/**
set wildignore+=documentation/**
set cc=81
imap jj <esc>
nmap <space> i
nmap <leader><leader> <C-^>
nmap <leader>l :set list!<CR>
nmap <leader>h :set hlsearch!<CR>
nmap <leader>m :MRU<CR>
nmap <leader>w :set nowrap!<CR>
nmap <leader>n :call NERDTreeToggle()<CR>
" Find all files in all non-dot directories starting in the working directory.
" Fuzzy select one of those. Open the selected file with :e.
"
" Use this one:
" find * -type f -not -path "node_modules/*" -not -path "*.sh" -not -path "*.beam"
nnoremap <leader>t :call SelectaCommand("find * -type f", "", ":e")<CR>
nmap <leader>r :ReplaceWordUnderCursor<CR>
nmap <leader>/ gcc
vmap <leader>/ gcc
" NERDTree settings
let g:NERDTreeWinSize=40
"" Run a given vim command on the results of fuzzy selecting from a given shell
" command. See usage below.
function! SelectaCommand(choice_command, selecta_args, vim_command)
try
let selection = system(a:choice_command . " | selecta " . a:selecta_args)
catch /Vim:Interrupt/
" Swallow the ^C so that the redraw below happens; otherwise there will be
" leftovers from selecta on the screen
redraw!
return
endtry
redraw!
exec a:vim_command . " " . selection
endfunction
" Replaces the current word under cursor prompting for a new value.
function ReplaceWordUnderCursor()
call inputsave()
let word = expand("<cword>")
if (word != "")
let newword = input("Replace [".word."] with: ")
call inputrestore()
execute "%s/".word."/".newword."/gc"
else
echo "No word under cursor."
end
endfunction
function BlameFile()
let current_file = expand("%")
execute "!" . "smerge blame " . l:current_file
endfunction
function FileHistory()
let current_file = expand("%")
execute "!" . "smerge log " . l:current_file
endfunction
" Grep for *term* on Elixir files
function EGrep(term)
execute "!" . "git grep -n " . a:term . " -- \"*.ex\" \"*.exs\" \"*.leex\" | sort"
endfunction
" Find references to *term* on Elixir files
function ERefs(term)
execute "!" . "git grep --name-only " . a:term . " -- \"*.ex\" \"*.exs\" \"*.leex\" | wc -l"
endfunction
command ReplaceWordUnderCursor call ReplaceWordUnderCursor()
command BlameFile call BlameFile()
command FileHistory call FileHistory()
command -nargs=1 EGrep call EGrep(<f-args>)
command -nargs=1 ERefs call ERefs(<f-args>)
set linebreak
set textwidth=79
set wrapmargin=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment