Skip to content

Instantly share code, notes, and snippets.

@codeslinger
Created March 4, 2024 15:15
Show Gist options
  • Select an option

  • Save codeslinger/3fffc4fc19359484134d2d2cd6bd0a56 to your computer and use it in GitHub Desktop.

Select an option

Save codeslinger/3fffc4fc19359484134d2d2cd6bd0a56 to your computer and use it in GitHub Desktop.

Revisions

  1. codeslinger created this gist Mar 4, 2024.
    104 changes: 104 additions & 0 deletions .vimrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,104 @@
    set nocompatible
    filetype off

    set rtp+=~/.vim/bundle/Vundle.vim
    call vundle#begin()
    Plugin 'gmarik/Vundle.vim'
    Plugin 'ElmCast/elm-vim'
    Plugin 'cespare/vim-toml'
    Plugin 'ctrlpvim/ctrlp.vim'
    Plugin 'elixir-lang/vim-elixir'
    Plugin 'elzr/vim-json'
    Plugin 'fatih/vim-go'
    Plugin 'flazz/vim-colorschemes'
    Plugin 'jnwhiteh/vim-golang'
    Plugin 'pangloss/vim-javascript'
    Plugin 'rking/ag.vim'
    Plugin 'uarun/vim-protobuf'
    Plugin 'vim-airline/vim-airline'
    Plugin 'vim-airline/vim-airline-themes'
    Plugin 'vim-ruby/vim-ruby'
    Plugin 'rust-lang/rust.vim'
    Plugin 'jakwings/vim-pony'
    Plugin 'prabirshrestha/async.vim'
    Plugin 'prabirshrestha/vim-lsp'
    Plugin 'mattn/vim-lsp-settings'
    call vundle#end()
    filetype plugin indent on

    set backspace=indent,eol,start
    set tabstop=2
    set shiftwidth=2
    set expandtab
    set autoindent
    set textwidth=0
    set nobackup
    set viminfo='20,\"50
    set history=50
    set ruler
    set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
    set ignorecase
    set hlsearch
    set smartcase
    set showmatch
    set showcmd
    set laststatus=2
    set nojoinspaces
    set keywordprg=dict
    set background=dark
    set sh=/bin/bash
    set matchpairs=(:),{:},[:],<:>
    set printoptions=paper:Letter
    set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/tmp/cache/*
    set magic
    set number
    syntax on

    " Make p in Visual mode replace the selected text with the "" register.
    vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>
    au Filetype go setlocal ts=4 noet ai
    au BufRead,BufNewFile *.rs setfiletype rust
    au BufNewFile,BufReadPost *.md set filetype=markdown

    if isdirectory(expand("~/.vim/bundle/ctrlp.vim/"))
    let g:ctrlp_map = '<c-p>'
    let g:ctrlp_cmd = 'CtrlP'
    let g:ctrlp_working_path_mode = 'ra'
    let g:ctrlp_prompt_mappings = {
    \ 'AcceptSelection("e")': [],
    \ 'AcceptSelection("t")': ['<cr>', '<c-m>'],
    \ }
    if executable('ag')
    let s:ctrlp_fallback = 'ag %s --nocolor -l -g ""'
    elseif executable('ack-grep')
    let s:ctrlp_fallback = 'ack-grep %s --nocolor -f'
    elseif executable('ack')
    let s:ctrlp_fallback = 'ack %s --nocolor -f'
    else
    let s:ctrlp_fallback = 'find %s -type f'
    endif
    let g:ctrlp_user_command = {
    \ 'types': {
    \ 1: ['.git', 'cd %s && git ls-files . --cached --exclude-standard --others'],
    \ 2: ['.hg', 'hg --cwd %s locate -I .'],
    \ },
    \ 'fallback': s:ctrlp_fallback
    \ }
    endif

    if isdirectory(expand("~/.vim/bundle/vim-airline/"))
    let g:airline_detect_whitespace=0
    let g:airline_theme="wombat"
    let g:airline_left_sep='' " Slightly fancier than '>'
    let g:airline_right_sep='' " Slightly fancier than '<'
    endif

    map ., :tabp<CR>
    map ,. :tabn<CR>
    map TT :tabnew
    let g:go_fmt_command = "/Users/toby/gopath/bin/goimports"
    let g:autofmt_autosave = 1
    let g:lsp_signs_enabled = 1
    let g:lsp_diagnostics_echo_cursor = 1