Skip to content

Instantly share code, notes, and snippets.

@yunusemrecan
Created January 31, 2018 21:48
Show Gist options
  • Save yunusemrecan/a54e96de6a46e16a61e6f802d1ffa5ef to your computer and use it in GitHub Desktop.
Save yunusemrecan/a54e96de6a46e16a61e6f802d1ffa5ef to your computer and use it in GitHub Desktop.
" vim: fdm=marker foldenable sw=4 ts=4 sts=4
"{{{ Plugins
call plug#begin('~/.vim/plugged')
" Track the engine.
Plug 'SirVer/ultisnips'
" Snippets are separated from the engine. Add this if you want them:
Plug 'honza/vim-snippets'
Plug 'scrooloose/nerdcommenter'
Plug 'mattn/emmet-vim'
Plug 'christoomey/vim-tmux-navigator'
Plug 'rust-lang/rust.vim'
Plug 'w0rp/ale'
Plug 'ekalinin/Dockerfile.vim', {'for' : 'Dockerfile'}
Plug 'fatih/vim-go', {'for':'go'}
Plug 'tomasr/molokai'
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
Plug 'tmux-plugins/vim-tmux', {'for': 'tmux'}
Plug 'tpope/vim-surround'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
Plug 'jiangmiao/auto-pairs'
Plug 'racer-rust/vim-racer',{'for':'rust'}
Plug 'ludovicchabant/vim-gutentags'
Plug 'ajh17/VimCompletesMe'
Plug 'junegunn/gv.vim'
Plug 'vim-latex/vim-latex'
Plug 'airblade/vim-gitgutter'
Plug 'tommcdo/vim-lion'
Plug 'tpope/vim-vinegar'
call plug#end()
"}}}
"{{{ Commmon Setup
set exrc
set secure
set tabstop=8
set softtabstop=4
set shiftwidth=4
set expandtab
set number " show line numbers
set relativenumber " Show relative numbers
set showcmd " show command in bottom bar
set cursorline " highlight current line
set showmatch " highlight matching [{()}]
set incsearch " search as characters are entered
set hlsearch " highlight matches
set foldenable " enable folding
set foldlevelstart=10 " open most folds by default
set ignorecase "ignore case sensitive
set smartcase
set foldmethod=indent " fold based on indent level
let mapleader="," " leader is comma
set encoding=utf-8 " The encoding displayed.
set fileencoding=utf-8 " The encoding written to file.
set ffs=unix,dos,mac " Use Unix as the standard file type
set wildmenu " show possible option why writing commands
set autoindent
set autowrite " Automatically save before commands like :next and :make
set showcmd
set nocursorcolumn " speed up syntax highlighting
set pumheight=10 " max 10 item on auto complete
" Turn backup off, since most stuff is in SVN, git et.c anyway...
set nobackup " nobackup files/folder
set nowb
set noswapfile
set laststatus=2 " Always show the status line
let $LANG='en'
set noerrorbells " No eeps
set visualbell
set hidden
set list lcs=tab:\|\ "show indents with tap
set path+=**
"}}}
"{{{ colorscheme
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
au InsertLeave * match ExtraWhitespace /\s\+$/
set t_Co=256
set background=dark
colorscheme Molokai
let g:molokai_original = 1
set termguicolors
"}}}
"{{{ Keymaps
noremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
nnoremap <leader>w <C-W>w
" jj for esc
inoremap jj <ESC>
nnoremap <leader>bn :bnext<CR>
nnoremap <Leader>bb :ls<CR>:b<Space>
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>\<cr>" : "\<cr>"
noremap <leader>u :w<Home>silent <End> !urlview<CR>
let g:UltiSnipsExpandTrigger="<c-e>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
"{{{ Rust keymap
au FileType rust nmap gd <Plug>(rust-def)
au FileType rust nmap gs <Plug>(rust-def-split)
au FileType rust nmap gx <Plug>(rust-def-vertical)
au FileType rust nmap <leader>gd <Plug>(rust-doc)
"}}}
"}}}
"{{{ highlight settings
let python_highlight_all = 1
" Enables all highlighting and go settings
let g:go_highlight_extra_types = 1
let g:go_highlight_space_tab_error = 1
let g:go_highlight_array_whitespace_error = 1
let g:go_highlight_chan_whitespace_error = 1
let g:go_highlight_operators = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_arguments = 1
let g:go_highlight_methods = 1
let g:go_highlight_types = 1
let g:go_highlight_format_strings = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_fields = 1
let g:go_highlight_variable_declarations = 1
let g:go_highlight_variable_assignments = 1
let g:go_fmt_command = 'goimports'
"}}}
"{{{ Pluginless
"{{{Rip Grep
set grepprg=rg\ --vimgrep
command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --no-ignore --hidden --follow --glob "!.git/*" --color "always" '.shellescape(<q-args>), 1, <bang>0)
"}}}
"{{{ Better White Space
function! StripTrailingWhitespace()
if !&binary && &filetype != 'diff'
normal mz
normal Hmy
%s/\s\+$//e
normal 'yz<CR>
normal `z
endif
endfunction
"}}}
""{{{ Statusline
" Dictionary: take mode() input -> longer notation of current mode
" mode() is defined by Vim
let g:currentmode={ 'n' : 'Normal ', 'no' : 'N·Operator Pending ', 'v' : 'Visual ', 'V' : 'V·Line ', '^V' : 'V·Block ', 's' : 'Select ', 'S': 'S·Line ', '^S' : 'S·Block ', 'i' : 'Insert ', 'R' : 'Replace ', 'Rv' : 'V·Replace ', 'c' : 'Command ', 'cv' : 'Vim Ex ', 'ce' : 'Ex ', 'r' : 'Prompt ', 'rm' : 'More ', 'r?' : 'Confirm ', '!' : 'Shell ', 't' : 'Terminal '}
" Function: return current mode
" abort -> function will abort soon as error detected
function! ModeCurrent() abort
let l:modecurrent = mode()
" use get() -> fails safely, since ^V doesn't seem to register
" 3rd arg is used when return of mode() == 0, which is case with ^V
" thus, ^V fails -> returns 0 -> replaced with 'V Block'
let l:modelist = toupper(get(g:currentmode, l:modecurrent, 'V·Block '))
let l:current_status_mode = l:modelist
return l:current_status_mode
endfunction
set laststatus=2
set statusline=
set statusline+=\ %{ModeCurrent()}
"set statusline+=%2*\ %l
set statusline+=\ %*
set statusline+=%1*\ ‹‹
set statusline+=%1*\ %f\ %*
set statusline+=%1*\ ››
set statusline+=%1*\ %m
set statusline+=%3*
set statusline+=%=
set statusline+=%y
set statusline+=%3*\ ::
set statusline+=\ %{(&fenc!=''?&fenc:&enc)}
set statusline+=\|
set statusline+=%{&fileformat}
set statusline+=%3*\ ::
set statusline+=%3*\ %p%%
"set statusline+=\|
set statusline+=%3*\ ::
set statusline+=%4l
set statusline+=/ " Separator
set statusline+=%4L " Total lines
set statusline+=\|
set statusline+=%4v
"set statusline+=%3*\ ::
"set statusline+=%3*\ %n
hi User1 guifg=#FFFFFF guibg=#191f26 gui=BOLD
hi User2 guifg=#000000 guibg=#959ca6
hi User3 guifg=#000000 guibg=#4cbf99
"}}}
"}}}
"{{{ Plugin Settings
"{{{ vim-racer
set omnifunc=syntaxcomplete#Complete
let g:racer_cmd = "/Users/yunusemrecan/.cargo/bin/racer"
let g:racer_experimental_completer = 1
let $RUST_SRC_PATH="/Users/yunusemrecan/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src"
"}}}
"{{{ Vimcompletes me
" close docs automaticly
autocmd InsertLeave * if bufname('%') != "[Command Line]" | pclose | endif
" }}}
"{{{ "fugitive
nnoremap <leader>gb :Gblame<cr>
nnoremap <leader>gd :Gvdiff<cr>
nnoremap <leader>gp :Git push<cr>
nnoremap <leader>gs :Gstatus<cr>
"}}}
"{{{ ale
let g:ale_sign_column_always = 1
let g:ale_set_loclist = 0
let g:ale_set_quickfix = 1
let g:ale_open_list = 1
"" Write this in your vimrc file
let g:ale_lint_on_text_changed = 'never'
nmap <silent> <leader>k <Plug>(ale_previous_wrap)
nmap <silent> <leader>j <Plug>(ale_next_wrap)
"}}}
"}}}
"{{{ Split settings
set splitbelow
set splitright
set winheight=30
"
"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment