Skip to content

Commit

Permalink
maint: vimrc yak shaving
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Doster <Vladislav.Doster@Mastercard.com>
  • Loading branch information
Vladislav Doster authored and vladdoster committed Sep 9, 2022
1 parent 4a24afd commit ada0982
Showing 1 changed file with 43 additions and 87 deletions.
130 changes: 43 additions & 87 deletions vim/.vimrc
Original file line number Diff line number Diff line change
@@ -1,126 +1,96 @@
" vim-bootstrap 2022-09-07 18:57:22

"*****************************************************************************
"" Vim-Plug core
"*****************************************************************************
" if &term =~ 'xterm\|kitty\|alacritty\|tmux'
" let &t_Ts = "\e[9m" " Strikethrough
" let &t_Te = "\e[29m"
" let &t_Cs = "\e[4:3m" " Undercurl
" let &t_Ce = "\e[4:0m"
" endif

let curl_exists=expand('curl')
let g:vim_bootstrap_langs = ""
let g:vim_bootstrap_editor = "vim"
let g:vim_bootstrap_theme = "codedark"
let g:vim_bootstrap_frams = ""

let plugins=expand('~/.local/share/vim/autoload/plug.vim')
if !filereadable(plugins)
if !executable(curl_exists)
let vimplug=expand('~/.vim/autoload/plug.vim')
let curl=expand('curl')
if !filereadable(vimplug)
if !executable(curl)
echoerr "ERROR: curl not found"
execute "q!"
endif
echo "--- installing vim-plug..."
echo ""
silent exec "!"curl_exists" -fLo " . shellescape(plugins) . " --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
silent exec "!"curl" -fLo " . shellescape(vimplug) . " --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
let g:not_finish_vimplug = "yes"

autocmd VimEnter * PlugInstall
endif

" Required:
call plug#begin(expand('~/.local/share/vim/plugged'))

call plug#begin(expand('~/.vim/plugged'))
Plug 'scrooloose/nerdtree'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'vim-scripts/grep.vim'
Plug 'vim-scripts/CSApprox'
Plug 'Raimondi/delimitMate'
Plug 'Yggdroot/indentLine'
Plug 'editor-bootstrap/vim-bootstrap-updater'
Plug 'tomasiser/vim-code-dark'
"" Vim-Session
Plug 'xolox/vim-misc'
Plug 'sheerun/vim-polyglot'
Plug 'joshdick/onedark.vim'
Plug 'embark-theme/vim', { 'as': 'embark', 'branch': 'main' }

call plug#end()

" Required:
filetype plugin indent on
"*****************************************************************************
"" Basic Setup
"*****************************************************************************"
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8
set ttyfast

"" Fix backspace indent
set backspace=indent,eol,start

"" Tabs. May be overridden by autocmd rules
set tabstop=4
set softtabstop=0
set shiftwidth=2
set expandtab

"" Map leader to ,
let mapleader=','

"" Enable hidden buffers
set hidden

"" Searching
set hlsearch
set incsearch
set ignorecase
set smartcase

set fileformats=unix,dos,mac


let zsh=expand('zsh')
if !executable(zsh)
set shell=zsh
else
set shell=/bin/bash
endif
"*****************************************************************************
"" Visual Settings
"*****************************************************************************
syntax on
set ruler
set number

let no_buffers_menu=1
syntax on
colorscheme embark


" Better command line completion
colorscheme codedark
set wildmenu

" mouse support
set mouse=a

set mousemodel=popup
set t_Co=256
set guioptions=egmrti


"" Disable the blinking cursor.
set gfn=Monospace\ 10
if &term =~ '256color'
set t_ut=
endif
set gcr=a:blinkon0

set scrolloff=3


"" Status bar
set laststatus=2

"" Use modeline overrides
set modeline
set modelines=10

set title
set titleold="Terminal"


set titlestring=%F
set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\
" Search mappings: These will make it so that going to the next one in a
" search will center on the line it's found in.
nnoremap n nzzzv
nnoremap N Nzzzv
if exists("*fugitive#statusline")
set statusline+=%{fugitive#statusline()}
endif
"*****************************************************************************
"" Abbreviations
"*****************************************************************************
Expand All @@ -135,23 +105,25 @@ cnoreabbrev WQ wq
cnoreabbrev W w
cnoreabbrev Q q
cnoreabbrev Qall qall

"" NERDTree configuration
let g:NERDTreeChDirMode=2
let g:NERDTreeIgnore=['node_modules','\.rbc$', '\~$', '\.pyc$', '\.db$', '\.sqlite$', '__pycache__']
let g:NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$']
let g:NERDTreeShowBookmarks=1
let g:nerdtree_tabs_focus_on_files=1
let g:NERDTreeMapOpenInTabSilent = '<RightMouse>'
let g:NERDTreeWinSize = 50
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.db,*.sqlite,*node_modules/
nnoremap <silent> <C-n> :NERDTreeToggle<CR>

" grep.vim
nnoremap <silent> <leader>f :Rgrep<CR>
let Grep_Default_Options = '-IR'
let Grep_Skip_Files = '*.log *.db'
let Grep_Skip_Dirs = '.git node_modules'
" terminal emulation
nnoremap <silent> <leader>sh :terminal<CR>
" remove trailing whitespaces
command! FixWhitespace :%s/\s\+$//e

if !exists('*s:setupWrapping')
function s:setupWrapping()
set wrap
Expand All @@ -162,86 +134,70 @@ endif
"" The PC is fast enough, do syntax highlight syncing from start unless 200 lines
augroup vimrc-sync-fromstart
autocmd!
autocmd BufEnter * :syntax sync maxlines=200
autocmd BufEnter * :syntax sync maxlines=3000
augroup END

"" Remember cursor position
augroup vimrc-remember-cursor-position
autocmd!
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
augroup END

"" txt
augroup vimrc-wrapping
autocmd!
autocmd BufRead,BufNewFile *.txt call s:setupWrapping()
augroup END


set autoread

"*****************************************************************************
"" Mappings
"*****************************************************************************

"" Split
noremap <Leader>h :<C-u>split<CR>
noremap <Leader>v :<C-u>vsplit<CR>
"" Tabs
nnoremap <Tab> gt
nnoremap <S-Tab> gT
nnoremap <silent> <S-t> :tabnew<CR>
"" Set working directory
nnoremap <leader>. :lcd %:p:h<CR>
cnoremap <C-P> <C-R>=expand("%:p:h") . "/" <CR>
nnoremap <silent> <leader>b :Buffers<CR>
nnoremap <silent> <leader>e :FZF -m<CR>
"Recovery commands from history through FZF
nmap <leader>y :History:<CR>
" Disable visualbell

set noerrorbells visualbell t_vb=
if has('autocmd')
autocmd GUIEnter * set visualbell t_vb=
endif
"" Copy/Paste/Cut
if has('unnamedplus')
set clipboard=unnamed,unnamedplus
endif

noremap YY "+y<CR>
noremap <leader>p "+gP<CR>
noremap XX "+x<CR>
if has('macunix')
" pbcopy for OSX copy/paste
vmap <C-x> :!pbcopy<CR>
vmap <C-c> :w !pbcopy<CR><CR>
endif

"" Buffer nav
noremap <leader>z :bp<CR>
noremap <leader>q :bp<CR>
noremap <leader>x :bn<CR>
noremap <leader>w :bn<CR>
"" Close buffer
noremap <leader>c :bd<CR>
"" Clean search (highlight)
nnoremap <silent> <leader><space> :noh<cr>
"" Switching windows
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-l> <C-w>l
noremap <C-h> <C-w>h
"" Vmap for maintain Visual Mode after shifting > and <
vmap < <gv
vmap > >gv
"" Move visual block
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv

0 comments on commit ada0982

Please sign in to comment.