Skip to content

Instantly share code, notes, and snippets.

@hedonhermdev
Created May 25, 2020 10:16
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 hedonhermdev/6a7d4bafec724d470843b5e6d2ab4d03 to your computer and use it in GitHub Desktop.
Save hedonhermdev/6a7d4bafec724d470843b5e6d2ab4d03 to your computer and use it in GitHub Desktop.
"" GENERAL OPTIONS --------------------------------------
filetype indent on " Enable file-type specific indentation
filetype plugin on " Enable plugins
syntax on
set title
" Tab == 4 spaces
set tabstop=4 " Number of visual spaces per TAB.
set softtabstop=4 " Number of spaces per TAB while editing.
set expandtab " Expand to 4 spaces when you press TAB.
set smarttab " Navigate by a TAB's width.
set autoindent " Automatically indent lines while editing.
" Numbering
set number " Show line number
set relativenumber " Show relative numbers
" Code Folding
set foldmethod=indent " Folding based on indentation.
set foldlevelstart=10 " Fold only long blocks of code.
set foldnestmax=10 " Folds can be nested, this ensures max 10 nested folds.
" Splitting Panes
set splitright " Open a new vertical split on the right
set splitbelow " Open a new vertical split below.
" Searching
set incsearch " Dynamically search while typing characters.
set hlsearch " Highlight occurences.
set ignorecase " Ignore case while searching with lowercase characters.
set smartcase " Check for case when using mixed case.
" Turn off swap files and backups.
set noswapfile
set nobackup
set nowritebackup
set wildmenu " Wildmenu for autocomplete in command mode.
"" KEYBINDINGS --------------------------
" Switching back to normal mode
inoremap jk <esc>
" Going to the end and the beginning of a line
nnoremap B ^
nnoremap E $
nnoremap $ <nop>
nnoremap ^ <nop>
" Navigating splits
nnoremap <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>
" Code folding
nnoremap <space> za
" Run Python files
autocmd filetype python nnoremap <buffer> <F5> :w<CR>:!clear;python %<CR>
" Run Nodejs files
autocmd filetype javascript nnoremap <buffer> <F5> :w<CR>:!clear;node %<CR>
"" COLORSCHEME ---------------------------
" Colors
colorscheme nord
"" PLUGIN OPTIONS -------------------------
" NERDTree
let g:NERDTreeWinPos = "right" " Open NERDTree on the right
map <C-n> :NERDTreeToggle<CR> " Use Ctrl+N to open/close NERDTree.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment