Skip to content

Instantly share code, notes, and snippets.

@deleugpn
Last active July 23, 2018 19:47
Show Gist options
  • Save deleugpn/64519cb7d08fc32147f8bfb58480ab70 to your computer and use it in GitHub Desktop.
Save deleugpn/64519cb7d08fc32147f8bfb58480ab70 to your computer and use it in GitHub Desktop.
set nocompatible " Does not work with vi
so ~/.vim/plugins.vim " Source the plugins file
syntax enable
set shellcmdflag=-ic " Enable bash interactive mode (load .bashrc)
let mapleader = ',' " Leader key
"----------------- Remappings
nnoremap <C-e> <C-w>
nnoremap <A-left> <C-o> " Go back to previous location
nnoremap <A-right> <C-i> " Go forward
"----------------- Visual
colorscheme atom-dark " Basic theme
set number " Activate line numbers
set linespace=12
set guioptions-=r
set guioptions-=L
set guioptions-=T " Hide Toolbar
nnoremap <Leader>tb :if &go=~#'T'<Bar>set go-=T<Bar>else<Bar>set go+=T<Bar>endif<CR>
set guioptions-=m " Hide menu
nnoremap <Leader>menu :if &go=~#'m'<Bar>set go-=m<Bar>else<Bar>set go+=m<Bar>endif<CR>
set showtabline=2 " Always show tabs
let &colorcolumn=join(range(121,999),",") " Change bg after 120 characters
"----------------- Search
set hlsearch " Highlight search
set incsearch " Incrementally highlight search while typing
nmap <Leader><space> :nohlsearch<cr> " Cleanup search highlighting
"----------------- Split Management
set splitbelow
set splitright
nmap <C-h> <C-e><C-h> " Left
nmap <C-j> <C-e><C-j> " Up
nmap <C-k> <C-e><C-k> " Down
nmap <C-l> <C-e><C-l> " Right
hi vertsplit guifg=bg guibg=bg " Get rid of split separator
"----------------- Code Style
filetype plugin indent on
set tabstop=4 " show existing tab with 4 spaces width
set shiftwidth=4 " when indenting with '>', use 4 spaces width
set expandtab " On pressing tab, insert 4 spaces
" yaml indentation
au FileType yaml setlocal tabstop=2 expandtab shiftwidth=2 softtabstop=2
"----------------- Mappings
nmap <Leader>ev :tabedit $MYVIMRC<cr> " Open this file for edit in a separate tab
nmap <Leader>ep :tabedit ~/.vim/plugins.vim<cr> " Open the plugins file
nmap <Leader>plugin :so $MYVIMRC<cr> :PluginInstall<cr> " Install plugins
"----------------- NERDTree Plugin
nmap <Leader>d :NERDTreeToggle<cr> " Open/Close Nerd Tree
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
let NERDTreeShowHidden=1
autocmd VimEnter * NERDTree
"----------------- [CTRL] Basic Text Editor Mappings
map <C-a> ggVG " Select entire file
vmap <C-c> y<cr> " Copy the selected text
vmap <C-x> d<cr> " Cut the selected text
imap <C-s> <ESC>:w<cr> " Save file with CTRL + S
nmap <C-s> :w<cr> " Save file with CTRL + S
map <C-w> <ESC>:bd<cr> " Close current tab
nmap <C-z> u " Map CTRL + Z with undo
imap <C-z> <ESC>u
map <C-y> <ESC>^R " Redo
nmap <C-v> p " CTRL + V to paste yanked content
imap <C-v> <ESC>p " CTRL + V to paste yanked content
nmap <S-Insert> "+gP " Paste Clipboard
imap <S-Insert> <ESC>"+gP " Paste Clipboard
"----------------- CTRL P
let g:ctrlp_map = '<A-O>' " Remap CTRLP With Shift + Alt + O
let g:ctrlp_custom_ignore = 'node_modules\|git'
" Go to Method/Variable definition in fine
map <A-G> <ESC>:CtrlPBufTag<cr>
" Browse through recently opened files
map <A-I> <ESC>:CtrlPMRUFiles<cr>
"----------------- Docker
"nmap <Leader>dcup !docker-compose up -d
"----------------- Composer
nmap <Leader>composer :!php-container composer
"----------------- PHPUnit
nmap <Leader>tt yiw:!phpunit --filter <C-r>"<cr>
nmap <Leader>tf :!phpunit %<cr>
nmap <Leader>ta :!phpunit<cr>
"----------------- Auto Commands
" Automatically source the vimrc file after saving
augroup autosourcing
autocmd!
autocmd BufWritePost .vimrc source %
augroup END
#!/usr/bin/env bash
fonts_dir="${HOME}/.local/share/fonts"
if [ ! -d ${fonts_dir} ]; then
echo "mkdir -p $fonts_dir"
mkdir -p ${fonts_dir}
else
echo "Found fonts dir $fonts_dir"
fi
for type in Bold Light Medium Regular Retina; do
file_path="${HOME}/.local/share/fonts/FiraCode-${type}.ttf"
file_url="https://github.com/tonsky/FiraCode/blob/master/distr/ttf/FiraCode-${type}.ttf?raw=true"
if [ ! -e ${file_path} ]; then
echo "wget -O $file_path $file_url"
wget -O ${file_path} ${file_url}
else
echo "Found existing file $file_path"
fi;
done
echo "fc-cache -f"
fc-cache -f
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'tpope/vim-surround'
" All of your plugins must be added before the following line
call vundle#end()
filetype plugin indent on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment