Skip to content

Instantly share code, notes, and snippets.

@ajfisher
Last active October 16, 2023 03:30
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 ajfisher/4433283 to your computer and use it in GitHub Desktop.
Save ajfisher/4433283 to your computer and use it in GitHub Desktop.
My vimrc file
alias fritzing='~/fritzing/fritzing-0.8.0b.linux.AMD64/Fritzing'
alias avahi='avahi-browse --all'
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
# setup powerline
. /Users/andrew.fisher/.vim/bundle/powerline/powerline/bindings/bash/powerline.sh
# finish off general bash completion
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
# Git specific completion
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
# NVM helper functions
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# set up so we can execute node scripts locally to the project
export PATH=./node_modules/.bin:$PATH
# virtual env set up
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=`which python`
export VIRTUALENVWRAPPER_VIRTUALENV=`which virtualenv`
source /usr/local/bin/virtualenvwrapper.sh
node_modules
*.pyc
*.sw*
*.s*
!*.sh
!*.svg
!*.sls
.svg
.DS_Store
"--- .vimrc
"--- Requires:
"---- Vim Plug (https://github.com/junegunn/vim-plug)
"
"
" Disable compatibility with vi which can cause issues
set nocompatible
set t_Co=256
" turn on syntax highlighting
syntax on
" Enable plugins and load plugins and indent types for detected file types
filetype plugin indent on
" set up tabs and indents etc
set tabstop=4
set shiftwidth=4
set expandtab
set autoindent
set number " turn on line numbers
set numberwidth=4
set so=3 " number of lines to hold around the cursor when going up and down
set showcmd
set showmatch
set ignorecase
set hlsearch
set laststatus=2
set showtabline=2
set cursorline " highlight the line the cursor is on
set smarttab
set colorcolumn=80 " puts line at 80 char
set pastetoggle=<F2>
set bs=indent,eol,start "-- Backspace over everything in insert mode
set noswapfile
"--------Code folding --------------------
set foldmethod=indent
set foldlevel=99
"---- Other config ----------------
let mapleader = ","
let os = substitute(system('uname'), "\n", "", "")
" Turn off search highlighting using leader /
nnoremap <leader>/ :nohlsearch<CR>
" create and move tabs easily
map <leader>tn :tabnew<cr>
map <leader>tml :-tabmove<cr>
map <leader>tmr :+tabmove<cr>
"---- Set up all the plugin stuff
filetype off " required!
call plug#begin()
" Install relevant bundles.
Plug 'tpope/vim-fugitive'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'altercation/vim-colors-solarized'
Plug 'ntpeters/vim-better-whitespace'
Plug 'w0rp/ale'
Plug 'hashivim/vim-terraform'
Plug 'preservim/nerdtree'
Plug 'ryanoasis/vim-devicons'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()
filetype plugin indent on " required!
"---- Other config
" Navigate between windows
"---- Add custom syntax handling
au BufRead,BufNewFile *.pde set filetype=arduino
au BufRead,BufNewFile *.ino set filetype=arduino
" Air Line
let g:airline_powerline_fonts = 1
"---- Solarized
colorscheme solarized
set background=dark
highlight CursorLineNr ctermfg=red cterm=bold
set noshowmode "-- remove the bottom insert thingy
"---- ALE Linter
let g:ale_linters = { 'javascript': ['eslint'] }
let g:ale_fixers = { 'javascript': ['eslint'] }
let g:ale_open_list = 1
let g:ale_list_window_size = 3
let g:ale_lint_on_text_changed = 'never'
"---- NERDTree
" Toggle using control+e
nnoremap <C-e> :NERDTreeToggleVCS<CR>
let g:NERDTreeWinPos = "right"
let NERDTreeShowHidden=1
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" Have nerdtree ignore certain files and directories.
let NERDTreeIgnore=['\.git$', '\.jpg$', '\.mp4$', '\.ogg$', '\.iso$', '\.pdf$', '\.pyc$', '\.odt$', '\.png$', '\.gif$', '\.db$', '\.DS_Store$']
"---- Coc Autocompletion stuff
"
" Number of msec to wait for updates.
set updatetime=300
" Manage the plugins
let g:coc_global_extensions = [
\ 'coc-tsserver', 'coc-prettier', 'coc-pairs', 'coc-html', 'coc-json',
\ 'coc-css', 'coc-eslint', 'coc-markdownlint'
\ ]
"
" Use tab for trigger completion with characters ahead and navigate
" NOTE: There's always complete item selected by default, you may want to enable
" no select by `"suggest.noselect": true` in your configuration file
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" GoTo code navigation
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
"----- Set some basic file type configuration
autocmd FileType javascript setlocal sw=2 ts=2 expandtab
autocmd Filetype html setlocal ts=2 sw=2 expandtab
" add yaml stuff
au! BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml foldmethod=indent
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
# Files and set up for my envs to be consistent.
Solarized:
https://github.com/sigurdga/gnome-terminal-colors-solarized
Link .vimrc
ln ~/config/4433283/.vimrc ~/.vimrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment