Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "=======================
- "====== FILE TYPES =====
- "=======================
- au BufNewFile,BufRead *.yaml set filetype=yaml
- au BufNewFile,BufRead *.yml set filetype=yaml
- au BufNewFile,BufRead *.rs set filetype=rust
- autocmd BufNewFile,BufReadPost *.wast,*.wat setlocal filetype=wast
- "=============================
- "====== EDITOR SETTINGS ======
- "=============================
- set nocompatible "use things vi can't
- filetype indent plugin on "required, makes everything nicer
- set synmaxcol=319 "to help keep things from slowing down with long horizontal lines
- set hidden "stash unwritten files in buffer
- set noswapfile "no swap files because they suck
- set wildmenu "tabcomplete for some commands
- set showcmd "count highlighted
- set hlsearch "hightlight search results
- set ignorecase "ignore case when searching
- set smartcase "but don't ignore case if I use an uppercase letter
- set backspace=indent,eol,start "backspace over indents eol and sol
- set nostartofline "make some movements more intuitive regarding SoL
- set confirm "don't quietly fail because of unsaved file, ask first
- set cmdheight=2 "Number of lines to use for command line
- set autoread "update file when it is changed but not deleted in the filesystem
- set notimeout ttimeout ttimeoutlen=200 "timeout for key bindings
- "use F7 for formatting
- map <F7> mzgg=G`z`
- set nobackup "save on clutterish backup files
- set tabstop=2 "indent using a tab size of 2 spaces
- set softtabstop=2 "^^^
- set autoindent "^^^
- set shiftwidth=2 "^^^
- set noet "use tabs for indentation becasue tabs > spaces
- autocmd FileType * set noexpandtab "force noexpandtab for all file types
- colorscheme badwolf "set the colour scheme to badwolf
- set t_Co=256 "Make vim think we have all the colours!
- set cursorline "Be very obvious about what line you are on
- set nowrap "Don't wrap long lines
- set incsearch "incremental search for performance in larger files
- set wrapscan "wrap around the file when searching
- set list listchars=tab:\|\ "show tabs as |
- set list "load the list changes
- let mapleader=" " "set the mapleader character to space (%20)
- let g:indentLine_color_term = 239 "set the space indent colour
- set cc=150 "horizonal rule at the 150th character
- "====================================
- "====== EDITOR STATUS DISPLAYS ======
- "====================================
- set ruler "Display cursor position on last line of screen or in status line
- set number "show line number
- set relativenumber "for any line I'm not on show the line number relative to the cursour
- set laststatus=2 "always show status line
- set novisualbell "don't be annoying when I fuck up
- set title "Change the title of the terminal
- set history=1000 "Cap to a decent history size for cmd history
- hi NonText ctermbg=none
- hi Normal guibg=NONE ctermbg=NONE
- "=============================
- "====== SYNTAX SETTINGS ======
- "============================
- syntax on "syntax highlighting
- syntax sync minlines=256 "Life saving for large files and slow machines
- set synmaxcol=2048 "same as minlines but for how far out to hightlight lines
- set autoindent "keep code pretty and indented
- set smartindent "be even better about keeping code pretty
- "=========================================
- "====== MODIFY TERMINAL ENVIRONMENT ======
- "=========================================
- if &term =~ '256color'
- " disable Background Color Erase (BCE) so that color schemes
- " render properly when inside 256-color tmux and GNU screen.
- " see also http://snk.tuxfamily.org/log/vim-256color-bce.html
- set t_ut=
- endif
- "=================================
- "====== CUSTOM KEY BINDINGS ======
- "=================================
- "--------------------------
- "----disable arrow keys----
- "--------------------------
- noremap <up> <nop>
- inoremap <up> <nop>
- noremap <down> <nop>
- inoremap <down> <nop>
- noremap <left> <nop>
- noremap <right> <nop>
- inoremap <left> <nop>
- inoremap <right> <nop>
- " B A start
- " Joke shamelessly stolen from this blog post https://tylercipriani.com/blog/2017/06/14/literate-vimrc
- "------------------------------------
- "---- screen splitting shortcuts ----
- "------------------------------------
- nmap <Leader><bar> :vsplit<CR>
- "=============================
- "=============================
- "====== PLUGIN SETTINGS ======
- "=============================
- "------------------------
- "====Rainbow Brackets==== colours brackets by nesting level
- "------------------------
- let g:rainbow_active = 1 "enable rainbow brackets
- let g:paredit_mode = 1 "work with paredit plugin
- au VimEnter * RainbowParenthesesToggle "toggle it on when starting vim and vimrc has been loaded
- au Syntax * RainbowParenthesesLoadRound "load colours for round brackets for any syntax
- au Syntax * RainbowParenthesesLoadSquare "load colours for square brackets for any syntax
- au Syntax * RainbowParenthesesLoadBraces "load colours for braces for any syntax
- "because the template files have weird bracketing and make this plugin kill
- "vims speed
- autocmd FileType yaml let g:rainbow_active = 0
- autocmd FileType yaml let g:paredit_mode = 0
- autocmd FileType yaml au VimEnter * RainbowParenthesesToggle
- autocmd FileType yaml au Syntax * RainbowParenthesesLoadSquare "load colours for square brackets for any syntax
- autocmd FileType yaml au Syntax * RainbowParenthesesLoadBraces "load colours for braces for any syntax
- "------------------------
- "====airline settings==== "Lightweight status line enchancements
- "------------------------
- let g:airline_theme='badwolf' "Match the colour scheme
- let g:airline_exclude_preview = 1 "Don't show preview in a preview window
- let g:bufferline_echo = 0 "Don't echo the bufferline
- let g:airline#extensions#bufferline#enabled = 0 "Disable settings for use with bufferline
- let g:airline#extensions#branch#enabled = 1 "Enable git integration with vim fugitive
- let g:airline_detect_spell = 0 "Don't show if in spell mode or not
- let g:airline_powerline_fonts = 1 "Use the power line fonts (may need to patch fonts)
- "---------------------------
- "===Vim Clojure Highlight=== "A plugin to further highlight clj code
- "---------------------------
- autocmd BufRead *.clj try | silent! Require | catch /^Fireplace/ | endtry
- "------------------
- "======TagBar======
- "------------------
- "open / close the tag bar for navigation
- "Use this binding if you prefer the defautl behaviour of CTRL-T
- "nmap <Leader><t> :TagbarToggle<CR>
- nmap <C-T> :TagbarToggle<CR>
- "show line number and relative line number in tagbar window
- let g:tagbar_show_linenumbers = 3
- "-----------------
- "======Snipe======
- "-----------------
- "More accurate forward / backward jumping with f/F
- map f <Plug>(snipe-f)
- map F <plug>(snipe-F)
- "------------------------
- "=====LanguageClient=====
- "------------------------
- let g:LanguageClient_serverCommands = {
- \ 'rust': ['rustup', 'run', 'nightly', 'rls'],
- \ 'javascript': ['javascript-typescript-stdio'],
- \ 'javascript.jsx': ['javascript-typescript-stdio'],
- \ 'go': ['go-langserver'],
- \ 'golang': ['go-langserver']
- \ }
- "---------------
- "=====CtrlP=====
- "---------------
- let g:ctrlp_working_path_mode = 'ra'
- "--------------------------
- "=====Vim-Docker-Tools=====
- "--------------------------
- let g:dockertools_docker_host = 'unix:///var/run/docker.sock'
- let g:dockertools_user_key_mapping = {'ui-filter' : 'W'}
- "============================
- "=====Language Functions=====
- "============================
- "------------------------
- "=====Edit With Tabs=====
- "------------------------
- "For passed in filetype
- "Open file type and conver tabs to spaces
- "Before saving convert tabs back to spaces
- "After saving convert spaces back to tabs
- function! EditWithTabs(ft)
- execute "au BufRead " . a:ft . " %retab!"
- execute "au BufWritePre " . a:ft . " set expandtab"
- execute "au BufWritePre " . a:ft . " %retab!"
- execute "au BufWritePost " . a:ft . " set noexpandtab"
- execute "au BufWritePost " . a:ft . " %retab!"
- endfunction
- "===========================
- "=====Language Settings=====
- "===========================
- "----------------
- "=====Python=====
- "----------------
- call EditWithTabs("*.py")
- autocmd FileType python AutoFormatBuffer yapf
- autocmd FileType python match ErrorMsg '\%>120v.\+'
- autocmd FileType python match ErrorMsg '\%>120v.\+'
- autocmd FileType python noremap <silent> K :call LanguageClient_textDocument_hover()<CR>
- autocmd FileType python noremap <silent> gd :call LanguageClient_textDocument_definition()<CR>
- autocmd FileType python noremap <silent> <F2> :call LanguageClient_textDocument_rename()<CR>
- autocmd FileType python noremap <silent> <C-A-f> :call LanguageClient_textDocument_formatting()<CR>
- autocmd! FileType python packadd LanguageClient-neovim
- "--------------
- "=====Yaml=====
- "--------------
- call EditWithTabs('*.yaml')
- call EditWithTabs('*.yml')
- "------------
- "=====Go=====
- "------------
- autocmd! FileType go packadd gopack
- autocmd FileType go AutoFormatBuffer gofmt
- autocmd FileType go noremap <silent> K :call LanguageClient_textDocument_hover()<CR>
- autocmd FileType go noremap <silent> gd :call LanguageClient_textDocument_definition()<CR>
- autocmd FileType go noremap <silent> <F2> :call LanguageClient_textDocument_rename()<CR>
- autocmd FileType go noremap <silent> <C-A-f> :call LanguageClient_textDocument_formatting()<CR>
- autocmd FileType go let g:tagbar_type_go = {
- \ 'ctagstype' : 'go',
- \ 'kinds' : [
- \ 'p:package',
- \ 'i:imports:1',
- \ 'c:constants',
- \ 'v:variables',
- \ 't:types',
- \ 'n:interfaces',
- \ 'w:fields',
- \ 'e:embedded',
- \ 'm:methods',
- \ 'r:constructor',
- \ 'f:functions'
- \ ],
- \ 'sro' : '.',
- \ 'kind2scope' : {
- \ 't' : 'ctype',
- \ 'n' : 'ntype'
- \ },
- \ 'scope2kind' : {
- \ 'ctype' : 't',
- \ 'ntype' : 'n'
- \ },
- \ 'ctagsbin' : 'gotags',
- \ 'ctagsargs' : '-sort -silent'
- \ }
- "===============
- "==== RUST =====
- "===============
- autocmd FileType rust packadd rustpack
- "================
- "===== WASM =====
- "================
- autocmd FileType wast packadd wasmpack
- "-----------------
- "=====Clojure=====
- "-----------------
- autocmd FileType clojure packadd clojure
- "=====================
- "===== Help Tags =====
- "=====================
- silent! helptags ALL
- "=====================================
- "===== END OF VIMRC REQUIREMENTS =====
- "=====================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement