Skip to content

Instantly share code, notes, and snippets.

@creativenull
Last active March 21, 2021 03:34
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 creativenull/0429aee83caba01a2176c8527ca4d8fb to your computer and use it in GitHub Desktop.
Save creativenull/0429aee83caba01a2176c8527ca4d8fb to your computer and use it in GitHub Desktop.
Simple init.vim config file for converting into init.lua
" =============================================================================
" = Utils/Functions =
" =============================================================================
function! CursorMode() abort
if mode() == 'n'
return 'NORMAL'
elseif mode() == 'i'
return 'INSERT'
elseif mode() == 'c'
return 'COMMAND'
elseif mode() == 'v' || mode() == 'V' || mode() == ''
return 'VISUAL'
elseif mode() == 'R' || mode() == 'Rv' || mode() == 'Rx'
return 'REPLACE'
endif
endfunction
" =============================================================================
" = Auto Commands =
" =============================================================================
augroup set_invisible_chars
au!
au FileType help set nolist
au FileType fzf set nolist
augroup end
" =============================================================================
" = Plugins =
" =============================================================================
call plug#begin(stdpath('data') . '/plugged')
Plug 'tpope/vim-surround'
Plug 'srcery-colors/srcery-vim'
call plug#end()
" =============================================================================
" = Theming and Looks =
" =============================================================================
set number
set relativenumber
set termguicolors
colorscheme srcery
" =============================================================================
" = Options =
" =============================================================================
" Completion options
set completeopt=menuone,noinsert,noselect
set updatetime=100
" Search options
set ignorecase
set smartcase
set expandtab
set wrapscan
" Indent options
set tabstop=4
set shiftwidth=0
set softtabstop=4
set expandtab
set smartindent
" Line options
set showmatch
set showbreak=+++
set textwidth=120
set scrolloff=5
set linebreak
set colorcolumn=120
set signcolumn='yes'
" Move swapfiles and backupfiles into ~/.cache
set swapfile
set directory=expand('$HOME/.cache/nvim')
set backup
set backupdir=expand('$HOME/.cache/nvim')
" Undo even after closing vim
set undofile
set undodir=expand('$HOME/.cache/nvim')
set undolevels=10000
set history=10000
" Enable a little bit performance
set lazyredraw
" Buffers/Tabs/Windows
set hidden
" Backspace Behaviour
set backspace=indent,eol,start
" Status line
set noshowmode
set statusline=\ %{CursorMode()} %{expand("%:t")} %m%y %=%l/%L\
" Better command display
set cmdheight=2
set list
set listchars=tab:▸\ ,trail:·,space:·
" =============================================================================
" = Keybindings =
" =============================================================================
" Leader key
let mapleader=' '
" Map Esc, to perform quick switching between Normal and Insert mode
inoremap jk <ESC>
" Open built-in file explorer
nnoremap <F3> :Ex<CR>
" Edit vimrc
nnoremap <leader>ve :edit $MYVIMRC<CR>
" Source the vimrc to reflect changes
nnoremap <leader>vs :source $MYVIMRC<CR>
" =============================================================================
" = Commands =
" =============================================================================
command! Config edit $MYVIMRC
command! ConfigReload source $MYVIMRC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment