diff --git a/.bash_aliases b/.bash_aliases index 6d14b5e..b6f9767 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -18,6 +18,7 @@ alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo export EDITOR="vim" export VISUAL="vim" export LS_COLORS="di=1;34:ln=31;47:so=32:pi=33:ex=1;32:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43" +export PATH=$PATH:/opt/ # Example path for autocompletion using libclang-9-dev package, obtained by the following command # find /usr/ -name libclang.so.1 2>/dev/null diff --git a/.vimrc b/.vimrc index b557e55..962096e 100644 --- a/.vimrc +++ b/.vimrc @@ -132,7 +132,3 @@ let g:airline_right_alt_sep = '' let g:airline_symbols.branch = '' let g:airline_symbols.readonly = '' let g:airline_symbols.linenr = '' - -" Clang_complete settings -let g:clang_library_path = $LIBCLANG - diff --git a/README.md b/README.md index 6b279e4..249c199 100644 --- a/README.md +++ b/README.md @@ -2,37 +2,69 @@ A place for backing up my dotfiles. Be sure to clone recursively if you want to grab updated plugins / submodules included. For example, using Pathogen with Vim to manage plugins requires that the plugin to be installed are cloned to the `~/.vim/bundle/` directory. Cloning recursively allows git to clone these same nested repositories/submodules within this directory so Pathogen can handle running the Vim plugins. +Once installed, editing source code in vim supports features displayed in the screenshot below + +![Vim screenshot](VimScreenshot.png) + +### Install Dotfiles + Easiest installation is to clone repository into home directory - ```bash -git clone -b headless --recursive https://github.com/shaunrd0/dot ~/dot +git clone --recursive https://github.com/shaunrd0/dot ~/dot cd ~/dot/ -stow . +stow --adopt . ``` If you'd rather clone elsewhere - ```bash -git clone -b headless --recursive https://github.com/shaunrd0/dot /path/to/dot +git clone --recursive https://github.com/shaunrd0/dot /path/to/dot cd /path/to/dot/ -stow -t ~ . +stow --adopt -t ~ . ``` -I use the `libclang-10-dev` package for clang completion. You can use whichever version you want, but to use the same version as I do, run the following commands. - -```bash -sudo apt install libclang-10-dev -printf "export LIBCLANG=\""$(find /usr/ -name libclang.so.1 2>/dev/null)"\"\n\n" >> .bash_aliases -echo "let g:clang_library_path=$LIBCLANG" >> ~/.vimrc -``` - -`stow --adopt .` can be used to install conflicting files, but doing so will result in the loss of your local configurations. If you want to keep them, back up the conflicting files output in the error message before running this command. - -After running stow, be sure to check that your repository is clean. If a file has been modified or deleted, checkout again within the repo and it will immediately be restored on your system as well. +**Warning:** Since `--adopt` is used to force linking to conflicting files, but doing so could result in the loss of some configs within your local copy of the repository. After running `stow --adopt .`, be sure to check `git status` is clean. If a file has been modified or deleted, restore the file or otherwise discard the local changes to be up-to-date with `origin/master` and it will immediately be restored on your system as well, since the files are now linked. +We could run the following commands to restore changed files ```bash git checkout -- .vimrc # Or, to step through each change interactively using git.. git checkout -p +# Or restore the current directory +git restore . ``` +If you forget to clone recursively +```bash +git submodule update +Submodule path '.vim/bundle/Colorizer': checked out '53ada285f0acc171acda4280b6144e468dded89f' +Submodule path '.vim/bundle/ale': checked out '7265ceb6d050d1a4642741d248f11e4f2abd37e1' +Submodule path '.vim/bundle/clang_complete': checked out '0b98d7533ad967aac3fc4c1a5b0508dafa8a676f' +Submodule path '.vim/bundle/supertab': checked out '40fe711e088e2ab346738233dd5adbb1be355172' +Submodule path '.vim/bundle/unicode.vim': checked out '29f43f7b1be94dccfac461f4da0a34410408111f' +Submodule path '.vim/bundle/vim-airline': checked out '6d665580a3435f21ad560af192d854d4b608fff5' +Submodule path '.vim/bundle/vim-airline-themes': checked out '0d5c5c1e2995126e76606a628316c8e3f5efb37a' +Submodule path '.vim/bundle/vim-signify': checked out '16eee41d2b267523b84bd4ac111627588bfd1a47' +``` + + +### Install Clang Completion + +**These configurations require the installation and setup of libclang for clang completion** + +If you don't want clang completion, just remove the plugin directory from `~/.vim/bundle/`. + +If you don't remove clang completion and skip the following steps, vim will show errors when opening source code files. This is because these configurations use clang completion for source code auto completion and drop-down menus within vim. + +I use the `libclang-10-dev` package for this. You can use whichever version you want, but to use the same version as I do, you could run the following commands. +Note that the `printf` command may take some time to finish, since it is searching your system for a needed file. + +```bash +sudo apt install libclang-10-dev +printf "export LIBCLANG=\""$(find /usr/ -name libclang.so.1 2>/dev/null)"\"\n\n" >> .bash_aliases +echo "let g:clang_library_path=\$LIBCLANG" >> ~/.vimrc +source ~/.bashrc +``` + + diff --git a/VimScreenshot.png b/VimScreenshot.png new file mode 100644 index 0000000..5600d80 Binary files /dev/null and b/VimScreenshot.png differ