diff --git a/bash-scripting/changing-the-modification-date-of-a-file.md b/bash-scripting/changing-the-modification-date-of-a-file.md index 87a0e69..f0c6091 100644 --- a/bash-scripting/changing-the-modification-date-of-a-file.md +++ b/bash-scripting/changing-the-modification-date-of-a-file.md @@ -1,5 +1,5 @@ You can use `touch` to change modification date or time of a file: -``` +```bash touch -d 20210703 filename # Set the times on a file to a specific date and time: @@ -7,8 +7,8 @@ touch -t YYYYMMDDHHMM.SS filename ``` -or use the times from a file to set the times on a second file: +... or use the times from a file to set the times on a second file: -``` +```bash touch -r filename filename2 ``` diff --git a/bash-scripting/getting-the-size-of-a-file.md b/bash-scripting/getting-the-size-of-a-file.md index ae690cf..882e1cf 100644 --- a/bash-scripting/getting-the-size-of-a-file.md +++ b/bash-scripting/getting-the-size-of-a-file.md @@ -1,5 +1,5 @@ You can get the size of a file in bytes with: -``` +```bash stat -c %s file_name # example size=$(stat -c %s $myfile) diff --git a/bash-scripting/looping-through-the-files.md b/bash-scripting/looping-through-the-files.md index 3d03065..27fed33 100644 --- a/bash-scripting/looping-through-the-files.md +++ b/bash-scripting/looping-through-the-files.md @@ -1,12 +1,12 @@ You can loop through the files with: -``` +```bash for f in * ; do echo $f done ``` If you want to loop through only directories: -``` +```bash for d in */ ; do echo $d done diff --git a/bash-scripting/moving-everything-one-level-up.md b/bash-scripting/moving-everything-one-level-up.md index 7617717..233228c 100644 --- a/bash-scripting/moving-everything-one-level-up.md +++ b/bash-scripting/moving-everything-one-level-up.md @@ -1,5 +1,5 @@ You can move every file (except the hidden ones) up by one level in the hierarchy with something like this: -``` +```bash for d in */ ; do mv $d* . rmdir $d # optional diff --git a/bash-scripting/redirecting-the-output-of-a-command-to-a-file.md b/bash-scripting/redirecting-the-output-of-a-command-to-a-file.md index a171020..6cb87c9 100644 --- a/bash-scripting/redirecting-the-output-of-a-command-to-a-file.md +++ b/bash-scripting/redirecting-the-output-of-a-command-to-a-file.md @@ -1,8 +1,8 @@ 1. Redirect stdout to one file and stderr to another file: - - command > out 2>error - +```bash +command > out 2>error +``` 2. Redirect stdout to a file `out`, and then redirect stderr to stdout: - - command > out 2>&1 - +```bash +command > out 2>&1 +``` diff --git a/bash-scripting/splitting-a-string-with-delimiter.md b/bash-scripting/splitting-a-string-with-delimiter.md index 49b3eba..10cfd3a 100644 --- a/bash-scripting/splitting-a-string-with-delimiter.md +++ b/bash-scripting/splitting-a-string-with-delimiter.md @@ -1,6 +1,6 @@ You can split a string with `cut`: -``` +```bash foo="hello-world-bye-world" bar=$(echo $foo | cut -d"-" -f2) echo $bar diff --git a/command-line-utils/generating-transition-between-images.md b/command-line-utils/generating-transition-between-images.md index c523d54..337f518 100644 --- a/command-line-utils/generating-transition-between-images.md +++ b/command-line-utils/generating-transition-between-images.md @@ -1,6 +1,6 @@ -I have lots of images of a scene from sunrise to sunset and my wallpaper is automaticatilly set to one of them based on the hour of the day. But you know what? I LOVE customizing my machine and I WANT MORE! I want the transition to be smooth af. To make this possible I need to generate images. And here is the result of literally 5 minutes of google search: +I have lots of images of a scene from sunrise to sunset and my wallpaper is automatically set to one of them based on the hour of the day. But you know what? I LOVE customizing my machine and I WANT MORE! I want the transition to be smooth af. To make this possible I need to generate images. And here is the result of literally 5 minutes of google search: -``` +```bash convert A.jpg B.jpg -morph 10 out.jpg ``` diff --git a/command-line-utils/getting-the-keys-pressed.md b/command-line-utils/getting-the-keys-pressed.md index b13c8f9..37fe1ab 100644 --- a/command-line-utils/getting-the-keys-pressed.md +++ b/command-line-utils/getting-the-keys-pressed.md @@ -1,4 +1,4 @@ Most of the time, `xev` will be enough to know exactly which key is pressed but it generates a lot of output and sometimes that is overwhelming. If you find yourself in this situation try: -``` +```bash showkey -a ``` diff --git a/command-line-utils/joining-images-into-one.md b/command-line-utils/joining-images-into-one.md index 59abc57..cf2deaf 100644 --- a/command-line-utils/joining-images-into-one.md +++ b/command-line-utils/joining-images-into-one.md @@ -1,7 +1,8 @@ You can join multiple images into one using `convert`: - - # join vertically - convert in1.png in2.png -append out.png +```bash +# join vertically +convert in1.png in2.png -append out.png - # join horizontally - convert in1.png in2.png +append out.png +# join horizontally +convert in1.png in2.png +append out.png +``` diff --git a/command-line-utils/joining-images-to-pdf.md b/command-line-utils/joining-images-to-pdf.md index 53f133b..ba14829 100644 --- a/command-line-utils/joining-images-to-pdf.md +++ b/command-line-utils/joining-images-to-pdf.md @@ -1,22 +1,26 @@ You can join multiple images to pdf using `convert`: - convert *.png out.pdf +```bash +convert *.png out.pdf +``` If you get an error like - - convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/408. +``` +convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/408. +``` follow the steps below: - - sudo vim /etc/ImageMagick-6/policy.xml +```bash +sudo vim /etc/ImageMagick-6/policy.xml +``` and replace the line - - - +```xml + +``` with - - - +```xml + +``` [source](https://askubuntu.com/questions/1081895/trouble-with-batch-conversion-of-png-to-pdf-using-convert) diff --git a/command-line-utils/joining-pdf-files.md b/command-line-utils/joining-pdf-files.md index 2b43341..a9c3355 100644 --- a/command-line-utils/joining-pdf-files.md +++ b/command-line-utils/joining-pdf-files.md @@ -1,6 +1,6 @@ You can join multiple pdf files into one using this command: -``` +```bash pdfunite in-1.pdf in-2.pdf in-n.pdf out.pdf ``` diff --git a/command-line-utils/splitting-pdf-files.md b/command-line-utils/splitting-pdf-files.md index 22277a2..066660b 100644 --- a/command-line-utils/splitting-pdf-files.md +++ b/command-line-utils/splitting-pdf-files.md @@ -1,6 +1,6 @@ You can extract certain parts of a pdf file with this: -``` +```bash pdfjam original.pdf 5-10 -o out.pdf ``` diff --git a/command-line-utils/virtual-environment-with-system-packages.md b/command-line-utils/virtual-environment-with-system-packages.md index 8f46f05..454a033 100644 --- a/command-line-utils/virtual-environment-with-system-packages.md +++ b/command-line-utils/virtual-environment-with-system-packages.md @@ -1,4 +1,4 @@ You can use below command to create a virtual environment which contains installed packages: -``` +```bash virtualenv venv --system-site-packages ``` diff --git a/core-utils/getting-the-actual-path-of-a-symbolic-link.md b/core-utils/getting-the-actual-path-of-a-symbolic-link.md index 447ae9a..130306c 100644 --- a/core-utils/getting-the-actual-path-of-a-symbolic-link.md +++ b/core-utils/getting-the-actual-path-of-a-symbolic-link.md @@ -1,3 +1,3 @@ -``` +```bash readlink -f /path/to/file ``` diff --git a/database/postgresql/connecting-to-a-database.md b/database/postgresql/connecting-to-a-database.md index c0390c7..745d18e 100644 --- a/database/postgresql/connecting-to-a-database.md +++ b/database/postgresql/connecting-to-a-database.md @@ -1,4 +1,4 @@ -``` +```bash psql dbname username # example diff --git a/git/adding-remote-to-existing-repository.md b/git/adding-remote-to-existing-repository.md index 023cd3e..fe829f1 100644 --- a/git/adding-remote-to-existing-repository.md +++ b/git/adding-remote-to-existing-repository.md @@ -1,9 +1,9 @@ If you have an existing repository and want to add a new remote you can use this command: -``` +```bash git remote add ``` Example: -``` +```bash git remote add origin git@github.com:Asocia/til.git git push -u origin my_branch ``` diff --git a/git/changing-the-author-and-committer-of-older-commits.md b/git/changing-the-author-and-committer-of-older-commits.md index e3ca1a3..de4f42b 100644 --- a/git/changing-the-author-and-committer-of-older-commits.md +++ b/git/changing-the-author-and-committer-of-older-commits.md @@ -1,7 +1,7 @@ -You can change author of your commits to anyone. Let's make all the commit's of the current repository Torvalds :D Luckily we know his email address so this will be very easy. Just run: -``` +You can change author of your commits to anyone. Let's make all the commits of the current repository Torvalds's :D Luckily we know his email address so this will be very easy. Just run: +```bash git filter-branch --env-filter ' -OLD_EMAIL="akkayas17@itu.edu.tr" +OLD_EMAIL="old_email@domain.com" CORRECT_NAME="Linus Torvals" CORRECT_EMAIL="torvalds@linux-foundation.org" if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] diff --git a/git/cherry-picking-commits-from-another-branch.md b/git/cherry-picking-commits-from-another-branch.md index aca10c3..1f49e22 100644 --- a/git/cherry-picking-commits-from-another-branch.md +++ b/git/cherry-picking-commits-from-another-branch.md @@ -1,6 +1,6 @@ You have a commit which contains a good code change but it is in another branch? -``` +```bash # pick the commit git cherry-pick diff --git a/git/notes-from-pro-git-book.md b/git/notes-from-pro-git-book.md index bdde323..0b610d1 100644 --- a/git/notes-from-pro-git-book.md +++ b/git/notes-from-pro-git-book.md @@ -4,18 +4,18 @@ I'm reading Pro Git book and I learn some cool stuff. I don't know if I'm going If you to know which changes are made since some time, use `--since` option like: -``` +```bash git log --since=2.weeks ``` or until some time -``` +```bash git log --until="20-01-2020" ``` These commands works with lots of formats, you can specify a specific date like "2008-01-15", or a relative date such as "2 years 1 day 3 minutes ago" The --author option allows you to filter on a specific author -``` +```bash git log --author="Asocia" ``` @@ -23,7 +23,7 @@ git log --author="Asocia" Another really helpful filter is the -S option (colloquially referred to as Git’s “pickaxe” option), which takes a string and shows only those commits that changed the number of occurrences of that string. For instance, if you wanted to find the last commit that added or removed a reference to a specific function, you could call: -``` +```bash git log -S function_name ``` @@ -33,11 +33,11 @@ git log -S function_name We’ve mentioned and given some demonstrations of how the git clone command implicitly adds the origin remote for you. Here’s how to add a new remote explicitly. To add a new remote Git repository as a shortname you can reference easily, run git remote add : -``` -$ git remote -v -$ git remote add pb https://github.com/paulboone/ticgit -$ git remote -v -$ git fetch pb +```bash +git remote -v +git remote add pb https://github.com/paulboone/ticgit +git remote -v +git fetch pb ``` Paul’s master branch is now accessible locally as pb/master — you can merge it into one of your branches, or you can check out a local branch at that point if you want to inspect it. @@ -52,23 +52,23 @@ From Git version 2.23 onwards you can use `git switch` instead of `git checkout` - Renaming branches Suppose you have a branch that is called `bad-branch-name` and you want to change it to `corrected-branch-name`, while keeping all history. You also want to change the branch name on the remote (GitHub, GitLab, other server). How do you do this? Rename the branch locally with the `git branch --move` command: -``` +```bash git branch --move bad-branch-name corrected-branch-name ``` This replaces your `bad-branch-name` with `corrected-branch-name`, but this change is only local for now. To let others see the corrected branch on the remote, push it: -``` +```bash git push --set-upstream origin corrected-branch-name ``` To delete the old branch name: -``` +```bash git push origin --delete bad-branch-name ``` - Pushing a local branch into a remote branch that is named differently -``` +```bash # our branch is serverfix and we don't want to push it with this name git push origin serverfix:awesomebranch ``` diff --git a/git/rebasing-from-other-branches.md b/git/rebasing-from-other-branches.md index bdad4af..857914b 100644 --- a/git/rebasing-from-other-branches.md +++ b/git/rebasing-from-other-branches.md @@ -1,6 +1,6 @@ Let's say you are in `wip` branch and you didn't push your changes to server yet. If you want to get all the changes from master: -``` +```bash git checkout master git pull git checkout wip diff --git a/git/rebasing-without-overwriting-commit-dates.md b/git/rebasing-without-overwriting-commit-dates.md index 06d7f7f..b857799 100644 --- a/git/rebasing-without-overwriting-commit-dates.md +++ b/git/rebasing-without-overwriting-commit-dates.md @@ -1,10 +1,10 @@ When you do -``` +```bash git rebase -i commitish ``` and edit some commits, you will recreate the history hence all the commits coming after edited one will have the same date and time. If you don't want this behaviour here is the trick: -``` +```bash git rebase --committer-date-is-author-date -i commitish ``` Note that you need git version 23.19 or greater to do this in interactive mode. diff --git a/git/removing-a-file-without-deleting-it-from-disk.md b/git/removing-a-file-without-deleting-it-from-disk.md index 92dfdcd..e5c112d 100644 --- a/git/removing-a-file-without-deleting-it-from-disk.md +++ b/git/removing-a-file-without-deleting-it-from-disk.md @@ -1,7 +1,7 @@ From Pro Git book: > Another useful thing you may want to do is to keep the file in your working tree but remove it from your staging area. In other words, you may want to keep the file on your hard drive but not have Git track it anymore. This is particularly useful if you forgot to add something to your .gitignore file and accidentally staged it, like a large log file or a bunch of .a compiled files. To do this, use the --cached option: -``` +```bash git rm --cached README ``` diff --git a/git/removing-untracked-files.md b/git/removing-untracked-files.md index 658ce82..bc5daf3 100644 --- a/git/removing-untracked-files.md +++ b/git/removing-untracked-files.md @@ -1,6 +1,6 @@ You can remove untracked files with `git-clean`. -``` +```bash # Show which files will be removed git clean -nd diff --git a/git/setting-ssh-url-for-pulling-or-pushing.md b/git/setting-ssh-url-for-pulling-or-pushing.md index f1bd98a..5d31bf6 100644 --- a/git/setting-ssh-url-for-pulling-or-pushing.md +++ b/git/setting-ssh-url-for-pulling-or-pushing.md @@ -1,5 +1,5 @@ You can clone a repository with ssh and pull/push without having to enter your credentials. If you already cloned it with https and want to change your remote url, do this: -``` +```bash ❯ git remote -v origin https://github.com/Asocia/dotfiles.git (fetch) origin https://github.com/Asocia/dotfiles.git (push) diff --git a/git/viewing-all-diffs-together.md b/git/viewing-all-diffs-together.md index 95c1ba6..6057df3 100644 --- a/git/viewing-all-diffs-together.md +++ b/git/viewing-all-diffs-together.md @@ -1,5 +1,5 @@ To see the changes in both staging area and working tree, use: -``` +```bash git diff HEAD ``` diff --git a/git/viewing-history-of-a-file.md b/git/viewing-history-of-a-file.md index d328960..24c1d7e 100644 --- a/git/viewing-history-of-a-file.md +++ b/git/viewing-history-of-a-file.md @@ -1,16 +1,16 @@ You can add filename to `git log` to view all the commit history of a file: -``` +```bash git log my_file ``` If you want to view diff's, add `-p` option: -``` +```bash git log -p my_file ``` If you want to continue listing the file history beyond renames, add `--follow` option: -``` +```bash git log --follow -p my_file ``` diff --git a/ssh/using_a_public_key_to_login.md b/ssh/using_a_public_key_to_login.md index 90c5b44..af3f633 100644 --- a/ssh/using_a_public_key_to_login.md +++ b/ssh/using_a_public_key_to_login.md @@ -1,11 +1,11 @@ You can generate authentication keys and use it with ssh to login. First run the below command if you don't have any (it won't overwrite if you already have one): -``` +```bash ssh-keygen ``` Then copy your public key to remote server with this: -``` +```bash ssh-copy-id name@host ``` diff --git a/system/TOGGLING_CAPSLOCK_PROGRAMMATICALLY.MD b/system/TOGGLING_CAPSLOCK_PROGRAMMATICALLY.MD index 1f27e0f..6e28a6b 100644 --- a/system/TOGGLING_CAPSLOCK_PROGRAMMATICALLY.MD +++ b/system/TOGGLING_CAPSLOCK_PROGRAMMATICALLY.MD @@ -1,5 +1,5 @@ YOU CAN TOGGLE CAPS LOCK FROM COMMAND LINE BY DOING: -``` +```bash xdotool key Caps_Lock ``` diff --git a/system/changing-brightness-from-console.md b/system/changing-brightness-from-console.md index 894e6cb..7870e47 100644 --- a/system/changing-brightness-from-console.md +++ b/system/changing-brightness-from-console.md @@ -5,13 +5,13 @@ Read [this](https://wiki.archlinux.org/title/backlight) and you are done :D Here is the tl;dr part. Run `ls /sys/class/backlight/` to see which graphics card is managing your backlight. I'm assuming you get an ouput like `intel_backlight`. Then run this: -``` +```bash ls /sys/class/backlight/intel_backlight actual_brightness bl_power brightness device/ max_brightness power/ scale subsystem/ type uevent ``` Read the `max_brightness` value and then set your brightness to something smaller than that value: -``` +```bash cat /sys/class/backlight/intel_backlight/max_brightness echo 100 > /sys/class/backlight/intel_backlight/brightness ``` @@ -23,7 +23,7 @@ RUN+="/bin/chgrp video /sys/class/backlight/intel_backlight/brightness" RUN+="/bin/chmod g+w /sys/class/backlight/intel_backlight/brightness" ``` and add yourself to the `video` group. -``` +```bash sudo usermod -aG video $USER ``` diff --git a/system/connecting-to-a-device-via-bluetooth.md b/system/connecting-to-a-device-via-bluetooth.md index 4d85a09..1a709a9 100644 --- a/system/connecting-to-a-device-via-bluetooth.md +++ b/system/connecting-to-a-device-via-bluetooth.md @@ -1,5 +1,5 @@ If you want to connect to a device via bluetooth: -``` +```bash sudo systemctl enable bluetooth.service bluetoothctl power on bluetoothctl devices # to find the mac address of your device diff --git a/system/deleting-a-repository-that-is-not-needed.md b/system/deleting-a-repository-that-is-not-needed.md index e31d52f..b0b813b 100644 --- a/system/deleting-a-repository-that-is-not-needed.md +++ b/system/deleting-a-repository-that-is-not-needed.md @@ -7,7 +7,7 @@ N: See apt-secure(8) manpage for repository creation and user configuration deta You will need to find corresponding file in `sources.list.d` and delete it. -``` +```bash cd /etc/apt/sources.list.d sudo rm bad-repo.list ``` diff --git a/system/enabling-touchpad-with-X11-config-file.md b/system/enabling-touchpad-with-X11-config-file.md index b80342e..309bc8f 100644 --- a/system/enabling-touchpad-with-X11-config-file.md +++ b/system/enabling-touchpad-with-X11-config-file.md @@ -18,11 +18,11 @@ While this is effective it certainly isn’t copy-paste drop dead simple and is ## Doing it the X11 config way X11 provides configurations in a directory “X11/xorg.conf.d/” this directory could live in various places on your system depending on your distribution. However, X11 will always attempt to also load configurations from /etc/X11/xorg.conf.d/ when present. To ensure the directory exists, run: -``` +```bash sudo mkdir -p /etc/X11/xorg.conf.d ``` Next we’ll create a new file “90-touchpad.conf”. The configuration file names end with .conf and are read in ASCII order—by convention file names begin with two digits followed by a dash. -``` +```bash sudo touch /etc/X11/xorg.conf.d/90-touchpad.conf ``` Now open up the file your editor of choice (with suitable write permission of course) and paste the following: diff --git a/system/remapping-capslock-to-ctrl.md b/system/remapping-capslock-to-ctrl.md index 4885178..76d7d91 100644 --- a/system/remapping-capslock-to-ctrl.md +++ b/system/remapping-capslock-to-ctrl.md @@ -4,7 +4,7 @@ Here is how it should be done: If you want to remap it for X server, add the following line to your `~/.xsession` or `~/.xinitrc`. Make sure to add it before `exec whatever_window_manager` you are using: -``` +```bash setxkbmap -option 'caps:ctrl_modifier' ``` [source](https://superuser.com/questions/566871/how-to-map-the-caps-lock-key-to-escape-key-in-arch-linux) diff --git a/system/setting-keyboard-layout-for-login-screen.md b/system/setting-keyboard-layout-for-login-screen.md index 32ef790..adc6a59 100644 --- a/system/setting-keyboard-layout-for-login-screen.md +++ b/system/setting-keyboard-layout-for-login-screen.md @@ -1,6 +1,6 @@ Recently, I switched to dvorak layout and I am using it everywhere to get used to it. This was the command that worked everywhere (including the login screen): -``` +```bash localectl --no-convert set-x11-keymap us pc105 dvp caps:ctrl_modifier ``` diff --git a/system/turning-off-capslock-when-esc-is-pressed.md b/system/turning-off-capslock-when-esc-is-pressed.md index 07a6286..a91f97e 100644 --- a/system/turning-off-capslock-when-esc-is-pressed.md +++ b/system/turning-off-capslock-when-esc-is-pressed.md @@ -3,7 +3,7 @@ When my Ctrl key broken, I remapped Capslock to Ctrl as it was the most useless I am a vim user and I don't use Capslock other than typing some constant variable names or SQL syntax etc. They are all happening in vim, specifically, in insert mode. Whenever I switch to normal mode, I want my Capslock to be off. I sometimes forget and instead of moving down with `j`, I find myself `J`oining lines. This happened more than 3 times so it is time to do something. I could solve this problem in keyboard level because I have a programmable keyboard. I didn't want to this because sometimes I use my laptop's keyboard and I don't want them to behave differently. So I solved it on OS level. Here are the commands that I run in order to achieve this effect: -``` +```bash mkdir -p ~/.xkb/keymap/ mkdir -p ~/.xkb/symbols/ vim ~/.xkb/symbols/mysymbols diff --git a/system/unmounting-a-busy-device.md b/system/unmounting-a-busy-device.md index f897dbd..2d9ac79 100644 --- a/system/unmounting-a-busy-device.md +++ b/system/unmounting-a-busy-device.md @@ -1,5 +1,5 @@ Make sure that you are not inside the mounted path. -`````` +```bash sudo umount /path/to/dev -`````` +``` diff --git a/system/writing-ip-table-rules.md b/system/writing-ip-table-rules.md index 2a1fe18..6d65ede 100644 --- a/system/writing-ip-table-rules.md +++ b/system/writing-ip-table-rules.md @@ -1,5 +1,5 @@ Today I wanted to ssh into my desktop from my laptop. They were both connected to my phone. Laptop was connected via Wi-Fi and the desktop was connected via USB tethering. Since they are not connected in the same way, they were on different networks and it was not possible to ssh into the other computer. I searched about the problem and found [this article](https://www.systutorials.com/port-forwarding-using-iptables/). Since my phone was rooted, I could run any command I want. The final set of commands which allowed me to ssh between each computers were: -``` +```bash # from laptop to desktop iptables -t nat -A POSTROUTING ! -d 192.168.43.0/24 -o rndis0 -j MASQUERADE iptables -A PREROUTING -t nat -i swlan0 -p tcp --dport 22 -j DNAT --to 192.168.42.17:22 diff --git a/vim/executing-vim-commands-from-terminal.md b/vim/executing-vim-commands-from-terminal.md index d5d1e56..582611c 100644 --- a/vim/executing-vim-commands-from-terminal.md +++ b/vim/executing-vim-commands-from-terminal.md @@ -1,6 +1,6 @@ You can execute vim commands in terminal by prefixing your commands with `+` symbol: -``` +```bash vim filename +/searchterm vim +PlugInstall vim filename +g/foo/d diff --git a/vim/meaning-of-a-tilde-at-the-end-of-filename.md b/vim/meaning-of-a-tilde-at-the-end-of-filename.md index e7bbb6e..16ec9f8 100644 --- a/vim/meaning-of-a-tilde-at-the-end-of-filename.md +++ b/vim/meaning-of-a-tilde-at-the-end-of-filename.md @@ -1,5 +1,5 @@ Typically files ending with a ~ are backups created by editors like emacs, nano or vi. Set `backupdir` to some other location if you don't want to see them everywhere. -``` +```vim set backupdir=/path/to/somewhere ``` diff --git a/vim/searching-through-multiple-files-in-plain-vim.md b/vim/searching-through-multiple-files-in-plain-vim.md index d41d156..c32adc7 100644 --- a/vim/searching-through-multiple-files-in-plain-vim.md +++ b/vim/searching-through-multiple-files-in-plain-vim.md @@ -1,6 +1,6 @@ You can search through multiple files using `vimgrep` command. -``` +```vim # search for string all python files in the current dir :vimgrep string *.py # search for string all python files in the current dir and subdir of the current dir diff --git a/vim/using-global-command.md b/vim/using-global-command.md index 54fd8ef..a0efd77 100644 --- a/vim/using-global-command.md +++ b/vim/using-global-command.md @@ -1,6 +1,6 @@ The global command `:g[lobal]` is very powerful. It is used to execute a command matching a pattern. The syntax is -``` +```vim :[range]g/pattern/cmd ```