From 188cc44f0d8b090caa740fa7e9b6a197df38b88f Mon Sep 17 00:00:00 2001 From: Mitch Riedstra Date: Mon, 29 Oct 2018 00:01:44 -0400 Subject: massive refactor of my vimrc --- .gitignore | 1 + basic.vim | 19 +---- basic.vim.txt | 1 + inc/airline.vim | 15 ++++ inc/basics.vim | 41 ++++++++++ inc/ctrlp.vim | 2 + inc/filetype-options.vim | 98 ++++++++++++++++++++++++ inc/rebinds.vim | 12 +++ inc/undo.vim | 10 +++ init.vim | 196 ++--------------------------------------------- 10 files changed, 187 insertions(+), 208 deletions(-) mode change 100644 => 120000 basic.vim create mode 120000 basic.vim.txt create mode 100644 inc/airline.vim create mode 100644 inc/basics.vim create mode 100644 inc/ctrlp.vim create mode 100644 inc/filetype-options.vim create mode 100644 inc/rebinds.vim create mode 100644 inc/undo.vim diff --git a/.gitignore b/.gitignore index 0282878..d79e28e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /bundle /themes +.netrwhist diff --git a/basic.vim b/basic.vim deleted file mode 100644 index 73c040d..0000000 --- a/basic.vim +++ /dev/null @@ -1,18 +0,0 @@ -" Basic vimrc for systems you don't want to copy the full one to -set background=dark -nmap n :set invnu -set nu -set encoding=utf-8 -nmap l :set list! -set listchars=tab:▸\ ,eol:¬,trail:• -set colorcolumn=80 -set fileencoding=utf-8 -set ic -set hls -set updatecount=0 -set nocompatible -set tabstop=4 -set shiftwidth=4 -set noexpandtab -set mouse+=a -syntax on diff --git a/basic.vim b/basic.vim new file mode 120000 index 0000000..c530766 --- /dev/null +++ b/basic.vim @@ -0,0 +1 @@ +inc/basics.vim \ No newline at end of file diff --git a/basic.vim.txt b/basic.vim.txt new file mode 120000 index 0000000..c530766 --- /dev/null +++ b/basic.vim.txt @@ -0,0 +1 @@ +inc/basics.vim \ No newline at end of file diff --git a/inc/airline.vim b/inc/airline.vim new file mode 100644 index 0000000..4486d50 --- /dev/null +++ b/inc/airline.vim @@ -0,0 +1,15 @@ +" Always show status line +" set laststatus=2 + +" Enable the list of buffers +let g:airline#extensions#tabline#enabled = 1 + +" Show just the filename +let g:airline#extensions#tabline#fnamemod = ':t' + +if !exists('g:airline_symbols') + let g:airline_symbols = {} +endif +let g:airline_symbols.space = "\ua0" + +let g:airline_section_z = airline#section#create(['windowswap', '%3p%% ', 'linenr', ':%3v']) diff --git a/inc/basics.vim b/inc/basics.vim new file mode 100644 index 0000000..2110578 --- /dev/null +++ b/inc/basics.vim @@ -0,0 +1,41 @@ +" Basic vimrc for systems you don't want to copy the full one to +set encoding=utf-8 " The encoding displayed. +set fileencoding=utf-8 " The encoding written to file. +set background=dark " Since most terminals I have dark backgrounds +set nu " Line 'nu'mbers +set listchars=tab:▸\ ,eol:¬,trail:• " Listchars are used to show normally + " invisible chars such as tabs, EOL and + " trailing whitespace +" set listchars=tab:\|\ " Alternative listchars w/o special chars. +set colorcolumn=80 " Sets a "coloured" coloumn to tell you where your line + " breaks should be so you don't piss off people using + " a terminal. +set ic " Case insensitive search by default +set hls " Highlight my searches by default +set updatecount=0 " Do not write swap files +set nocompatible " Don't be compatbile with 'vi' +set tabstop=4 " Tab width +set shiftwidth=4 +set noexpandtab " Do **NOT** turn tabs into spaces by default +" Be smart about the mouse +set mouse+=a +if &term =~ '^screen' + " tmux knows the extended mouse mode + set ttymouse=xterm2 +endif +syntax on " Syntax highlighting by default + + +set nomodeline " I know how to setup my editor, I don't need your + " changes to my vim configuration. + +" Use \-n in normal mode to toggle line numbers +nmap n :set invnu +" Use \-l in normal mode to toggle listchars +nmap l :set list! + +" set hidden " This will allow you to change buffers w/o saving + +" Omni completion, c-x c-o in insert/append mode +" filetype plugin on +" set omnifunc=syntaxcomplete#Complete diff --git a/inc/ctrlp.vim b/inc/ctrlp.vim new file mode 100644 index 0000000..515a5d2 --- /dev/null +++ b/inc/ctrlp.vim @@ -0,0 +1,2 @@ +let g:ctrlp_follow_symlinks = 1 +let g:ctrlp_working_path_mode = 0 diff --git a/inc/filetype-options.vim b/inc/filetype-options.vim new file mode 100644 index 0000000..97e5bdd --- /dev/null +++ b/inc/filetype-options.vim @@ -0,0 +1,98 @@ +function! PhpSyntaxOverride() + hi! def link phpDocTags phpDefine + hi! def link phpDocParam phpType +endfunction + +augroup phpSyntaxOverride + autocmd! + autocmd FileType php call PhpSyntaxOverride() +augroup END + +" This is specifically for Salt's state files 'sls' +autocmd BufNewFile,BufRead *.sls set filetype=yaml + +autocmd Filetype python call SetPythonOptions() +autocmd Filetype htmldjango call SethtmldjangoOptions() +autocmd Filetype json call SetJsonOptions() +autocmd Filetype javascript call SetjavascriptOptions() +autocmd Filetype php call SetPHPOptions() +autocmd Filetype html call SetHTMLOptions() +autocmd Filetype sh call SetShellOptions() +autocmd Filetype go call SetGoOptions() +autocmd Filetype yaml call SetYamlOptions() +autocmd Filetype markdown call SetMarkdownOptions() + +function SetMarkdownOptions() + set spell + set tabstop=2 + set shiftwidth=2 + set expandtab + AcpDisable +endfunction +function SetPythonOptions() + set tabstop=4 + set shiftwidth=4 + set expandtab + filetype indent on + set smartindent +endfunction +function SetjavascriptOptions() + set tabstop=2 + set shiftwidth=2 + set expandtab + filetype indent on + set smartindent +endfunction +function SetJsonOptions() + set tabstop=3 + set shiftwidth=3 + set expandtab + filetype indent on + set smartindent +endfunction +function SethtmldjangoOptions() + set tabstop=2 + set shiftwidth=2 + set expandtab + filetype indent on + set smartindent +endfunction +function SetPHPOptions() + set colorcolumn=120 + set tabstop=4 + set shiftwidth=4 + set expandtab + filetype indent on + set smartindent +endfunction +function SetHTMLOptions() + set colorcolumn=120 + set tabstop=2 + set shiftwidth=2 + set expandtab + filetype indent on + set smartindent +endfunction +function SetShellOptions() + set tabstop=4 + set shiftwidth=4 + set noexpandtab + filetype indent on + set smartindent +endfunction +function SetGoOptions() + set tabstop=8 + set noexpandtab + # The ACP is pretty slow with my Go plugins enabled + AcpDisable + set nolist + set noic + set nolist +endfunction +function SetYamlOptions() + set tabstop=2 + set shiftwidth=2 + set expandtab + set expandtab + set noic +endfunction diff --git a/inc/rebinds.vim b/inc/rebinds.vim new file mode 100644 index 0000000..4debb51 --- /dev/null +++ b/inc/rebinds.vim @@ -0,0 +1,12 @@ +" Keep the newbs from using arrow keys +inoremap +inoremap +inoremap +inoremap + +map :NERDTreeToggle + +" To enable/disable the autocomplete dropdown +nmap [ :AcpDisable +nmap ] :AcpEnable + diff --git a/inc/undo.vim b/inc/undo.vim new file mode 100644 index 0000000..78c7e48 --- /dev/null +++ b/inc/undo.vim @@ -0,0 +1,10 @@ +" Persistent undo +set undofile +set undodir=~/.vimundo +set undolevels=1000 +set undoreload=10000 + +" lots of history, it's always nice to find old nasty command that happen +" to be really useful +set history=10000 +" diff --git a/init.vim b/init.vim index fae6d29..9c7a982 100644 --- a/init.vim +++ b/init.vim @@ -1,201 +1,17 @@ -set encoding=utf-8 " The encoding displayed. -set fileencoding=utf-8 " The encoding written to file. - -set colorcolumn=80 - -" Apparently there are security issues with this? -set nomodeline - execute pathogen#infect('bundle/{}', 'themes/{}') -" Allow me to hide buffers w/o saving -" set hidden - -" Persistent undo -set undofile -set undodir=~/.vimundo -set undolevels=1000 -set undoreload=10000 - -" lots of history, it's always nice to find old nasty command that happen -" to be really useful -set history=10000 -" -" Keep the newbs from using arrow keys -inoremap -inoremap -inoremap -inoremap - -" Always show status line -" set laststatus=2 - -" Case insensitive searching by default -set ic -" Highlight my searches by default -set hls - -" No more swap files -set updatecount=0 - -" Vi in-compatibility -set nocompatible - -" Bring down the tab spacing -set tabstop=4 -set shiftwidth=4 -set noexpandtab - -map :NERDTreeToggle - -" To enable/disable the autocomplete dropdown -nmap [ :AcpDisable -nmap ] :AcpEnable +source ~/.vim/inc/basics.vim +source ~/.vim/inc/rebinds.vim +source ~/.vim/inc/undo.vim +source ~/.vim/inc/filetype-options.vim +source ~/.vim/inc/airline.vim +source ~/.vim/inc/ctrlp.vim " Omni completion filetype plugin on set omnifunc=syntaxcomplete#Complete -let g:ctrlp_follow_symlinks = 1 -let g:ctrlp_working_path_mode = 0 - -" Enable the list of buffers -let g:airline#extensions#tabline#enabled = 1 -" Show just the filename -let g:airline#extensions#tabline#fnamemod = ':t' - -if !exists('g:airline_symbols') - let g:airline_symbols = {} -endif -let g:airline_symbols.space = "\ua0" - -let g:airline_section_z = airline#section#create(['windowswap', '%3p%% ', 'linenr', ':%3v']) - - -autocmd Filetype python call SetPythonOptions() -autocmd Filetype htmldjango call SethtmldjangoOptions() -autocmd Filetype json call SetJsonOptions() -autocmd Filetype javascript call SetjavascriptOptions() -autocmd Filetype php call SetPHPOptions() -autocmd Filetype html call SetHTMLOptions() -autocmd Filetype sh call SetShellOptions() -autocmd Filetype go call SetGoOptions() -autocmd Filetype yaml call SetYamlOptions() -autocmd Filetype markdown call SetMarkdownOptions() - -function SetMarkdownOptions() - set spell - set tabstop=2 - set shiftwidth=2 - set expandtab - AcpDisable -endfunction -function SetPythonOptions() - set tabstop=4 - set shiftwidth=4 - set expandtab - filetype indent on - set smartindent -endfunction -function SetjavascriptOptions() - set tabstop=2 - set shiftwidth=2 - set expandtab - filetype indent on - set smartindent -endfunction -function SetJsonOptions() - set tabstop=3 - set shiftwidth=3 - set expandtab - filetype indent on - set smartindent -endfunction -function SethtmldjangoOptions() - set tabstop=2 - set shiftwidth=2 - set expandtab - filetype indent on - set smartindent -endfunction -function SetPHPOptions() - set colorcolumn=120 - set tabstop=4 - set shiftwidth=4 - set expandtab - filetype indent on - set smartindent -endfunction -function SetHTMLOptions() - set colorcolumn=120 - set tabstop=2 - set shiftwidth=2 - set expandtab - filetype indent on - set smartindent -endfunction -function SetShellOptions() - set tabstop=4 - set shiftwidth=4 - set noexpandtab - filetype indent on - set smartindent -endfunction -function SetGoOptions() - set tabstop=8 - set noexpandtab - # The ACP is pretty slow with my Go plugins enabled - AcpDisable - set nolist - set noic - set nolist -endfunction -function SetYamlOptions() - " set listchars=tab:▸\ ,eol:¬,trail:•,space:· - set tabstop=2 - set shiftwidth=2 - set expandtab - set listchars=tab:▸\ ,eol:¬,trail:• - set expandtab - set noic -endfunction - -" This is specifically for Salt's state files 'sls' -autocmd BufNewFile,BufRead *.sls set filetype=yaml - - -function! PhpSyntaxOverride() - hi! def link phpDocTags phpDefine - hi! def link phpDocParam phpType -endfunction - -augroup phpSyntaxOverride - autocmd! - autocmd FileType php call PhpSyntaxOverride() -augroup END -" Backslash l -nmap l :set list! -" If you want listchars set list -" If you don't have a UTF8 compatible terminal you'll want to use this line -" instead -" set listchars=tab:\|\ -set listchars=tab:▸\ ,eol:¬,trail:• - -" Be smart about the mouse -set mouse+=a -if &term =~ '^screen' - " tmux knows the extended mouse mode - set ttymouse=xterm2 -endif - - -" Line numbers -set nu -" Backslash-n ( \-n ) will toggle line numbers on and off -nmap n :set invnu -" Derp -syntax on colorscheme distinguished -- cgit v1.2.3