Skip to content

Instantly share code, notes, and snippets.

@Francesco149
Created July 11, 2017 18:28
Show Gist options
  • Save Francesco149/24b4007635ad0a13e1942bae795b777a to your computer and use it in GitHub Desktop.
Save Francesco149/24b4007635ad0a13e1942bae795b777a to your computer and use it in GitHub Desktop.
syntax on
set number
highlight LineNr ctermfg=darkgrey
set expandtab
set shiftwidth=4
set smarttab
set tabstop=4
set autoindent
set nowrap
" hl tabs and other kinds of whitespace I don't want
set listchars=tab:>~,nbsp:_,trail:.
set list
function UseTabs()
set noexpandtab
set listchars=tab:\ \ ,nbsp:_,trail:.
set softtabstop=4
endfunction
command! UseTabs call UseTabs()
function WideFile()
highlight ColorColumn ctermbg=334857348753
" just break the column colour so it's invisible
endfunction
" column width
function Columns(n)
set textwidth=0
let &colorcolumn=join(range(a:n + 1,999),",")
highlight ColorColumn ctermbg=8
endfunction
call Columns(67)
command! -nargs=1 Columns call Columns(<f-args>)
command! Nocolumns call WideFile()
" go and ebuilds want fucking tabs
" also most of ebuilds/apkbuilds are wide so disable column width
au Filetype go call UseTabs()
au BufRead,BufNewFile,BufEnter *.ebuild,APKBUILD,*pkg/*
\ call UseTabs() |
\ call WideFile() |
\ set syntax=sh
" fstab is usually wide
au BufRead,BufNewFile,Bufenter fstab call WideFile()
" hl all files that end in .Xresources
au BufRead,BufNewFile,BufEnter *.Xresources,*.xresources
\ set syntax=xdefaults
" F5 to remove trailing whitespace
nnoremap <silent> <F5>
\ :let _s=@/ <Bar>
\ :%s/\s\+$//e <Bar>
\ :let @/=_s <Bar>
\ :nohl <Bar>
\ :unlet _s <CR>
" shows what you're typing as a command
set showcmd
" fix backspace behaviour
set backspace=2
" fuzzy matches menu
set wildmenu
" makes find recursive
set path+=**
" tree view for file browser
let g:netrw_liststyle=3
command! Mktags !ctags -R .
" this generates tags for various programming languages
" with this we can jump to a tag with ^] or g^] to find ambiguous
" ones. we can also jump back by using ^t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment