Skip to content

Instantly share code, notes, and snippets.

@donfreiday
Created February 14, 2024 15:16
Show Gist options
  • Save donfreiday/f782d18c901d6b0b27fe1850dfde169e to your computer and use it in GitHub Desktop.
Save donfreiday/f782d18c901d6b0b27fe1850dfde169e to your computer and use it in GitHub Desktop.
.vimrc
"Install plugin management via vim-plug if not already installed
"https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" PLUGINS
call plug#begin('~/.vim/plugged')
"Auto-completion via vim-lsc with added features from VimCompleteMe,
"run :PlugInstall to install (handled by above command upon initial install)
Plug 'natebosch/vim-lsc'
Plug 'ajh17/VimCompletesMe'
Plug 'preservim/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'dense-analysis/ale'
Plug 'arzg/vim-colors-xcode'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'terryma/vim-multiple-cursors'
Plug 'tommcdo/vim-exchange'
Plug 'machakann/vim-highlightedyank'
Plug 'junegunn/fzf.vim'
Plug 'martinda/Jenkinsfile-vim-syntax'
Plug 'ledger/vim-ledger'
" Initialize plugin system
call plug#end()
colorscheme xcodedark
" Use all the default keymaps for autocomplete
let g:lsc_auto_map = v:true
" Don't forget to install the relevant language servers
" npm i -g bash-language-server
" https://github.com/bash-lsp/bash-language-server
"
" Map a filetype to the command that starts the language server for that
" filetype in your vimrc:
let g:lsc_server_commands = {'bash': 'bash-language-server'}
" Set indent
filetype indent on
set shiftwidth=4
set tabstop=4
set expandtab
" Show title in window
set title
"Preview commands
set showcmd
" Set to auto read when a file is changed from the outside
set autoread
au FocusGained,BufEnter * checktime
" Ignore case when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Enable incremental search
set incsearch
" Enable syntax highlighting
syntax enable
" Always show the status line
set laststatus=2
" Format the status line
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l\ \ Column:\ %c
" Copy to system clipboard
set clipboard=unnamedplus
" Show line numbers
set number
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Helper functions
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Returns true if paste mode is enabled
function! HasPaste()
if &paste
return 'PASTE MODE '
endif
return ''
endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Keybinds
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
imap jk <Esc>
imap jj <Esc>o
" Normal mode mapping
nnoremap <A-1> :NERDTreeToggle<CR>
" Insert mode mapping
inoremap <A-1> <C-o>:NERDTreeToggle<CR>
" Normal mode mapping
nnoremap <C-S-f> :Rg<CR>
" Insert mode mapping
inoremap <C-S-f> <C-o>:Rg<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment