Skip to content

Instantly share code, notes, and snippets.

@zenVentzi
Last active July 11, 2022 08:31
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 zenVentzi/e33338dcd6485e9f18e8bc076e74c692 to your computer and use it in GitHub Desktop.
Save zenVentzi/e33338dcd6485e9f18e8bc076e74c692 to your computer and use it in GitHub Desktop.
vim config file
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
" Install vim-plug if not found
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Run PlugInstall if there are missing plugins
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source $MYVIMRC
\| endif
call plug#begin()
Plug 'tpope/vim-sensible'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
" On-demand loading
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
call plug#end()
" colorscheme dracula
" colorscheme default
let mapleader = "\<Space>"
" nnoremap <F3> :e $MYVIMRC<CR>
let g:netrw_liststyle=3
set number relativenumber
autocmd FileType help setlocal number relativenumber
" autosave
"autocmd TextChanged,TextChangedI * silent! write
set autowriteall
set autoread
" copy from nvim to system clipboard
set clipboard+=unnamedplus
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
set nocompatible
" https://github.com/neovim/neovim/issues/6660#issuecomment-1001309688
" fix for ctrl-z freezes nvim
if has("win32") && has("nvim")
nnoremap <C-z> <nop>
inoremap <C-z> <nop>
vnoremap <C-z> <nop>
snoremap <C-z> <nop>
xnoremap <C-z> <nop>
cnoremap <C-z> <nop>
onoremap <C-z> <nop>
endif
" Map ctrl-movement keys to window switching
map <C-k> <C-w>k
map <C-j> <C-w>j
map <C-l> <C-w>l
map <C-h> <C-w>h
map <C-c> <C-w>c
"map <C-v> <C-w>v
map <C-s> <C-w>s
" Switch to alternate file
map <C-Tab> :bnext<CR>
map <C-S-Tab> :bprevious<CR>
"" Searching
set hlsearch
set incsearch
set ignorecase
set smartcase
set wrapscan "loop search
set cursorline " Highlight cursor line
" Change Working Directory to that of the current file
cmap cwd lcd %:p:h
cmap cd. lcd %:p:h
" set autochdir
map <leader>bg :set keymap=bulgarian-phonetic<CR>
inoremap jk <esc>
" set keymap=bulgarian-phonetic
"set foldmethod=indent
"set foldnestmax=2
" fold method {{{
augroup filetype_vim
autocmd!
autocmd FileType vim setlocal foldmethod=marker
autocmd FileType markdown setlocal foldmethod=indent
augroup END
" }}}
set shiftwidth=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment