diff --git a/.gitmodules b/.gitmodules index e2e686e..46ad99d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,27 +1,3 @@ -[submodule "vim/autoload/vim-pathogen"] - path = vim/autoload/vim-pathogen - url = https://github.com/tpope/vim-pathogen -[submodule "vim/bundle/delimitMate"] - path = vim/bundle/delimitMate - url = https://github.com/Raimondi/delimitMate.git -[submodule "vim/bundle/vim-fugitive"] - path = vim/bundle/vim-fugitive - url = https://github.com/tpope/vim-fugitive.git -[submodule "vim/bundle/nerdtree"] - path = vim/bundle/nerdtree - url = https://github.com/scrooloose/nerdtree.git -[submodule "vim/bundle/vim-sensible"] - path = vim/bundle/vim-sensible - url = https://github.com/tpope/vim-sensible.git -[submodule "vim/bundle/vim-colors-solarized"] - path = vim/bundle/vim-colors-solarized - url = https://github.com/altercation/vim-colors-solarized.git -[submodule "vim/bundle/syntastic"] - path = vim/bundle/syntastic - url = https://github.com/scrooloose/syntastic.git -[submodule "vim/bundle/gruvbox"] - path = vim/bundle/gruvbox - url = https://github.com/morhetz/gruvbox.git [submodule "neovim/pack/vendor/start/oil.nvim"] path = neovim/pack/vendor/start/oil.nvim url = https://github.com/stevearc/oil.nvim diff --git a/bootstrap.sh b/bootstrap.sh index ba68377..3a0c4ee 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -36,16 +36,19 @@ chmod 640 $HOME/.gnupg/common.conf chmod 640 $HOME/.gnupg/dirmngr.conf chmod 640 $HOME/.gnupg/gpg.conf -# ln vim files -echo "Setting up vim" -test -d $HOME/.vim && rm -rf $HOME/.vim -ln -s $BASEDIR/vim $HOME/.vim -test -L $HOME/.vimrc || ln -f -s $HOME/.vim/vimrc $HOME/.vimrc - echo "Setting up NeoVim" test -d $HOME/.config/nvim && rm -rf $HOME/.config/nvim ln -s $BASEDIR/neovim $HOME/.config/nvim +# Clean up old vim configuration if it exists +if [ -L "$HOME/.vimrc" ] || [ -f "$HOME/.vimrc" ]; then + echo "Removing old vim configuration" + rm -f $HOME/.vimrc +fi +if [ -L "$HOME/.vim" ] || [ -d "$HOME/.vim" ]; then + rm -rf $HOME/.vim +fi + # .gitconfig gets edited by .extra so we won’t symlink it, but copy it echo "For compatability we chall copy the global gitconfig" cp $BASEDIR/gitconfig $HOME/.gitconfig diff --git a/vim/autoload/pathogen.vim b/vim/autoload/pathogen.vim deleted file mode 120000 index 81b7254..0000000 --- a/vim/autoload/pathogen.vim +++ /dev/null @@ -1 +0,0 @@ -vim-pathogen/autoload/pathogen.vim \ No newline at end of file diff --git a/vim/autoload/vim-pathogen b/vim/autoload/vim-pathogen deleted file mode 160000 index 8c91196..0000000 --- a/vim/autoload/vim-pathogen +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8c91196cfd9c8fe619f35fac6f2ac81be10677f8 diff --git a/vim/bundle/delimitMate b/vim/bundle/delimitMate deleted file mode 160000 index 8bc47fd..0000000 --- a/vim/bundle/delimitMate +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8bc47fd1c40cdad9ea1f36c0cf13592c70ea65e9 diff --git a/vim/bundle/gruvbox b/vim/bundle/gruvbox deleted file mode 160000 index f1ecde8..0000000 --- a/vim/bundle/gruvbox +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f1ecde848f0cdba877acb0c740320568252cc482 diff --git a/vim/bundle/nerdtree b/vim/bundle/nerdtree deleted file mode 160000 index 15445be..0000000 --- a/vim/bundle/nerdtree +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 15445be5fb2559829ac7a1f05af5d713586e8ec9 diff --git a/vim/bundle/syntastic b/vim/bundle/syntastic deleted file mode 160000 index c2c6a07..0000000 --- a/vim/bundle/syntastic +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c2c6a075113adbfcc4f1ad5b1c0200a0d35ceeb6 diff --git a/vim/bundle/vim-colors-solarized b/vim/bundle/vim-colors-solarized deleted file mode 160000 index 528a59f..0000000 --- a/vim/bundle/vim-colors-solarized +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 528a59f26d12278698bb946f8fb82a63711eec21 diff --git a/vim/bundle/vim-fugitive b/vim/bundle/vim-fugitive deleted file mode 160000 index 3439f99..0000000 --- a/vim/bundle/vim-fugitive +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3439f999b138254e4bb56187fc91f91f545b4b12 diff --git a/vim/bundle/vim-sensible b/vim/bundle/vim-sensible deleted file mode 160000 index 9e91be7..0000000 --- a/vim/bundle/vim-sensible +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9e91be7e0fb42949831fe3161ef583363648aa58 diff --git a/vim/vimrc b/vim/vimrc deleted file mode 100644 index b4c2f65..0000000 --- a/vim/vimrc +++ /dev/null @@ -1,252 +0,0 @@ -" URL: http://vim.wikia.com/wiki/Example_vimrc -" Authors: http://vim.wikia.com/wiki/Vim_on_Freenode -" Description: A minimal, but feature rich, example .vimrc. If you are a -" newbie, basing your first .vimrc on this file is a good choice. -" If you're a more advanced user, building your own .vimrc based -" on this file is still a good idea. - -"------------------------------------------------------------ -" Features {{{1 -" -" These options and commands enable some very useful features in Vim, that -" no user should have to live without. - -" Set 'nocompatible' to ward off unexpected things that your distro might -" have made, as well as sanely reset options when re-sourcing .vimrc -set nocompatible - -" Attempt to determine the type of a file based on its name and possibly its -" contents. Use this to allow intelligent auto-indenting for each filetype, -" and for plugins that are filetype specific. -filetype indent plugin on - -" Enable syntax highlighting -syntax on - - -"------------------------------------------------------------ -" Must have options {{{1 -" -" These are highly recommended options. - -" Vim with default settings does not allow easy switching between multiple files -" in the same editor window. Users can use multiple split windows or multiple -" tab pages to edit multiple files, but it is still best to enable an option to -" allow easier switching between files. -" -" One such option is the 'hidden' option, which allows you to re-use the same -" window and switch from an unsaved buffer without saving it first. Also allows -" you to keep an undo history for multiple files when re-using the same window -" in this way. Note that using persistent undo also lets you undo in multiple -" files even in the same window, but is less efficient and is actually designed -" for keeping undo history after closing Vim entirely. Vim will complain if you -" try to quit without saving, and swap files will keep you safe if your computer -" crashes. -set hidden - -" Note that not everyone likes working this way (with the hidden option). -" Alternatives include using tabs or split windows instead of re-using the same -" window as mentioned above, and/or either of the following options: -" set confirm -" set autowriteall - -" Better command-line completion -set wildmenu - -" Show partial commands in the last line of the screen -set showcmd - -" Highlight searches (use to temporarily turn off highlighting; see the -" mapping of below) -set hlsearch - -" Modelines have historically been a source of security vulnerabilities. As -" such, it may be a good idea to disable them and use the securemodelines -" script, . -" set nomodeline - - -"------------------------------------------------------------ -" Usability options {{{1 -" -" These are options that users frequently set in their .vimrc. Some of them -" change Vim's behaviour in ways which deviate from the true Vi way, but -" which are considered to add usability. Which, if any, of these options to -" use is very much a personal preference, but they are harmless. - -" Use case insensitive search, except when using capital letters -set ignorecase -set smartcase - -" Allow backspacing over autoindent, line breaks and start of insert action -set backspace=indent,eol,start - -" When opening a new line and no filetype-specific indenting is enabled, keep -" the same indent as the line you're currently on. Useful for READMEs, etc. -set autoindent - -" Stop certain movements from always going to the first character of a line. -" While this behaviour deviates from that of Vi, it does what most users -" coming from other editors would expect. -set nostartofline - -" Display the cursor position on the last line of the screen or in the status -" line of a window -set ruler - -" Always display the status line, even if only one window is displayed -set laststatus=2 - -" Always display the tabline, even if there is only one tab -set showtabline=2 - -" Hide the default mode text (e.g. -- INSERT -- below the statusline) -set noshowmode - -" Instead of failing a command because of unsaved changes, instead raise a -" dialogue asking if you wish to save changed files. -set confirm - -" Use visual bell instead of beeping when doing something wrong -set visualbell - -" And reset the terminal code for the visual bell. If visualbell is set, and -" this line is also included, vim will neither flash nor beep. If visualbell -" is unset, this does nothing. -set t_vb= - -" Enable use of the mouse for all modes -set mouse=a - -" Set the command window height to 2 lines, to avoid many cases of having to -" "press to continue" -set cmdheight=2 - -" Display line numbers on the left -set number - -" Quickly time out on keycodes, but never time out on mappings -set notimeout ttimeout ttimeoutlen=200 - -" Use to toggle between 'paste' and 'nopaste' -set pastetoggle= - - -"------------------------------------------------------------ -" Indentation options {{{1 -" -" Indentation settings according to personal preference. - -" Indentation settings for using 4 spaces instead of tabs. -" Do not change 'tabstop' from its default value of 8 with this setup. -set shiftwidth=4 -set softtabstop=4 -set expandtab - -" Indentation settings for using hard tabs for indent. Display tabs as -" two characters wide. -"set shiftwidth=2 -set tabstop=4 - -" Force the cursor onto a new line after 80 characters -set textwidth=80 -" However, in Git commit messages, let’s make it 72 characters -autocmd FileType gitcommit set textwidth=72 -" Colour the 81st (or 73rd) column so that we don’t type over our limit -set colorcolumn=+1 - -"------------------------------------------------------------ -" Mappings {{{1 -" -" Useful mappings - -" Map Y to act like D and C, i.e. to yank until EOL, rather than act as yy, -" which is the default -map Y y$ - -" Map (redraw screen) to also turn off search highlighting until the -" next search -nnoremap :nohl - -"------------------------------------------------------------ -" Add the powerline statusbar - -" Linux -"if (filereadable("/usr/lib/python3.6/site-packages/powerline/bindings/vim/__init__.py")) -"" set rtp+=/usr/lib/python3.6/site-packages/powerline/bindings/vim -"endif -" macOS -"if (filereadable("/usr/local/lib/python3.6/site-packages/powerline/bindings/vim/__init__.py")) -"" set rtp+=/usr/local/lib/python3.6/site-packages/powerline/bindings/vim -"endif -" JMB server -"if (filereadable("/home/jonny/.local/lib/python3.5/site-packages/powerline/bindings/vim/__init__.py")) -"" set rtp+=/home/jonny/.local/lib/python3.5/site-packages/powerline/bindings/vim -"endif -"let g:powerline_pycmd = "py3" - -"------------------------------------------------------------ -" Personal settings -" Pathogen for plugins -execute pathogen#infect() -execute pathogen#helptags() - - -" Colour schemes -"set background=dark -"let g:solarized_termtrans=1 -"let g:solarized_termcolors=256 -"let g:solarized_contrast="high" -"let g:solarized_visibilty="high" -colorscheme gruvbox - - -" syntastic settings from the readme -set statusline+=%#warningmsg# -set statusline+=%{SyntasticStatuslineFlag()} -set statusline+=%* - -let g:syntastic_always_populate_loc_list = 1 -let g:syntastic_auto_loc_list = 1 -let g:syntastic_check_on_open = 1 -let g:syntastic_check_on_wq = 0 -" php syntastic options -" order of checking -let g:syntastic_php_checkers = ['php'] - -" Let’s use Vim properly, no arrow keys -nnoremap :echomsg "use k" -nnoremap :echomsg "use j" -nnoremap :echomsg "use j" -nnoremap :echomsg "use l" - -" And spell-checking -autocmd FileType gitcommit setlocal spell -set complete+=kspell - -" Keymap to open NERDtree -map :NERDTreeToggle -" Autoclose when NERDtree is the last buffer -autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif -" Allow the use of `vim` to open a “project” -autocmd StdinReadPre * let s:std_in=1 -autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif -" NERDtree file highlighting -function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg) - exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg - exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#' -endfunction - -call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515') -call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515') -call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515') -call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515') -call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515') -call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515') -call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515') -call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515') -call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515') -call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515') -call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515') -call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515') -call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515')