Last active
February 28, 2021 20:20
-
-
Save creativenull/65fda0d93bc93007917be4a6cb864d92 to your computer and use it in GitHub Desktop.
The bare bones, bring your own plugin manager, theme, vim configuration - opinionated of course
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Minimal vim config | |
" ============================================================================= | |
filetype plugin indent on | |
" ============================================================================= | |
" = Plugin Manager = | |
" ============================================================================= | |
" Use any plugin manager here | |
" ============================================================================= | |
" = Theming and Looks = | |
" ============================================================================= | |
syntax on | |
set number | |
set relativenumber | |
set termguicolors | |
" Uncomment the line below, to set an installed theme - replace <name> with colorscheme name | |
" colorscheme <name> | |
" ============================================================================= | |
" = Options = | |
" ============================================================================= | |
set encoding=utf8 | |
" Completion options | |
set completeopt=menuone,noinsert,noselect | |
set shortmess+=c | |
" Search options | |
set hlsearch | |
set incsearch | |
set ignorecase | |
set smartcase | |
" Indent options | |
set shiftwidth=4 | |
set softtabstop=4 | |
set tabstop=4 | |
set expandtab | |
set autoindent | |
set smartindent | |
" Line options | |
set showmatch | |
set linebreak | |
set showbreak=+++ | |
set textwidth=120 | |
set colorcolumn=120 | |
set scrolloff=5 | |
" Move backups and swapdfiles to cache | |
set dir=~/.cache/nvim | |
set backup | |
set backupdir=~/.cache/nvim | |
" Persist an undo even after closing vim | |
set undofile | |
set undodir=~/.cache/nvim | |
set undolevels=1000 | |
set history=1000 | |
" Lazy redraw | |
set complete-=i | |
set lazyredraw | |
" Buffers/Tabs/Windows | |
set hidden | |
" spelling | |
set nospell | |
" For git | |
set signcolumn=yes | |
" Mouse support | |
set mouse=a | |
" File format type | |
set fileformats=unix | |
" backspace behaviour | |
set backspace=indent,eol,start | |
" Status line | |
set noshowmode | |
set laststatus=2 | |
" Better display | |
set cmdheight=2 | |
" Auto reload file if changed outside vim, or just :e! | |
set autoread | |
" ============================================================================= | |
" = Keybindings = | |
" ============================================================================= | |
let mapleader = ' ' | |
" Unbind default bindings for arrow keys, trust me this is for your own good | |
vnoremap <up> <nop> | |
vnoremap <down> <nop> | |
vnoremap <left> <nop> | |
vnoremap <right> <nop> | |
inoremap <up> <nop> | |
inoremap <down> <nop> | |
inoremap <left> <nop> | |
inoremap <right> <nop> | |
" Map Esc, to perform quick switching between Normal and Insert mode | |
inoremap jk <ESC> | |
" Map escape from terminal input to Normal mode | |
tnoremap <ESC> <C-\><C-n> | |
tnoremap <C-[> <C-\><C-n> | |
" Copy/Paste from the system clipboard | |
" Uncomment if you want to do copy paste normally | |
" vnoremap <C-c> "+y<CR> | |
" nnoremap <C-v> "+p<CR> | |
" Builtin File explorer | |
noremap <F3> :Ex<CR> | |
" Manual completion | |
imap <C-Space> <C-x><C-o> | |
" Disable highlights | |
nnoremap <leader><CR> :noh<CR> | |
" Buffer maps | |
" You can remap them to any other keys | |
nnoremap <leader>bl :buffers<CR> | |
" Go to next buffer | |
nnoremap <C-l> :bnext<CR> | |
" Go to previous buffer | |
nnoremap <C-h> :bprevious<CR> | |
" Close the current buffer | |
nnoremap <leader>bd :bp<BAR>sp<BAR>bn<BAR>bd<CR> | |
" Resize window panes, we can use those arrow keys | |
" to help use resize windows - at least we give them some purpose | |
nnoremap <up> :resize +2<CR> | |
nnoremap <down> :resize -2<CR> | |
nnoremap <left> :vertical resize -2<CR> | |
nnoremap <right> :vertical resize +2<CR> | |
" Move a line of text Alt+[j/k] | |
nnoremap <M-j> mz:m+<CR>`z | |
nnoremap <M-k> mz:m-2<CR>`z | |
vnoremap <M-j> :m'>+<CR>`<my`>mzgv`yo`z | |
vnoremap <M-k> :m'<-2<CR>`>my`<mzgv`yo`z | |
" Edit the config file | |
nnoremap <leader>ve :e $MYVIMRC<CR> | |
" Source the config file | |
nnoremap <leader>vs :so $MYVIMRC<CR> | |
" Reload file | |
nnoremap <leader>r :e!<CR> | |
" ============================================================================= | |
" = Commands = | |
" ============================================================================= | |
command! Config edit $MYVIMRC | |
command! ConfigReload so $MYVIMRC | |
" Don't make mistakes, there are no such thing :) | |
command! -nargs=* W w | |
command! -nargs=* Wq wq | |
command! -nargs=* WQ wq | |
command! -nargs=* Q q | |
command! -nargs=* Qa qa | |
command! -nargs=* QA qa |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment