Skip to content

Instantly share code, notes, and snippets.

@cpp-johnny
Created February 9, 2023 13:24
Show Gist options
  • Save cpp-johnny/985bd774880ec27ee165ea133e7e76e4 to your computer and use it in GitHub Desktop.
Save cpp-johnny/985bd774880ec27ee165ea133e7e76e4 to your computer and use it in GitHub Desktop.
ChatGPT generated .vimrc config
" Basic settings
set nocompatible " Make Vim behave like a modern text editor
set encoding=UTF-8 " Use UTF-8 encoding
set backspace=indent,eol,start " Make backspace work like most people expect
set ruler " Show the cursor position all the time
set number " Show line numbers
set tabstop=4 " Set the width of a tab to 4 spaces
set shiftwidth=4 " Set the width of auto-indentation to 4 spaces
set expandtab " Use spaces instead of tabs
set hlsearch " Highlight search results
set ignorecase " Ignore case when searching
set incsearch " Show search results as you type
set autoread " Automatically reload files that have changed outside of Vim
" Visual enhancements
set cursorline " Highlight the current line
set colorcolumn=80 " Highlight column 80 as a visual guide
syntax on " Enable syntax highlighting
" Keyboard mappings
nnoremap <C-j> <C-w>j " Map Ctrl+j to switch to the window below the current one
nnoremap <C-k> <C-w>k " Map Ctrl+k to switch to the window above the current one
nnoremap <C-l> <C-w>l " Map Ctrl+l to switch to the window to the right of the current one
nnoremap <C-h> <C-w>h " Map Ctrl+h to switch to the window to the left of the current one
" Plugins
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-sensible' " A set of sensible defaults for Vim
Plug 'scrooloose/nerdtree' " A file explorer for Vim
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } " A fuzzy finder for Vim
Plug 'vim-airline/vim-airline' " A lean and mean status line for Vim
Plug 'vim-airline/vim-airline-themes' " A collection of themes for Vim-Airline
call plug#end()
" Initialize airline and set a theme
let g:airline_powerline_fonts = 1
set laststatus=2
let g:airline_theme='luna'
" Initialize NERDTree
map <C-n> :NERDTreeToggle<CR>
" Initialize fzf
map <C-f> :FZF<CR>
" Custom commands
command! Lint :w<CR>:!eslint %<CR> " Save the current file and run eslint on it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment