From 527380e5ff4ec517a212c17e38ae5c1693ad5a20 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Thu, 4 Feb 2021 14:43:09 +0100 Subject: [PATCH] [Org, meta] Change formatting of org files --- org/config/awesome.org | 299 +++++-- org/config/bin.org | 502 ++++++++---- org/config/emacs.org | 1492 +++++++++++++++++++++++++---------- org/config/fish.org | 161 +++- org/config/index.org | 160 ++-- org/config/installation.org | 159 +++- org/config/picom.org | 225 ++++-- org/config/rustfmt.org | 11 +- org/config/tmux.org | 57 +- 9 files changed, 2233 insertions(+), 833 deletions(-) diff --git a/org/config/awesome.org b/org/config/awesome.org index 9ed02d8..7b38b46 100644 --- a/org/config/awesome.org +++ b/org/config/awesome.org @@ -11,22 +11,35 @@ :PROPERTIES: :CUSTOM_ID: Introduction-4c41360e :END: -From the Arch Wiki: awesome is a highly configurable, next generation framework window manager for Xorg. It is very fast and extensible. It is primarily targeted at power users, developers and any people dealing with every day computing tasks and who want to have fine-grained control on its graphical environment. +From the Arch Wiki: awesome is a highly configurable, next generation framework +window manager for Xorg. It is very fast and extensible. It is primarily +targeted at power users, developers and any people dealing with every day +computing tasks and who want to have fine-grained control on its graphical +environment. -Personally, what really made me want to try Awesome is the fact its configuration file is written with an actual programming language and not just a configuration language like with i3, and by the fact it works with tags and not workspaces which makes window management much more flexible. +Personally, what really made me want to try Awesome is the fact its +configuration file is written with an actual programming language and not just a +configuration language like with i3, and by the fact it works with tags and not +workspaces which makes window management much more flexible. -This document was written in Emacs with Org-mode and is both the documentation and source code of my configuration file which can be extracted to ~$HOME/.config/awesome/rc.lua~ through a call to ~org-babel-tangle~. +This document was written in Emacs with Org-mode and is both the documentation +and source code of my configuration file which can be extracted to +~$HOME/.config/awesome/rc.lua~ through a call to ~org-babel-tangle~. * Loading libraries :PROPERTIES: :CUSTOM_ID: Loading_libraries-4df76999 :END: -First of all, some initialization is needed, and this initialization is about math randomness. So, let’s initialize the ~random~ method of the ~math~ library: +First of all, some initialization is needed, and this initialization is about +math randomness. So, let’s initialize the ~random~ method of the ~math~ library: #+BEGIN_SRC lua math.randomseed(os.time()) #+END_SRC -In order to be able to load libraries properly, I first need to make sure LuaRocks is installed, so I can also make sure the packages our configuration depends on installed through it can be found. If LuaRocks is not installed, then do nothing. +In order to be able to load libraries properly, I first need to make sure +LuaRocks is installed, so I can also make sure the packages our configuration +depends on installed through it can be found. If LuaRocks is not installed, then +do nothing. #+BEGIN_SRC lua pcall(require, "luarocks.loader") #+END_SRC @@ -71,7 +84,8 @@ I also want to be able to autofocus the first window when I go to another worksp require("awful.autofocus") #+END_SRC -And finally, I want to be able to declare some shortcuts specific to some apps thanks to the hotkeys help widget. +And finally, I want to be able to declare some shortcuts specific to some apps +thanks to the hotkeys help widget. #+BEGIN_SRC lua require("awful.hotkeys_popup.keys") #+END_SRC @@ -84,7 +98,8 @@ By the way, let’s initialize the ~random~ method of the ~math~ library: :PROPERTIES: :CUSTOM_ID: Error_handling-f6a6668f :END: -This code checks if Awesome encountered an error during startup and fell back to another config. This code will only ever execute for the fallback config. +This code checks if Awesome encountered an error during startup and fell back to +another config. This code will only ever execute for the fallback config. #+BEGIN_SRC lua if awesome.startup_errors then naughty.notify({ preset = naughty.config.presets.critical, @@ -118,7 +133,10 @@ And this code handles runtime errors after startup thanks to signals. :PROPERTIES: :CUSTOM_ID: Variable_definitions-Themes-591886b4 :END: -With Awesome, it is possible to load or write custom themes in order to give Awesome a special look that fits the user. I am currently using a custom theme that is not yet included in my dotfiles. I will add it later, along with the images used for the theme. +With Awesome, it is possible to load or write custom themes in order to give +Awesome a special look that fits the user. I am currently using a custom theme +that is not yet included in my dotfiles. I will add it later, along with the +images used for the theme. #+BEGIN_SRC lua beautiful.init("/home/phundrak/.config/awesome/nord/theme.lua") #+END_SRC @@ -127,7 +145,9 @@ With Awesome, it is possible to load or write custom themes in order to give Awe :PROPERTIES: :CUSTOM_ID: Variable_definitions-Default_terminal_and_text_editor-44b84e20 :END: -The two following variables are set so that I don’t need to go over my whole config file in order to modify which terminal or text editor I use, not that I do it often though. +The two following variables are set so that I don’t need to go over my whole +config file in order to modify which terminal or text editor I use, not that I +do it often though. #+BEGIN_SRC lua terminal = "st" editor = os.getenv("EDITOR") or "emacsclient -c" @@ -137,7 +157,11 @@ The two following variables are set so that I don’t need to go over my whole c :PROPERTIES: :CUSTOM_ID: Variable_definitions-Keys-b8def4ac :END: -The following declares the default Modkey. Usually, ~Mod4~ is the Super key, situated between the Ctrl key and the Alt key with a logo (usually Windows’). Another usual value for this is ~Mod1~, which is the Alt key, but it has greater chances of interfering with other software. I also defined some other obvious variables in order to make my code cleaner later on. +The following declares the default Modkey. Usually, ~Mod4~ is the Super key, +situated between the Ctrl key and the Alt key with a logo (usually Windows’). +Another usual value for this is ~Mod1~, which is the Alt key, but it has greater +chances of interfering with other software. I also defined some other obvious +variables in order to make my code cleaner later on. #+BEGIN_SRC lua modkey = "Mod4" shift = "Shift" @@ -158,7 +182,8 @@ The following declares the default Modkey. Usually, ~Mod4~ is the Super key, sit :PROPERTIES: :CUSTOM_ID: Custom_functions-Wallpaper-related_functions-Set_a_random_wallpaper-104bbeec :END: -This function sets a random wallpaper from the directory =~/Pictures/Wallpapers=, see [[file:bin.org::#pape-update-bdecbadf][pape-update]] in my custom scripts. +This function sets a random wallpaper from the directory +=~/Pictures/Wallpapers=, see [[file:bin.org::#pape-update-bdecbadf][pape-update]] in my custom scripts. #+BEGIN_SRC lua local function set_random_pape() awful.spawn.with_shell("pape-update") @@ -172,7 +197,8 @@ This function sets a random wallpaper from the directory =~/Pictures/Wallpapers= :PROPERTIES: :CUSTOM_ID: Custom_functions-Wallpaper-related_functions-Restore_previous_wallpaper-8b5bc08c :END: -I also wrote the following function that will restore the previously set wallpaper: +I also wrote the following function that will restore the previously set +wallpaper: #+BEGIN_SRC lua local function set_wallpaper(_) awful.spawn.with_shell("nitrogen --restore") @@ -183,7 +209,8 @@ I also wrote the following function that will restore the previously set wallpap :PROPERTIES: :CUSTOM_ID: Custom_functions-Layout_manipulation-6bc7db06 :END: -The following function is used by a shortcut described below in [[#Keybindings-Clients-f9f96d60]]. +The following function is used by a shortcut described below in +[[#Keybindings-Clients-f9f96d60]]. #+BEGIN_SRC lua local function client_go_back() awful.client.focus.history.previous() @@ -302,7 +329,8 @@ The following function is used by a shortcut described below in [[#Keybindings-C :PROPERTIES: :CUSTOM_ID: Layouts-be55a7fd :END: -The following is a list of available windows layouts. I only enable some of them, and their order in the table is their order in Awesome. +The following is a list of available windows layouts. I only enable some of +them, and their order in the table is their order in Awesome. #+NAME: table-layouts | Layout | Enabled? | |-----------------+----------| @@ -358,7 +386,9 @@ Here is the code that activates these layouts: :PROPERTIES: :CUSTOM_ID: Top_bar-d3117294 :END: -The top bar in Awesome is declared thanks to a ~wibar~ widget fro the ~awful~ library. It is comprised of several buttons and widgets that will be declared below. +The top bar in Awesome is declared thanks to a ~wibar~ widget fro the ~awful~ +library. It is comprised of several buttons and widgets that will be declared +below. ** Menus :PROPERTIES: @@ -382,7 +412,9 @@ The top bar in Awesome is declared thanks to a ~wibar~ widget fro the ~awful~ li : { "restart", awesome.restart } : { "quit", function() awesome.quit() end } -It is possible to create actual menus in Awesome, including the one available at the top-left corner of the screen. First, let’s declare a menu related to Awesome: +It is possible to create actual menus in Awesome, including the one available at +the top-left corner of the screen. First, let’s declare a menu related to +Awesome: #+NAME: table-awesome-menu | Name | Command | |-------------+---------------------------------------------------------------------| @@ -398,7 +430,8 @@ And here is the actual code: } #+END_SRC -Next, let’s create the main menu that will be used on ~S-w~ and at the top left of the window: +Next, let’s create the main menu that will be used on ~S-w~ and at the top left +of the window: #+NAME: table-main-menu | Name | Command | Icon | |---------------+----------------+------------------------| @@ -412,7 +445,8 @@ Here is the actual code: }}) #+END_SRC -For now it only has two entries: the Awesome menu and opening a terminal, I will add some more later probably. Let’s specify it as being our main launcher: +For now it only has two entries: the Awesome menu and opening a terminal, I will +add some more later probably. Let’s specify it as being our main launcher: #+BEGIN_SRC lua launcher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mainmenu }) @@ -441,28 +475,39 @@ Let’s also create a clock widget: :PROPERTIES: :CUSTOM_ID: Top_bar-Tag_list-d43dbb62 :END: -In order to create the taglist (an equivalent to workspaces, but better), we need to create first a local variable that will hold the widget. It will be declared as you can see below: +In order to create the taglist (an equivalent to workspaces, but better), we +need to create first a local variable that will hold the widget. It will be +declared as you can see below: #+BEGIN_SRC lua :tangle no local tasklist_buttons = gears.table.join( -- configuration goes here ) #+END_SRC -~gears.table.join()~ joins several tables together, as described [[https://awesomewm.org/doc/api/libraries/gears.table.html][here]], which will be useful since all its arguments will be tables generated by the ~awful.button~ method which will be useful in order to manage what clicks on the tags should do. First, let’s manage left clicks. +~gears.table.join()~ joins several tables together, as described [[https://awesomewm.org/doc/api/libraries/gears.table.html][here]], which +will be useful since all its arguments will be tables generated by the +~awful.button~ method which will be useful in order to manage what clicks on the +tags should do. First, let’s manage left clicks. -Left clicks in general are dedicated to tag visibility. A simple left click on a tag should switch this tag as the only visible tag, no matter how many of them were visible beforehand. +Left clicks in general are dedicated to tag visibility. A simple left click on a +tag should switch this tag as the only visible tag, no matter how many of them +were visible beforehand. #+NAME: tag-simple-left-click #+BEGIN_SRC lua :tangle no awful.button({ }, 1, function(t) t:view_only() end) #+END_SRC -However, left clicks combined with the modkey will add the clicked tag to the list of visible tags, which allows the user to see windows from several tags at once. +However, left clicks combined with the modkey will add the clicked tag to the +list of visible tags, which allows the user to see windows from several tags at +once. #+NAME: tag-mod-left-click #+BEGIN_SRC lua :tangle no awful.button({ modkey }, 1, awful.tag.viewtoggle) #+END_SRC -Right clicks are dedicated to window tagging. A simple right click will untag the currently focused window and tag it again with the clicked tag, moving it effectively from one tag to another. +Right clicks are dedicated to window tagging. A simple right click will untag +the currently focused window and tag it again with the clicked tag, moving it +effectively from one tag to another. #+NAME: tag-simple-right-click #+BEGIN_SRC lua :tangle no awful.button({ }, 3, function(t) @@ -472,7 +517,8 @@ Right clicks are dedicated to window tagging. A simple right click will untag th end) #+END_SRC -However, a right click combined with the modkey will add the clicked tag to the currently focused window, making it visible to both tags. +However, a right click combined with the modkey will add the clicked tag to the +currently focused window, making it visible to both tags. #+NAME: tag-mod-right-click #+BEGIN_SRC lua :tangle no awful.button({ modkey }, 3, function(t) @@ -482,7 +528,9 @@ However, a right click combined with the modkey will add the clicked tag to the end) #+END_SRC -The scroll wheel is treated as clicks just as any right or left clicks and can be interpreted by Awesome. They can prove useful when it comes to tags. If a scroll up is detected over tags, then Awesome will display the previous tag. +The scroll wheel is treated as clicks just as any right or left clicks and can +be interpreted by Awesome. They can prove useful when it comes to tags. If a +scroll up is detected over tags, then Awesome will display the previous tag. #+NAME: tag-simple-scroll-up #+BEGIN_SRC lua :tangle no awful.button({ }, 4, function(t) awful.tag.viewprev(t.screen) end) @@ -510,14 +558,17 @@ So, here’s the actual configuration code for the taglist: :PROPERTIES: :CUSTOM_ID: Top_bar-Tasks_list-fb7c9b20 :END: -Similarly to the tag list, the task list can display some special behavior depending on the clicks it receives. These clicks are set like so: +Similarly to the tag list, the task list can display some special behavior +depending on the clicks it receives. These clicks are set like so: #+BEGIN_SRC lua :tangle no local tasklist_buttons = gears.table.join( -- List of clicks ) #+END_SRC -A left click on a task in the taskbar will simply focus and raise the window linked to it if it is not focused. Otherwise, if the window is focused, the window will be minimized. +A left click on a task in the taskbar will simply focus and raise the window +linked to it if it is not focused. Otherwise, if the window is focused, the +window will be minimized. #+NAME: task-simple-left-click #+BEGIN_SRC lua :tangle no awful.button({ }, 1, function (c) @@ -533,7 +584,9 @@ A left click on a task in the taskbar will simply focus and raise the window lin end) #+END_SRC -If the right click is detected, then a list of all the opened clients is invoked so we can switch to another (and if needed switch visible tag). The width of this list will be 250px. +If the right click is detected, then a list of all the opened clients is invoked +so we can switch to another (and if needed switch visible tag). The width of +this list will be 250px. #+NAME: task-simple-right-click #+BEGIN_SRC lua :tangle no awful.button({ }, 3, function() @@ -541,7 +594,8 @@ If the right click is detected, then a list of all the opened clients is invoked end) #+END_SRC -If a scroll up is detected, then let’s select the previous client in the tasklist. +If a scroll up is detected, then let’s select the previous client in the +tasklist. #+NAME: task-simple-scroll-up #+BEGIN_SRC lua :tangle no awful.button({ }, 4, function () @@ -575,19 +629,26 @@ So, here’s the actual code for the tasklist: :PROPERTIES: :CUSTOM_ID: Theme_and_display-Screen_update-e162a27a :END: -When a screen’s geometry changes (e.g. when a different resolution is applied), the signal ~property::geometry~ is sent. When this is the case, the wallpaper should be redisplayed since it won’t necessarily fit the new geometry of the screen. And remember, I have a [[#Custom_functions-Wallpaper-related_functions-Restore_previous_wallpaper-8b5bc08c][function that does exactly that]]! Let’s connect this function to the geometry change signal: +When a screen’s geometry changes (e.g. when a different resolution is applied), +the signal ~property::geometry~ is sent. When this is the case, the wallpaper +should be redisplayed since it won’t necessarily fit the new geometry of the +screen. And remember, I have a [[#Custom_functions-Wallpaper-related_functions-Restore_previous_wallpaper-8b5bc08c][function that does exactly that]]! Let’s connect +this function to the geometry change signal: #+BEGIN_SRC lua screen.connect_signal("property::geometry", set_wallpaper) #+END_SRC -If a new screen gets connected, it will need to get a new wallpaper. A lot needs to be done, and all the following lines of code will be inside a block like this: +If a new screen gets connected, it will need to get a new wallpaper. A lot needs +to be done, and all the following lines of code will be inside a block like +this: #+BEGIN_SRC lua :tangle no awful.screen.connect_for_each_screen(function(s) -- Code to be executed goes here end) #+END_SRC -So, due the code block above, if you see any reference to ~s~ in the code blocks below, it will refer to the screen being set up by the function. +So, due the code block above, if you see any reference to ~s~ in the code blocks +below, it will refer to the screen being set up by the function. First, let’s set its wallpaper: #+NAME: screen-set-pape @@ -595,14 +656,17 @@ First, let’s set its wallpaper: set_wallpaper() #+END_SRC -Next, let’s build a list of tags for the screen. *Be aware that each screen has its own tag table!* The default layout will be the first refered to in -the layouts list described above]]. +Next, let’s build a list of tags for the screen. *Be aware that each screen has +its own tag table!* The default layout will be the first refered to in the +layouts list described above. #+NAME: screen-taglist #+BEGIN_SRC lua :tangle no awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }, s, awful.layout.layouts[1]) #+END_SRC -Next, let’s create the taglist widget. It will use the ~taglist_buttons~ [[#Top_bar-Tag_list-d43dbb62][declared above]] in order to handle clicks on tags, and due to the filter, all tags will be displayed in the tagbar ([[https://awesomewm.org/apidoc/widgets/awful.widget.taglist.html#List_filters][more about tag filters]]). +Next, let’s create the taglist widget. It will use the ~taglist_buttons~ +[[#Top_bar-Tag_list-d43dbb62][declared above]] in order to handle clicks on tags, and due to the filter, all +tags will be displayed in the tagbar ([[https://awesomewm.org/apidoc/widgets/awful.widget.taglist.html#List_filters][more about tag filters]]). #+NAME: screen-taglist-widget #+BEGIN_SRC lua :tangle no s.taglist = awful.widget.taglist { @@ -612,7 +676,10 @@ Next, let’s create the taglist widget. It will use the ~taglist_buttons~ [[#To } #+END_SRC -A tasklist widget will also get created thanks with the ~tasklist_button~ [[#Top_bar-Tag_list-d43dbb62][declared above]] that will handle clicks on tasks. Contrarily to the taglist widget above, the tasklist will only display the screen’s current tags thanks to its filter. +A tasklist widget will also get created thanks with the ~tasklist_button~ +[[#Top_bar-Tag_list-d43dbb62][declared above]] that will handle clicks on tasks. Contrarily to the taglist +widget above, the tasklist will only display the screen’s current tags thanks to +its filter. #+NAME: screen-tasklist-widget #+BEGIN_SRC lua :tangle no s.tasklist = awful.widget.tasklist { @@ -628,7 +695,11 @@ A promptbox will also be created for the screen: s.promptbox = awful.widget.prompt() #+END_SRC -Then, Let’s create an imagebox widget in which will be contained an icon indicating which layout is being used. We need one per screen. We will also make it clickable: if there is a left click or a scroll up detected above it, the next layout will be loaded; otherwise if a right click or a scroll down is detected, the previous layout will be loaded. +Then, Let’s create an imagebox widget in which will be contained an icon +indicating which layout is being used. We need one per screen. We will also make +it clickable: if there is a left click or a scroll up detected above it, the +next layout will be loaded; otherwise if a right click or a scroll down is +detected, the previous layout will be loaded. #+NAME: screen-layout-indicator #+BEGIN_SRC lua :tangle no s.layoutbox = awful.widget.layoutbox(s) @@ -645,7 +716,10 @@ Now it is time to create the widget, a ~wibox~ that will contain our bar. s.wibox = awful.wibar({ position = "top", screen = s }) #+END_SRC -Finally, let’s set up our bar. Since it is a horizontal bar, its layout will be horizontal too. Our launcher, taglist and promptbox will be part of the left widgets, while the tasklist will be at the center, and the keyboard indicator, the system tray, the clock and the layout indicator will be on the right. +Finally, let’s set up our bar. Since it is a horizontal bar, its layout will be +horizontal too. Our launcher, taglist and promptbox will be part of the left +widgets, while the tasklist will be at the center, and the keyboard indicator, +the system tray, the clock and the layout indicator will be on the right. #+NAME: screen-wibox-setup #+BEGIN_SRC lua :tangle no s.wibox:setup { @@ -685,18 +759,23 @@ In the end, our code looks like this: :PROPERTIES: :CUSTOM_ID: Mouse_bindings-eb4a69a8 :END: -It is possible with Awesome to bind some shortcuts to mouse events when the mouse is above Awesome itself (not above some client). Only one is set: the right click opens the Awesome menu. +It is possible with Awesome to bind some shortcuts to mouse events when the +mouse is above Awesome itself (not above some client). Only one is set: the +right click opens the Awesome menu. #+BEGIN_SRC lua root.buttons(gears.table.join( awful.button({}, 3, function() mainmenu:toggle() end) )) #+END_SRC -I will also set three mouse bindings for when the mouse is above a client: +I will also set three mouse bindings for when the mouse is above a client: - A simple click on a client will focus and raise it. -- A click on a client combined with a modkey press will allow the user to move a client after focusing it and making it floating. -- A middle click on a client combined with a modkey press will toggle the floating status of the client. -- A right click combined with the modkey will allow the user to resize a after focusing it and making it a floating client. +- A click on a client combined with a modkey press will allow the user to move a + client after focusing it and making it floating. +- A middle click on a client combined with a modkey press will toggle the + floating status of the client. +- A right click combined with the modkey will allow the user to resize a after + focusing it and making it a floating client. #+BEGIN_SRC lua clientbuttons = gears.table.join( @@ -723,22 +802,32 @@ I will also set three mouse bindings for when the mouse is above a client: :PROPERTIES: :CUSTOM_ID: Keybindings-a4e415b3 :END: -Keybindings allow the user to execute some Lua code all across Awesome. They all bear at least a list of modifier keys, the actual key to be pressed, the action they keybinding should yield, a description, and a group. The latter two will be useful for the keybindings help window which will display them all, sorted by group and with the description displayed next to the keybinding itself. +Keybindings allow the user to execute some Lua code all across Awesome. They all +bear at least a list of modifier keys, the actual key to be pressed, the action +they keybinding should yield, a description, and a group. The latter two will be +useful for the keybindings help window which will display them all, sorted by +group and with the description displayed next to the keybinding itself. -Here are some keybindings related to Awesome itself. Most of them will be described in tables, but due to some limitations from Org-mode (the Emacs mode used to write this document and generate my Awesome configuration), a few of them will be directly written as Lua code. +Here are some keybindings related to Awesome itself. Most of them will be +described in tables, but due to some limitations from Org-mode (the Emacs mode +used to write this document and generate my Awesome configuration), a few of +them will be directly written as Lua code. Here is a description of the tables displayed below: - Key :: key which toggles the shortcut - Modifiers :: modifier keys that are required to toggle the shortcut -- Lambda? :: whether or not the ~Action~ should be nested in a lambda function. Possible values are: +- Lambda? :: whether or not the ~Action~ should be nested in a lambda function. + Possible values are: - ~no~ :: The value is a Lua function to be executed as is - ~yes~ :: The value is to be inserted into a lambda - ~spawn~ :: The value is to be inserted in an ~awful.spawn~ call in a lambda - - ~shell~ :: The value is to be inserted in an ~awful.spawn.with_shell~ call in a lambda + - ~shell~ :: The value is to be inserted in an ~awful.spawn.with_shell~ call + in a lambda - Action :: code to be executed by the shortcut - What it does :: short description of the shortcut’s action - Group :: group in which the shortcut will appear in Awesome’s help window -- Clientkey? :: whether this should be a global shortcut or a shortcut only aimed at clients (value is ~yes~ or ~no~) +- Clientkey? :: whether this should be a global shortcut or a shortcut only + aimed at clients (value is ~yes~ or ~no~) #+NAME: gen-sc-text #+BEGIN_SRC emacs-lisp @@ -832,7 +921,9 @@ awful.key({modkey, control},"Return",function(c) c:swap(awful.client.getmaster() ",\n\n")) #+END_SRC -Most of these keybindings are available at root-level of Awesome and will be declared in the ~globalkeys~ variable, which will be added then to ~root.keys~ (see [[https://awesomewm.org/doc/api/libraries/root.html#keys]]). +Most of these keybindings are available at root-level of Awesome and will be +declared in the ~globalkeys~ variable, which will be added then to ~root.keys~ +(see [[https://awesomewm.org/doc/api/libraries/root.html#keys]]). #+BEGIN_SRC lua :cache yes globalkeys = gears.table.join( -- Awesome @@ -950,7 +1041,7 @@ Here will be declared some shortcuts directly related to Awesome itself. :PROPERTIES: :CUSTOM_ID: Keybindings-Clients-f9f96d60 :END: - These shortcuts are related to clients (aka windows) management. +These shortcuts are related to clients (aka windows) management. #+NAME: sc-client | Key | Modifiers | Lambda? | Action | What it does | Group | Clientkey? | |-----+------------------------+---------+----------------------------------+-------------------------------+--------+------------| @@ -1045,7 +1136,9 @@ Here will be declared some shortcuts directly related to Awesome itself. | t | modkey, control | no | awful.tag.viewprev | view prev | tag | | s | modkey, control | no | awful.tag.viewnext | view next | tag | -Another set of shortcuts is linked to the number row on the keyboard that allow the manipulation of the default tags that range from ~1~ to ~10~ (the latter is displayed as ~0~). Here is what the possible actions are: +Another set of shortcuts is linked to the number row on the keyboard that allow +the manipulation of the default tags that range from ~1~ to ~10~ (the latter is +displayed as ~0~). Here is what the possible actions are: #+NAME: sc-tag-num | Key | Modifiers | Action | What it does | Group | |--------+------------------------+---------------------------------+--------------------------------+-------| @@ -1058,7 +1151,10 @@ Another set of shortcuts is linked to the number row on the keyboard that allow :PROPERTIES: :CUSTOM_ID: Keybindings-Misc-0b45ce02 :END: -In this category you will find other keybindings that do not fit in other categories. For now, the only keybinding that is in this category is for toggling the touchpad’s tapping ability. This is linked to a special script I wrote [[file:bin.org::#Toggle_touchpad_tapping-23348b00][here]]. +In this category you will find other keybindings that do not fit in other +categories. For now, the only keybinding that is in this category is for +toggling the touchpad’s tapping ability. This is linked to a special script I +wrote [[file:bin.org::#Toggle_touchpad_tapping-23348b00][here]]. #+NAME: sc-misc | Key | Modifiers | Lambda? | Action | What it does | Group | |--------------------+-----------+---------+-----------+-------------------------+-------| @@ -1068,7 +1164,10 @@ In this category you will find other keybindings that do not fit in other catego :PROPERTIES: :CUSTOM_ID: Rules-c6142cdf :END: -With ~awful.rules~, users are able to describe some rules for window clients when the latter spawn, such as their placement, their properties or even execute a script. A rule can be applied through the ~manage~ signal, and they are all stored in ~awful.rules.rules~, the global rules table, as follows: +With ~awful.rules~, users are able to describe some rules for window clients +when the latter spawn, such as their placement, their properties or even execute +a script. A rule can be applied through the ~manage~ signal, and they are all +stored in ~awful.rules.rules~, the global rules table, as follows: #+BEGIN_SRC lua :tangle no awful.rules.rules = { -- Rules here @@ -1085,13 +1184,15 @@ With ~awful.rules~, users are able to describe some rules for window clients whe } #+END_SRC -For more documentation on rules and their syntax, you can read the [[https://awesomewm.org/doc/api/libraries/awful.rules.html][official documentation]]. +For more documentation on rules and their syntax, you can read the [[https://awesomewm.org/doc/api/libraries/awful.rules.html][official +documentation]]. ** Universal rules :PROPERTIES: :CUSTOM_ID: Rules-Universal_rules-50aad2ce :END: -The first rule is a universal rule which will match all clients, as you can see with its syntax below: +The first rule is a universal rule which will match all clients, as you can see +with its syntax below: #+BEGIN_SRC lua :tangle no { rule = {}, properties = { @@ -1100,7 +1201,8 @@ The first rule is a universal rule which will match all clients, as you can see } #+END_SRC -Here is the list of properties with their value to apply to all clients, and a short explanation as to what they do. +Here is the list of properties with their value to apply to all clients, and a +short explanation as to what they do. #+NAME: rules-universal-properties-table | Property | Value | What it does | |---------------+---------------------------------------------------------+-------------------------------------------------------------------------| @@ -1149,7 +1251,8 @@ This is what my universal rules look like: :PROPERTIES: :CUSTOM_ID: Rules-Floating_clients-49ab582e :END: -Some clients will be declared by default as floating windows. For this, we will declare a rule that will match any of the provided conditions: +Some clients will be declared by default as floating windows. For this, we will +declare a rule that will match any of the provided conditions: #+NAME: rules-floating-conditions-table | Property | Matches | Comment | |----------+--------------+----------------------------------------------------------------| @@ -1176,7 +1279,8 @@ Some clients will be declared by default as floating windows. For this, we will : name = { "Event Tester" }, : role = { "pop-up" } -If any of these conditions is matched, then the client will be set as floating, as you can see below: +If any of these conditions is matched, then the client will be set as floating, +as you can see below: #+NAME: rules-floating #+BEGIN_SRC lua :tangle no { rule_any = { @@ -1200,7 +1304,8 @@ Any normal or dialog client will get a titlebar. This is enabled like so: :PROPERTIES: :CUSTOM_ID: Rules-Default_tag_for_clients-6ded2a47 :END: -With the use of some rules, it is possible to define which client are assigned to which tag by default. +With the use of some rules, it is possible to define which client are assigned +to which tag by default. #+NAME: rules-default-tags-table | Client Property | Value | Tag | |-----------------+------------+-----| @@ -1240,29 +1345,36 @@ This is what these rules look like: :PROPERTIES: :CUSTOM_ID: Signals-e32971d6 :END: -Signals are a way for Awesome to handle events, such as client creation or deletion. +Signals are a way for Awesome to handle events, such as client creation or +deletion. ** Client creation :PROPERTIES: :CUSTOM_ID: Signals-Client_creation-8048ac12 :END: -When a new client is created, the ~manage~ signal is emited. When so, the following snippet ensures this new client is not off the screen, unless its position was deliberately set by a program or by the user. It will also spawn the new client where the mouse currently is. +When a new client is created, the ~manage~ signal is emited. When so, the +following snippet ensures this new client is not off the screen, unless its +position was deliberately set by a program or by the user. It will also spawn +the new client where the mouse currently is. #+BEGIN_SRC lua - client.connect_signal("manage", function (c) - awful.client.movetoscreen(c, mouse.screen) - if awesome.startup - and not c.size_hints.user_position - and not c.size_hints.program_position then - awful.placement.no_offscreen(c) - end - end) - #+END_SRC + client.connect_signal("manage", function (c) + awful.client.movetoscreen(c, mouse.screen) + if awesome.startup + and not c.size_hints.user_position + and not c.size_hints.program_position then + awful.placement.no_offscreen(c) + end + end) +#+END_SRC ** Titlebar creation :PROPERTIES: :CUSTOM_ID: Signals-Titlebar_creation-3b1aaa14 :END: -It is possible for Awesome to send request signals, such as the request to create titlebar (generally for new clients). The following snippet handles this titlebar creation if titlebar creation was set to ~true~ in the [[#Rules-c6142cdf][rules]]. For a detailed explanation of the code, see below. +It is possible for Awesome to send request signals, such as the request to +create titlebar (generally for new clients). The following snippet handles this +titlebar creation if titlebar creation was set to ~true~ in the [[#Rules-c6142cdf][rules]]. For a +detailed explanation of the code, see below. #+BEGIN_SRC lua client.connect_signal("request::titlebars", function(c) local buttons = gears.table.join( @@ -1273,14 +1385,19 @@ It is possible for Awesome to send request signals, such as the request to creat end) #+END_SRC -The function has two main parts: the creation of the titlebar buttons (mouse handling on the titlebar), and the creation of the titlebar itself. The creation of the button is done by creating a local variable ~buttons~ which will be a table created by the library ~gears~, in which will be buttons created by the user. +The function has two main parts: the creation of the titlebar buttons (mouse +handling on the titlebar), and the creation of the titlebar itself. The creation +of the button is done by creating a local variable ~buttons~ which will be a +table created by the library ~gears~, in which will be buttons created by the +user. #+BEGIN_SRC lua :tangle no local buttons = gears.table.join( -- Buttons declared here ) #+END_SRC -You can see a left click will enable the user to raise the window, but also it will enable the user to move the window (if it is floating of course). +You can see a left click will enable the user to raise the window, but also it +will enable the user to move the window (if it is floating of course). #+NAME: signal-titlebar-button1 #+BEGIN_SRC lua :tangle no awful.button({ }, 1, function() @@ -1289,7 +1406,8 @@ You can see a left click will enable the user to raise the window, but also it w end) #+END_SRC -A right click on the titlebar will also raise the window, but will instead allow the user to resize the client. +A right click on the titlebar will also raise the window, but will instead allow +the user to resize the client. #+NAME: signal-titlebar-button3 #+BEGIN_SRC lua :tangle no awful.button({ }, 3, function() @@ -1298,7 +1416,9 @@ A right click on the titlebar will also raise the window, but will instead allow end) #+END_SRC -Next comes the actual creation of the titlebar for the client ~c~. For that, we call ~awful.titlebar()~, tell it where the titlebar should be relative to the client and what its setup should be. The full call should look like so: +Next comes the actual creation of the titlebar for the client ~c~. For that, we +call ~awful.titlebar()~, tell it where the titlebar should be relative to the +client and what its setup should be. The full call should look like so: #+NAME: signal-titlebar-create #+BEGIN_SRC lua :tangle no awful.titlebar(c, {position="left", size = 22}) : setup { @@ -1306,18 +1426,24 @@ Next comes the actual creation of the titlebar for the client ~c~. For that, we } #+END_SRC -In the setup, I need to repeat to Awesome the titlebar should be on the left of the client, and I also tell it the layout alignment of the titlebar will be vertical, because I like vertial titlebars. I also first send it three tables: +In the setup, I need to repeat to Awesome the titlebar should be on the left of +the client, and I also tell it the layout alignment of the titlebar will be +vertical, because I like vertial titlebars. I also first send it three tables: - The top or left elements of the titlebar (here the top) - The middle elements of the titlebar - The bottom or right elements of the titlebar (here the bottom) -You can notice in the setup’s code below that I haven’t included anything in the middle elements, the only elements I am interested in are the top and bottom elements. In the top elements, I have (top to bottom): +You can notice in the setup’s code below that I haven’t included anything in the +middle elements, the only elements I am interested in are the top and bottom +elements. In the top elements, I have (top to bottom): - A close button - A maximize button - A minimize button - And an indication to Awesome these elements should be vertically aligned -To make Awesome happy, I also must indicate that the middle elements are vertically aligned, and then I can declare my bottom elements: +To make Awesome happy, I also must indicate that the middle elements are +vertically aligned, and then I can declare my bottom elements: - A button for toggling client floating -- And again the indication to Awesome these elements should be vertically aligned +- And again the indication to Awesome these elements should be vertically + aligned #+NAME: signal-titlebar-setup #+BEGIN_SRC lua :tangle no { -- Top @@ -1341,14 +1467,20 @@ To make Awesome happy, I also must indicate that the middle elements are vertica :PROPERTIES: :CUSTOM_ID: Signals-Changes_of_focus-1b73902c :END: -The default Awesome configuration enables the following snippet of code that makes windows hovered by the user’s mouse focused. Just for completeness’ sake, I included it in this document, but be aware this won’t be tangled into my configuration file and focus will not follow my mouse. +The default Awesome configuration enables the following snippet of code that +makes windows hovered by the user’s mouse focused. Just for completeness’ sake, +I included it in this document, but be aware this won’t be tangled into my +configuration file and focus will not follow my mouse. #+BEGIN_SRC lua :tangle no client.connect_signal("mouse::enter", function(c) c:emit_signal("request::activate", "mouse_enter", {raise = false}) end) #+END_SRC -It is also possible to change the color of the borders based on client focus. While my clients don’t have any border, they do have a titlebar which color changes based on the client’s focus. This is handled by the following code snippet: +It is also possible to change the color of the borders based on client focus. +While my clients don’t have any border, they do have a titlebar which color +changes based on the client’s focus. This is handled by the following code +snippet: #+BEGIN_SRC lua client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) @@ -1358,7 +1490,10 @@ It is also possible to change the color of the borders based on client focus. Wh :PROPERTIES: :CUSTOM_ID: Autostart-f2cf42fe :END: -By simply adding a line requesting to spawn a command, it is possible to create some autolaunch. All of my autolaunched apps are launch through a custom script which you can [[file:~/org/config/bin.org::#Autostart-a99e99e7][find here]]. The command gets called with ~awful.spawn.with_shell()~, as you can see below. +By simply adding a line requesting to spawn a command, it is possible to create +some autolaunch. All of my autolaunched apps are launch through a custom script +which you can [[file:~/org/config/bin.org::#Autostart-a99e99e7][find here]]. The command gets called with +~awful.spawn.with_shell()~, as you can see below. #+BEGIN_SRC lua awful.spawn.with_shell("autostart") #+END_SRC diff --git a/org/config/bin.org b/org/config/bin.org index 1b1532f..6029491 100644 --- a/org/config/bin.org +++ b/org/config/bin.org @@ -11,14 +11,20 @@ :PROPERTIES: :CUSTOM_ID: Presentation-721f3cc4 :END: -This file will present all the executable scripts I wrote. It is also their original source code, all the following code snippets are exported and tangled from this file to the actual executables. +This file will present all the executable scripts I wrote. It is also their +original source code, all the following code snippets are exported and tangled +from this file to the actual executables. * Autostart :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/autostart :CUSTOM_ID: Autostart-a99e99e7 :END: -Because I sometimes switch from window manager to window manager, creating a script that handles by itself autostarting things for me is way easier than rewriting every time the autostart part of my configuration. As you can every instance will be launched asynchronously, and only if there is no other instance of said command running. +Because I sometimes switch from window manager to window manager, creating a +script that handles by itself autostarting things for me is way easier than +rewriting every time the autostart part of my configuration. As you can every +instance will be launched asynchronously, and only if there is no other instance +of said command running. ~set-screens~ is a custom script declared [[*set-screens][below]]. #+NAME: autostart-table @@ -66,7 +72,9 @@ mpc stop & xwallpaper --zoom (cat $HOME/.cache/wallpaper) & #+end_example -I also have an external sound card, a Scarlet 2i2 G3, that I would like to use as my default audio output. However, it might not be always connected, hence the following code: +I also have an external sound card, a Scarlet 2i2 G3, that I would like to use +as my default audio output. However, it might not be always connected, hence the +following code: #+NAME: default-soundcard #+BEGIN_SRC fish :tangle no set SOUNDCARD "alsa_output.usb-Focusrite_Scarlett_2i2_USB_Y8KJ6NH094EF1C-00.analog-stereo" @@ -89,7 +97,9 @@ I also have an external sound card, a Scarlet 2i2 G3, that I would like to use a :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/backup :CUSTOM_ID: Backup-68c7c63e :END: -~backup~ is a very simple, oneliner script that will create a local copy of a file and add the date at which it was copied in the filename. You can see its source code here: +~backup~ is a very simple, oneliner script that will create a local copy of a +file and add the date at which it was copied in the filename. You can see its +source code here: #+BEGIN_SRC fish cp -r $argv[1] $argv[1].bak.(date +"%Y%m%d%H%M%S") #+END_SRC @@ -103,13 +113,18 @@ I also have an external sound card, a Scarlet 2i2 G3, that I would like to use a :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :tangle no :CUSTOM_ID: Cppnew-964e697b :END: -=cppnew= is a small utility that helps you create a new C++ project. Several templates are available, the default one using CMake, and three others that are a bit more advances, based on: +=cppnew= is a small utility that helps you create a new C++ project. Several +templates are available, the default one using CMake, and three others that are +a bit more advances, based on: - CMake + [[https://conan.io/][Conan]] - [[https://mesonbuild.com/][Meson]] + [[https://ninja-build.org/][Ninja]] - Meson + Ninja + Conan -There is also a default [[http://doxygen.nl/][Doxygen]] file included for your documentation, ready to go. I even made it so that you can execute it as an executable file, like =./doc/Doxyfile= from the project root. +There is also a default [[http://doxygen.nl/][Doxygen]] file included for your documentation, ready to +go. I even made it so that you can execute it as an executable file, like +=./doc/Doxyfile= from the project root. -The choice is given to the user which of them to use with options that will be given to =cppnew=. +The choice is given to the user which of them to use with options that will be +given to =cppnew=. First of all, if no arguments were passed, return an error. #+begin_src fish @@ -118,14 +133,17 @@ First of all, if no arguments were passed, return an error. end #+end_src -Now, let’s set a couple of variables which will prove useful later on when trying to set up our project. +Now, let’s set a couple of variables which will prove useful later on when +trying to set up our project. *** Cnew :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/cnew :CUSTOM_ID: Cnew-d9ec9cc4 :END: -=cnew= is a small utility script similar to but simpler than cppnew that creates a CMake template C project from the template that already exists in [[file:~/dev/templateC][~/dev/templateC]]. If no argument was passed, display an error message and exit. +=cnew= is a small utility script similar to but simpler than cppnew that creates +a CMake template C project from the template that already exists in +[[file:~/dev/templateC][~/dev/templateC]]. If no argument was passed, display an error message and exit. #+BEGIN_SRC fish if ! count $argv > /dev/null echo "Missing argument: PROJECT" && return -1 @@ -137,7 +155,8 @@ Pass the first argument to a switch statement. switch "$argv[1]" #+END_SRC -If the argument is =-h= or =--help=, then display the help message and exit the script normally. +If the argument is =-h= or =--help=, then display the help message and exit the +script normally. #+BEGIN_SRC fish case -h --help man ~/dev/fishfunctions/cnew.man @@ -155,13 +174,15 @@ Let’s close the switch statement. end #+END_SRC -Now, let’s copy the template where the user is executing =cnew= from, give it the name of the project and move to the project. +Now, let’s copy the template where the user is executing =cnew= from, give it +the name of the project and move to the project. #+BEGIN_SRC fish cp -r ~/dev/templateC $argv[1] cd $argv[1] #+END_SRC -The default files have a placeholder for the name of the project. Let’s replace these placeholders with the project’s name. +The default files have a placeholder for the name of the project. Let’s replace +these placeholders with the project’s name. #+BEGIN_SRC fish sed -i "s/PROJECTNAME/$argv[1]/g" CMakeLists.txt sed -i "s/PROJECTNAME/$argv[1]/g" README.org @@ -182,12 +203,15 @@ And we’re done! :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/dart_language_server :CUSTOM_ID: Dart_Language_Server-18c256b1 :END: -Spacemacs' recommendations on how to use Dart with LSP is outdated, since [[https://github.com/natebosch/dart_language_server][=dart_language_server=]] is obsolete. As recommended by the repo owner, we should launch instead the following code: +Spacemacs' recommendations on how to use Dart with LSP is outdated, since +[[https://github.com/natebosch/dart_language_server][=dart_language_server=]] is obsolete. As recommended by the repo owner, we should +launch instead the following code: #+BEGIN_SRC fish /usr/bin/dart $DART_SDK/snapshots/analysis_server.dart.snapshot --lsp #+END_SRC -So, instead of using the obsolete executable, instead we will be calling the analysis server as requested. +So, instead of using the obsolete executable, instead we will be calling the +analysis server as requested. *** UpdateFlutter :PROPERTIES: @@ -214,13 +238,22 @@ This is a simple utility to be ran when the ~flutter~ package is updated. :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/set-screens :CUSTOM_ID: set-screens-01bd989a :END: -~set-screens~ is a small script that allows the user to automatically set up an external monitor. First, let’s set some variables so we don’t have to type in hidden places some values that should be easily modifiable. +~set-screens~ is a small script that allows the user to automatically set up an +external monitor. First, let’s set some variables so we don’t have to type in +hidden places some values that should be easily modifiable. #+BEGIN_SRC fish set internal "eDP1" set external "HDMI1" #+END_SRC -Now, let’s set the ~DETECTEDSCREEN~ variable with a simple ~grep~. If the variable turns out to be empty, this means the display was not detected. However, if it’s not, then it will be an array with its second value that holds the maximum resolution the display can handle. It needs to be passed through ~awk~ in order to get only the resolution itself and not the refresh rate, but once we’ve got that, we can set our external monitor as the main monitor with its maximum resolution. i3 is also restarted in order to properly display the wallpaper and Polybar on the new screen. +Now, let’s set the ~DETECTEDSCREEN~ variable with a simple ~grep~. If the +variable turns out to be empty, this means the display was not detected. +However, if it’s not, then it will be an array with its second value that holds +the maximum resolution the display can handle. It needs to be passed through +~awk~ in order to get only the resolution itself and not the refresh rate, but +once we’ve got that, we can set our external monitor as the main monitor with +its maximum resolution. i3 is also restarted in order to properly display the +wallpaper and Polybar on the new screen. #+BEGIN_SRC fish set externaldisplay (xrandr -q --current | grep -A 1 -i "$external connected") if test -n "$externaldisplay" @@ -234,7 +267,10 @@ Now, let’s set the ~DETECTEDSCREEN~ variable with a simple ~grep~. If the vari :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/sshbind :CUSTOM_ID: sshbind-756fabb1 :END: -Something that I did not know for quite some time but that is actually crazy useful about SSH is its ability to bind locally the port of a remote machine, and vice versa. The syntax is actually very simple, but I prefer a more intuitive way of writing it. Its usage is ~sshbind PORT FROMHOST TOHOST~. +Something that I did not know for quite some time but that is actually crazy +useful about SSH is its ability to bind locally the port of a remote machine, +and vice versa. The syntax is actually very simple, but I prefer a more +intuitive way of writing it. Its usage is ~sshbind PORT FROMHOST TOHOST~. #+BEGIN_SRC fish ssh -L $argv[1]:$argv[3]:$argv[1] $argv[2] -N #+END_SRC @@ -244,7 +280,8 @@ Something that I did not know for quite some time but that is actually crazy use :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/starwars :CUSTOM_ID: Starwars-654f8637 :END: -This is a one-liner that allows you to watch Star Wars episode 4 in ASCII art in your terminal. Here is the code: +This is a one-liner that allows you to watch Star Wars episode 4 in ASCII art in +your terminal. Here is the code: #+BEGIN_SRC fish telnet towel.blinkenlights.nl #+END_SRC @@ -254,9 +291,16 @@ This is a one-liner that allows you to watch Star Wars episode 4 in ASCII art in :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/tttapping :CUSTOM_ID: Toggle_touchpad_tapping-23348b00 :END: -For some reasons, my firmware does not recognize the function key for toggling the touchpad. I’m not going to really complain about it since it lets me program it like I want. Since I often don’t need to completely deactivate the touchpad, I’ll instead toggle whether tapping is enabled or not when pressing ~XF86TouchpadToggle~. And for that, I need this small script that will actually toggle it, and it will be used in my window manager configuration. +For some reasons, my firmware does not recognize the function key for toggling +the touchpad. I’m not going to really complain about it since it lets me program +it like I want. Since I often don’t need to completely deactivate the touchpad, +I’ll instead toggle whether tapping is enabled or not when pressing +~XF86TouchpadToggle~. And for that, I need this small script that will actually +toggle it, and it will be used in my window manager configuration. -First let’s declare some variables to make this script more personal. With my current computer (a Gazelle by System76), the name of my touchpad is the following: +First let’s declare some variables to make this script more personal. With my +current computer (a Gazelle by System76), the name of my touchpad is the +following: #+BEGIN_SRC fish set TPNAME "ELAN0412:00 04F3:3162 Touchpad" #+END_SRC @@ -272,7 +316,8 @@ Now, let’s detect the current status of the touchpad: grep -v "Default" | awk '{print $5}') #+END_SRC -This will set ~TPSTATUS~ either to ~0~, meaning tapping is disabled, or to ~1~, meaning it’s enabled. I will consider any other value as being disabled. +This will set ~TPSTATUS~ either to ~0~, meaning tapping is disabled, or to ~1~, +meaning it’s enabled. I will consider any other value as being disabled. #+BEGIN_SRC fish test [[ $TPSTATUS = "1" ]] && set NEWTPSTATUS 0 || set NEWTPSTATUS 1 #+END_SRC @@ -287,25 +332,29 @@ Finally, let’s update the touchpad’s options: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/wacom-setup :CUSTOM_ID: Wacom_setup-331fb024 :END: -I made a small and quick utility to set up my Wacom tablet so it is only bound to one screen. +I made a small and quick utility to set up my Wacom tablet so it is only bound +to one screen. *** Set our variables :PROPERTIES: :CUSTOM_ID: Wacom_setup-Set_our_variables-3cb6d58e :END: -We need some variables in order to correctly set our tablet. First, let’s get declare what the name of our tablet is, and what the name of its touchpad is. +We need some variables in order to correctly set our tablet. First, let’s get +declare what the name of our tablet is, and what the name of its touchpad is. #+BEGIN_SRC fish set -g DEVICE "Wacom Co.,Ltd. Bamboo Pad, USB stylus" set -g DEVICETOUCH "Wacom USB Bamboo PAD Finger touch" #+END_SRC -We will also modify two settings: the speed of the cursor on the touchpad, and the scroll speed. Let’s declare the name of these two settings. +We will also modify two settings: the speed of the cursor on the touchpad, and +the scroll speed. Let’s declare the name of these two settings. #+BEGIN_SRC fish set -g WACOMPROPTOUCHSPEED "Device Accel Velocity Scaling" set -g WACOMPROPSCROLLPSEED "ScrollDistance" #+END_SRC -To get the correct values for the area it can cover, we’ll need to reset our tablet. +To get the correct values for the area it can cover, we’ll need to reset our +tablet. #+BEGIN_SRC fish xsetwacom set "$DEVICE" ResetArea #+END_SRC @@ -321,7 +370,9 @@ Now we can get the X and Y areas. :PROPERTIES: :CUSTOM_ID: Wacom_setup-Select_our_screen-7822c0c3 :END: -This function will allow us to select the screen on which the tablet will be active. We can also select the option “desktop” so that all screens are selected. Let’s declare our function. +This function will allow us to select the screen on which the tablet will be +active. We can also select the option “desktop” so that all screens are +selected. Let’s declare our function. #+BEGIN_SRC fish function set_screen #+END_SRC @@ -369,18 +420,24 @@ end :PROPERTIES: :CUSTOM_ID: Wacom_setup-Adjust_the_tablet-342acaf3 :END: -This function will take care of adjusting our tablet to our screen. Let’s declare our function. +This function will take care of adjusting our tablet to our screen. Let’s +declare our function. #+BEGIN_SRC fish function adjust_device #+END_SRC -If our screen is too high or too wide for our tablet, we will have to adjust the height or width of the area used by the tablet. So let’s get the theoretical new height and width of the area. +If our screen is too high or too wide for our tablet, we will have to adjust the +height or width of the area used by the tablet. So let’s get the theoretical new +height and width of the area. #+BEGIN_SRC fish set RATIOAREAY (math ceil \($AREAX \* $HEIGHT \/ $WIDTH\)) set RATIOAREAX (math ceil \($AREAY \* $WIDTH \/ $HEIGHT\)) #+END_SRC -Now, if the current height of the tablet’s area is greater than the theoretical new area, it means the current area is too high. Otherwise, it should be the other way around. Let’s set =NEWAREAX= and =NEWAREAY= that will be used to set the new area for the tablet. +Now, if the current height of the tablet’s area is greater than the theoretical +new area, it means the current area is too high. Otherwise, it should be the +other way around. Let’s set =NEWAREAX= and =NEWAREAY= that will be used to set +the new area for the tablet. #+BEGIN_SRC fish if test $AREAY -gt $RATIOAREAY set -g NEWAREAX $AREAX @@ -399,7 +456,7 @@ Alright, now let’s set the new area with these new variables. Let’s slow down the cursor’s speed on the touchpad. #+BEGIN_SRC fish -xinput set-float-prop $DEVICETOUCH $WACOMPROPTOUCHSPEED 0.5 + xinput set-float-prop $DEVICETOUCH $WACOMPROPTOUCHSPEED 0.5 #+END_SRC Let’s also slow down the scroll speed of the touchpad. @@ -409,14 +466,15 @@ Let’s also slow down the scroll speed of the touchpad. Now, let’s close the function. #+BEGIN_SRC fish -end + end #+END_SRC *** Lauch the functions :PROPERTIES: :CUSTOM_ID: Wacom_setup-Lauch_the_functions-2ab8b4d9 :END: -Back to the main body of the script, we can now launch the functions sequencially. +Back to the main body of the script, we can now launch the functions +sequencially. #+BEGIN_SRC fish set_screen adjust_device @@ -432,7 +490,8 @@ When running this script, I get the following error: unable to find device Wacom USB Bamboo PAD Finger touch Cannot find device 'Wacom USB Bamboo PAD Finger touch'. #+END_SRC -The first one is caused by ~xsetwacom~. The second one, I do not know where I should find ~Wacom USB Bamboo PAD Finger touch~. +The first one is caused by ~xsetwacom~. The second one, I do not know where I +should find ~Wacom USB Bamboo PAD Finger touch~. * Emacs stuff :PROPERTIES: @@ -452,7 +511,8 @@ The first one is caused by ~xsetwacom~. The second one, I do not know where I sh :HEADER-ARGS: :shebang "#!/bin/bash" :mkdirp yes :tangle ~/.local/bin/emacsmail :CUSTOM_ID: Emacsmail-afffb7cd :END: -This short script is used in my =~/.local/share/applications/mu4e.desktop= file in order to send to Emacs any ~mailto:~ requests made in my system. +This short script is used in my =~/.local/share/applications/mu4e.desktop= file +in order to send to Emacs any ~mailto:~ requests made in my system. #+BEGIN_SRC bash emacsclient -c --eval "(browse-url-mail \"$@\")" #+END_SRC @@ -466,7 +526,8 @@ This short script is used in my =~/.local/share/applications/mu4e.desktop= file :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/mp42webm :CUSTOM_ID: mp42webm-aeacca58 :END: -This function allows me to convert easily an mp4 video to the webm format. Nothing too fancy here. +This function allows me to convert easily an mp4 video to the webm format. +Nothing too fancy here. #+BEGIN_SRC fish ffmpeg -i $argv[1] -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis $argv[1].webm #+END_SRC @@ -480,7 +541,9 @@ This function allows me to convert easily an mp4 video to the webm format. Nothi :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/ytplay :CUSTOM_ID: Weather-4ed00bb0 :END: -~ytplay~ is a simple script I’ve written that allows me to play in mpv any YouTube video at the desired resolution. The script relies on ~dmenu~ (or ~rofi~ in dmenu-mode), ~youtube-dl~ and of course ~mpv~ itself. +~ytplay~ is a simple script I’ve written that allows me to play in mpv any +YouTube video at the desired resolution. The script relies on ~dmenu~ (or ~rofi~ +in dmenu-mode), ~youtube-dl~ and of course ~mpv~ itself. #+BEGIN_SRC fish set URL (rofi -dmenu -i -p "Video URL") if test -n "$URL" @@ -515,15 +578,24 @@ I’ll even add a ~.desktop~ entry for this script: :HEADER-ARGS:EMACS-LISP: :exports none :tangle no :CUSTOM_ID: ytdl-a-youtube-dl-wrapper-03bd63e0 :END: -This script is a wrapper around ~youtube-dl~ which I use mainly for archiving YouTube videos on my NAS (at the time I’m writing this, I have already 2.1TB worth of videos archived). The principle behind this script is quite simple: I want to avoid as much as possible to redownload any video already downloaded in order to avoid pinging too much YouTube’s servers, 429 Too Many Requests errors are really annoying, and it comes really early when you have only a couple of new videos to download among the few 14k videos already downloaded. +This script is a wrapper around ~youtube-dl~ which I use mainly for archiving +YouTube videos on my NAS (at the time I’m writing this, I have already 2.1TB +worth of videos archived). The principle behind this script is quite simple: I +want to avoid as much as possible to redownload any video already downloaded in +order to avoid pinging too much YouTube’s servers, 429 Too Many Requests errors +are really annoying, and it comes really early when you have only a couple of +new videos to download among the few 14k videos already downloaded. -Be aware this script was written for the Fish shell (3.1.0 and above), and makes use of youtube-dl 2020.03.24 and above, [[https://github.com/jorgebucaran/fish-getopts][Fish getopts]] and [[https://github.com/BurntSushi/ripgrep][ripgrep]]. +Be aware this script was written for the Fish shell (3.1.0 and above), and makes +use of youtube-dl 2020.03.24 and above, [[https://github.com/jorgebucaran/fish-getopts][Fish getopts]] and [[https://github.com/BurntSushi/ripgrep][ripgrep]]. **** Setting default values :PROPERTIES: :CUSTOM_ID: ytdl-a-youtube-dl-wrapper-Setting-default-values-da404639 :END: -Some variables in this script will have default values, we do not want to have a mile-long command each time we wish to download a single video. We’ll also set some global variables that won’t change: +Some variables in this script will have default values, we do not want to have a +mile-long command each time we wish to download a single video. We’ll also set +some global variables that won’t change: #+NAME: ytdl-default-vars | Variable Name | Default Value | String? | |------------------+-----------------------------------------------------------+---------| @@ -535,7 +607,8 @@ Some variables in this script will have default values, we do not want to have a | PREFFERED_FORMAT | bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio | yes | | VERSION | 0.3 | yes | -There is one more default variable pointing to ytdl’s root directory which depends on whether the videos directory has a French or English name: +There is one more default variable pointing to ytdl’s root directory which +depends on whether the videos directory has a French or English name: #+NAME: ytdl-default-vars-root #+BEGIN_SRC fish :tangle no if test -d "$HOME/Vidéos" @@ -571,7 +644,8 @@ There is one more default variable pointing to ytdl’s root directory which dep <> #+END_SRC -We’ll also create the directory pointed at by ~YTDL_SHARED_DIR~ if it doesn’t exist already: +We’ll also create the directory pointed at by ~YTDL_SHARED_DIR~ if it doesn’t +exist already: #+BEGIN_SRC fish mkdir -p $YTDL_SHARED_DIR #+END_SRC @@ -580,7 +654,8 @@ We’ll also create the directory pointed at by ~YTDL_SHARED_DIR~ if it doesn’ :PROPERTIES: :CUSTOM_ID: ytdl-a-youtube-dl-wrapper-Help-message-3773aacd :END: -The next step is displaying the help message for the script. For that, just a long string echo’d will do, wrapped in the function ~_ytdl_help~. +The next step is displaying the help message for the script. For that, just a +long string echo’d will do, wrapped in the function ~_ytdl_help~. #+BEGIN_SRC fish function _ytdl_help echo "Usage: ytdl [OPTION]... URL [URL]... @@ -633,7 +708,8 @@ The next step is displaying the help message for the script. For that, just a lo end #+END_SRC -We also have the function ~_ytdl_version~ to display the current version of ~ytdl~: +We also have the function ~_ytdl_version~ to display the current version of +~ytdl~: #+BEGIN_SRC fish function _ytdl_version echo "ytdl 0.3, developped for fish 3.1.0 and youtube-dl 2020.03.24 or newer" @@ -646,7 +722,10 @@ We also have the function ~_ytdl_version~ to display the current version of ~ytd :PROPERTIES: :CUSTOM_ID: ytdl-a-youtube-dl-wrapper-Arguments-Handling-1daebbe8 :END: -The function ~_ytdl_parse_ops~ is a little bit trickier: we use ~getopts~ to parse the arguments passed to the script in order to get some preferences from the user. Here is a quick reference on what options are available and what they do: +The function ~_ytdl_parse_ops~ is a little bit trickier: we use ~getopts~ to +parse the arguments passed to the script in order to get some preferences from +the user. Here is a quick reference on what options are available and what they +do: #+NAME: ytdl-table-arguments | Short | Long | Takes a value? | Associated Variable | Default Value | What it does | |-------+------------+----------------+---------------------+-------------------+----------------------| @@ -662,7 +741,8 @@ The function ~_ytdl_parse_ops~ is a little bit trickier: we use ~getopts~ to par | v | version | command | None | None | Script version | | h | help | command | None | None | Display this message | -We can also pass individual YouTube URLs without any options or switches associated to them, they will be downloaded as part of a single queue. +We can also pass individual YouTube URLs without any options or switches +associated to them, they will be downloaded as part of a single queue. #+NAME: ytdl-arg-handling-gen #+BEGIN_SRC emacs-lisp :var args=ytdl-table-arguments @@ -708,7 +788,8 @@ case h help _ytdl_help && exit #+end_example -The following shows how ~getopts~ is used to catch the options and switches passed to the script: +The following shows how ~getopts~ is used to catch the options and switches +passed to the script: #+NAME: ytdl-getopts #+BEGIN_SRC fish :noweb yes :tangle no getopts $argv | while read -l key value @@ -761,7 +842,8 @@ if set -q $VERBOSE end #+end_example -Some values need to be set to their default, so let’s assign them their value if no user value was passed: +Some values need to be set to their default, so let’s assign them their value if +no user value was passed: #+NAME: ytdl-arg-set-default-value #+BEGIN_SRC fish :noweb yes :tangle no <> @@ -780,7 +862,10 @@ Both these code blocks are executed in ~_ytdl_parse_ops~: :PROPERTIES: :CUSTOM_ID: ytdl-a-youtube-dl-wrapper-Logging-f4b9815e :END: -~_ytdl_log~ is a very simple function used for logging information for the user in the file pointed to by ~LOGFILE~. The first argument the function should receive is its log level. I generally use either ~"INFO"~ or ~"ERR"~. The second argument is the message to log. +~_ytdl_log~ is a very simple function used for logging information for the user +in the file pointed to by ~LOGFILE~. The first argument the function should +receive is its log level. I generally use either ~"INFO"~ or ~"ERR"~. The second +argument is the message to log. #+BEGIN_SRC fish function _ytdl_log set -l INFOLEVEL $argv[1] @@ -797,9 +882,20 @@ Both these code blocks are executed in ~_ytdl_parse_ops~: :PROPERTIES: :CUSTOM_ID: ytdl-a-youtube-dl-wrapper-Download-a-Single-Video-afedf321 :END: -In order to download a single video, a simple function has been written for this that will display when downloaded how far it is down the list of videos to be downloaded and it will add its ID to the file listing all videos downloaded. The script will also try to download the video according to the ~PREFFERED_FORMAT~ variable, but if the download fails it will download the default format selected by ~youtube-dl~. If both downloads fail, the ID of the video will be added to the list of failed videos. If one of the downloads succeeds, it will remove the ID from the list of failed downloads. +In order to download a single video, a simple function has been written for this +that will display when downloaded how far it is down the list of videos to be +downloaded and it will add its ID to the file listing all videos downloaded. The +script will also try to download the video according to the ~PREFFERED_FORMAT~ +variable, but if the download fails it will download the default format selected +by ~youtube-dl~. If both downloads fail, the ID of the video will be added to +the list of failed videos. If one of the downloads succeeds, it will remove the +ID from the list of failed downloads. -The first argument of the function is the video ID from YouTube, the second argument is the position of the video in the queue, and the third argument is the queue length –can be the amount of videos in a whole YouTube channel, the amount of videos in a playlist, or simply the amount of YouTube URLs passed as arguments to the script. +The first argument of the function is the video ID from YouTube, the second +argument is the position of the video in the queue, and the third argument is +the queue length –can be the amount of videos in a whole YouTube channel, the +amount of videos in a playlist, or simply the amount of YouTube URLs passed as +arguments to the script. #+BEGIN_SRC fish function _ytdl_download_video set ID $argv[1] @@ -815,13 +911,18 @@ The first argument of the function is the video ID from YouTube, the second argu end #+END_SRC -/Note that this function is not meant to be called without any checks before./ It is meant to be called by ~_ytdl_download_queue~ described below. +/Note that this function is not meant to be called without any checks before./ +It is meant to be called by ~_ytdl_download_queue~ described below. **** Download a Queue of Videos :PROPERTIES: :CUSTOM_ID: ytdl-a-youtube-dl-wrapper-Download-a-Queue-of-Videos-6ef8d51f :END: -One of the main goals of this tool is to check if a video has already been downloaded. This is why, as you will see below, we use ripgrep to check if the ID of the video we want to download is already present in the list of downloaded videos. If not, it will then be downloaded though ~_ytdl_download_video~ described above. +One of the main goals of this tool is to check if a video has already been +downloaded. This is why, as you will see below, we use ripgrep to check if the +ID of the video we want to download is already present in the list of downloaded +videos. If not, it will then be downloaded though ~_ytdl_download_video~ +described above. #+BEGIN_SRC fish function _ytdl_download_queue for i in (seq (count $argv)) @@ -837,7 +938,8 @@ One of the main goals of this tool is to check if a video has already been downl :PROPERTIES: :CUSTOM_ID: ytdl-a-youtube-dl-wrapper-Download-Videos-From-Arguments-57a5dac1 :END: -The main aim of this function is to transform the URLs contained in the arguments passed to the script to a list of IDs usable later on by ~ytdl~. +The main aim of this function is to transform the URLs contained in the +arguments passed to the script to a list of IDs usable later on by ~ytdl~. #+BEGIN_SRC fish function _ytdl_download_arg_urls set -g IDs @@ -853,9 +955,22 @@ The main aim of this function is to transform the URLs contained in the argument :PROPERTIES: :CUSTOM_ID: ytdl-a-youtube-dl-wrapper-Download-Videos-From-a-Batch-File-0f1382c4 :END: -The final function to declare before the main body of the script is ~_ytdl_download_batch~: it will look for each line, ignoring the ones beginning by ~#~, ~;~ and ~]~ (just like ~youtube-dl~) and will download them, assuming these are channel URLs or playlist URLs, however it should also work with direct video URLs. +The final function to declare before the main body of the script is +~_ytdl_download_batch~: it will look for each line, ignoring the ones beginning +by ~#~, ~;~ and ~]~ (just like ~youtube-dl~) and will download them, assuming +these are channel URLs or playlist URLs, however it should also work with direct +video URLs. -What this function does is for each line, it will fetch the entierty of the video IDs found in a playlist or channel. Then, it will look each ID up the list of already downloaded videos and will add all new IDs to a queue of videos to be downloaded. It will then pass each new video ID to ~_ytdl_download_video~ directly. Beware that if you pass directly the URL of the channel, such as ~https://www.youtube.com/user/enyay~ if you want to download Tom Scott’s videos, it will download everything on the main page of their channel, which means it will even download videos from playlists they decided to put on their channel’s front page, even if it is not theirs. So in that case, we need to append ~/videos~ to any channel URL. +What this function does is for each line, it will fetch the entierty of the +video IDs found in a playlist or channel. Then, it will look each ID up the list +of already downloaded videos and will add all new IDs to a queue of videos to be +downloaded. It will then pass each new video ID to ~_ytdl_download_video~ +directly. Beware that if you pass directly the URL of the channel, such as +~https://www.youtube.com/user/enyay~ if you want to download Tom Scott’s videos, +it will download everything on the main page of their channel, which means it +will even download videos from playlists they decided to put on their channel’s +front page, even if it is not theirs. So in that case, we need to append +~/videos~ to any channel URL. #+BEGIN_SRC fish function _ytdl_download_batch set -q $FILE @@ -890,20 +1005,26 @@ What this function does is for each line, it will fetch the entierty of the vide :PROPERTIES: :CUSTOM_ID: ytdl-a-youtube-dl-wrapper-Main-Body-8a06cb9e :END: -Now that we have all our functions declared, let’s call them! First, we need to parse our arguments. We’ll then download all files passed as arguments. Finally, we’ll download videos, playlists and channels specified from a batch file. +Now that we have all our functions declared, let’s call them! First, we need to +parse our arguments. We’ll then download all files passed as arguments. Finally, +we’ll download videos, playlists and channels specified from a batch file. #+BEGIN_SRC fish _ytdl_parse_ops $argv _ytdl_download_arg_urls $VIDEOS _ytdl_download_batch #+END_SRC -And that’s all! If you’re interested with a very simple interface for downloading one video once, I wrote a small [[#rofi-ytdl-ff8f789d][~rofi-ytdl~]] script that calls the ~rofi~ utility to specify a single link and download it. +And that’s all! If you’re interested with a very simple interface for +downloading one video once, I wrote a small [[#rofi-ytdl-ff8f789d][~rofi-ytdl~]] script that calls the +~rofi~ utility to specify a single link and download it. * Plock :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/plock :CUSTOM_ID: Lock-635fcb38 :END: -~plock~ is a simple script that locks the screen with ~i3lock~ while setting as the background image of the locked screen a corrupted screenshot of the screen before it was locked. +~plock~ is a simple script that locks the screen with ~i3lock~ while setting as +the background image of the locked screen a corrupted screenshot of the screen +before it was locked. #+BEGIN_SRC fish set TMPBG /tmp/screen.png scrot $TMPBG @@ -917,7 +1038,9 @@ And that’s all! If you’re interested with a very simple interface for downlo :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/polybar-launch :CUSTOM_ID: Polybar-launch-36789edc :END: -This scripts allows the user to kill polybar and relaunch it, or to simply launch it if polybar isn’t launched yet. First thing to do is kill all polybar processes. +This scripts allows the user to kill polybar and relaunch it, or to simply +launch it if polybar isn’t launched yet. First thing to do is kill all polybar +processes. #+BEGIN_SRC bash killall -q polybar #+END_SRC @@ -927,7 +1050,8 @@ Now we have to wait untill all polybar processes have been shut down. while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done #+END_SRC -Now that our system isn’t running polybar anymore, we’ll launch it again on all of our screens. By the way, I have two bars, so I’ll have to lauch them both. +Now that our system isn’t running polybar anymore, we’ll launch it again on all +of our screens. By the way, I have two bars, so I’ll have to lauch them both. #+BEGIN_SRC bash if type "xrandr"; then for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do @@ -954,7 +1078,10 @@ And we’re done! Let’s just launch a notification polybar has been relaunched :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/askpass :CUSTOM_ID: Askpass-d0d7a8c0 :END: -Askpass is a simple script that invokes ~rofi~ as a way to get from a GUI the user’s sudo password. It is inspired by [[https://github.com/ODEX-TOS/tools/blob/master/rofi/askpass][this original tool]], rewritten in fish and with [[https://wiki.archlinux.org/index.php/Rofi][rofi]] support instead of [[https://wiki.archlinux.org/index.php/Dmenu][dmenu]]. As you can see, this is a oneliner if we ignore the initial shebang. This executable is pointed at by the +Askpass is a simple script that invokes ~rofi~ as a way to get from a GUI the +user’s sudo password. It is inspired by [[https://github.com/ODEX-TOS/tools/blob/master/rofi/askpass][this original tool]], rewritten in fish +and with [[https://wiki.archlinux.org/index.php/Rofi][rofi]] support instead of [[https://wiki.archlinux.org/index.php/Dmenu][dmenu]]. As you can see, this is a oneliner if we +ignore the initial shebang. This executable is pointed at by the #+BEGIN_SRC fish rofi -dmenu -password -no-fixed-num-lines -p (printf $argv[1] | sed s/://) #+END_SRC @@ -964,9 +1091,20 @@ Askpass is a simple script that invokes ~rofi~ as a way to get from a GUI the us :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/awiki :CUSTOM_ID: awiki-7ac5e1d5 :END: -~awiki~ is a simple script used with ~rofi~ that relies on the ~arch-wiki-docs~ package in order to provide the user a way to quickly find and display any English page from the Arch Wiki in a browser. The advantage of using this over the ~wiki-search~ utility from the ~arch-wiki-lite~ package is you get instant suggestion in rofi using fuzzy-search. The downside is rofi will only help you find pages by their title, and it will not help you find keywords in the content of said pages. +~awiki~ is a simple script used with ~rofi~ that relies on the ~arch-wiki-docs~ +package in order to provide the user a way to quickly find and display any +English page from the Arch Wiki in a browser. The advantage of using this over +the ~wiki-search~ utility from the ~arch-wiki-lite~ package is you get instant +suggestion in rofi using fuzzy-search. The downside is rofi will only help you +find pages by their title, and it will not help you find keywords in the content +of said pages. -The first step is to create the list of all the pages that are currently stored on disk. ~arch-wiki-docs~ stores them in ~/usr/share/doc/arch-wiki/html/en~. A simple ~ls~ piped in three ~sed~ will give us a list of page titles. We then pipe that into rofi in dmenu mode in order to choose the page we want to display. By the way, setting the location of the HTML files will come in handy later. +The first step is to create the list of all the pages that are currently stored +on disk. ~arch-wiki-docs~ stores them in ~/usr/share/doc/arch-wiki/html/en~. A +simple ~ls~ piped in three ~sed~ will give us a list of page titles. We then +pipe that into rofi in dmenu mode in order to choose the page we want to +display. By the way, setting the location of the HTML files will come in handy +later. #+BEGIN_SRC fish set WLOCATION /usr/share/doc/arch-wiki/html/en/ set WPAGE (/bin/ls $WLOCATION | \ @@ -975,7 +1113,8 @@ The first step is to create the list of all the pages that are currently stored set WPAGE (echo $WPAGE | sed -r 's/\s+/_/g') #+END_SRC -Now, all I need to do is to send this list into rofi and tell it to open the result with our favorite browser with ~xdg-open~. +Now, all I need to do is to send this list into rofi and tell it to open the +result with our favorite browser with ~xdg-open~. #+BEGIN_SRC fish xdg-open $WLOCATION$WPAGE.html #+END_SRC @@ -985,15 +1124,18 @@ Now, all I need to do is to send this list into rofi and tell it to open the res :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/connect-wifi :CUSTOM_ID: ConnectWifi-16e5e24a :END: -~connect-wifi~ is a small utility tool that allows the user to connect to available WiFi networks. The first thing to do is to select the WiFi we want to connect to. We’ll use the ~nmcli c s~ command to get the list of the available networks, and we’ll chose one with ~rofi~. +~connect-wifi~ is a small utility tool that allows the user to connect to +available WiFi networks. The first thing to do is to select the WiFi we want to +connect to. We’ll use the ~nmcli c s~ command to get the list of the available +networks, and we’ll chose one with ~rofi~. #+BEGIN_SRC fish set SELECTEDWIFI (nmcli d w l | \ egrep -o '([0-9A-F]{2}:){5}[0-9A-F]{2}\s*(.*)Infra' | \ egrep -o '\s+(.*)\s+' | awk '{$1=$1}1' | \ rofi -dmenu -p "Select your WiFi network") #+END_SRC -Now, if a network was selected, let’s attempt to connect to it. Otherwise, -let’s just send a notification no network was selected. +Now, if a network was selected, let’s attempt to connect to it. Otherwise, let’s +just send a notification no network was selected. #+BEGIN_SRC fish if test -z $SELECTEDWIFI notify-send "No WiFi network selected" -u low && exit @@ -1011,7 +1153,9 @@ let’s just send a notification no network was selected. :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/dmenu :CUSTOM_ID: Dmenu-527edf04 :END: -I wrote this very simple script in order to replace =dmenu= with rofi’s emulation of dmenu, since I prefer rofi’s appearance. It basically calls rofi’s dmenu emulation with the arguments initially passed to dmenu. +I wrote this very simple script in order to replace =dmenu= with rofi’s +emulation of dmenu, since I prefer rofi’s appearance. It basically calls rofi’s +dmenu emulation with the arguments initially passed to dmenu. #+BEGIN_SRC fish rofi -dmenu $argv #+END_SRC @@ -1021,7 +1165,9 @@ I wrote this very simple script in order to replace =dmenu= with rofi’s emulat :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/rofi-emoji :CUSTOM_ID: Emoji_picker-a1c374ec :END: -The emoji picker is a simple fish script that uses rofi and [[file:~/.config/emoji.txt][~/.config/emoji.txt]] to provide a small, local search for emojis. Once the emoji is selected, it is copied to the clipboard using =xclipboard=. +The emoji picker is a simple fish script that uses rofi and [[file:~/.config/emoji.txt][~/.config/emoji.txt]] +to provide a small, local search for emojis. Once the emoji is selected, it is +copied to the clipboard using =xclipboard=. #+BEGIN_SRC fish grep -v "#" ~/.config/emoji.txt | rofi -dmenu -p "Select emoji" -i | \ awk '{print $1}' | tr -d '\n' | xclip -selection clipboard @@ -1035,7 +1181,7 @@ Also, let’s send a notification telling the user the emoji has been copied! notify-send -u low $emoji #+END_SRC - It is inspired from [[https://www.youtube.com/watch?v=UCEXY46t3OA][this video]] from [[https://lukesmith.xyz/][Luke Smith]], rewritten in Fish. +It is inspired from [[https://www.youtube.com/watch?v=UCEXY46t3OA][this video]] from [[https://lukesmith.xyz/][Luke Smith]], rewritten in Fish. ** Partition mounting and unmounting :PROPERTIES: @@ -1046,7 +1192,10 @@ Also, let’s send a notification telling the user the emoji has been copied! :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/rofi-mount :CUSTOM_ID: Rofi-mount-ebbebf68 :END: -=rofimount= is a script inspired by [[https://github.com/ihebchagra/dotfiles/blob/master/.local/bin/dmount][this one]], based on dmenu, which interactively asks the user what to mount, and where to mount it. What I did was replace dmenu with rofi, and fix a couple of bugs I encountered in the original script. +=rofimount= is a script inspired by [[https://github.com/ihebchagra/dotfiles/blob/master/.local/bin/dmount][this one]], based on dmenu, which +interactively asks the user what to mount, and where to mount it. What I did was +replace dmenu with rofi, and fix a couple of bugs I encountered in the original +script. **** Get the mountable elements :PROPERTIES: @@ -1056,18 +1205,22 @@ Also, let’s send a notification telling the user the emoji has been copied! begin #+END_SRC -What the script does first is detect everything that can be mounted. Between a =begin= and =end=, let’s set =LFS= as a local variable. This si in order to get sane variables in the current block. +What the script does first is detect everything that can be mounted. Between a +=begin= and =end=, let’s set =LFS= as a local variable. This si in order to get +sane variables in the current block. #+BEGIN_SRC fish set -l LFS #+END_SRC -Now, let’s detect the amount of mountable Android filesystems, and if any are detected, let’s read them into a global variable. +Now, let’s detect the amount of mountable Android filesystems, and if any are +detected, let’s read them into a global variable. #+BEGIN_SRC fish set -l a (math (jmtpfs -l | wc -l) - 2) test $a -ge 0 && jmtpfs -l 2> /dev/null | tail -n $a | read -zg anddrives #+END_SRC -We’ll do the same for external and internal drives and partitions that can be mounted here. +We’ll do the same for external and internal drives and partitions that can be +mounted here. #+BEGIN_SRC fish lsblk -rpo "name,type,size,mountpoint" | \ awk '$2=="part"&&$4==""{printf "%s (%s)\n",$1,$3}' | \ @@ -1084,7 +1237,10 @@ And that’s the end of our first block! end #+END_SRC -Alright, we’ll save what kind on drives we can mount in a temporary file called =/tmp/drives=. We’ll make sure it’s blank by erasing it then creating it again with =touch=, like so. The =-f= flag on =rm= is here so we get no error if we try to delete a file that doesn’t exist (yet). +Alright, we’ll save what kind on drives we can mount in a temporary file called +=/tmp/drives=. We’ll make sure it’s blank by erasing it then creating it again +with =touch=, like so. The =-f= flag on =rm= is here so we get no error if we +try to delete a file that doesn’t exist (yet). #+BEGIN_SRC fish set -g TMPDRIVES /tmp/drives rm -f $TMPDRIVES @@ -1098,7 +1254,8 @@ Now, let’s write what type of drives we can mount in this temporary file. test -n "$anddrives" && echo "Android" >> $TMPDRIVES #+END_SRC -Now, we want to declare where to look for mount directories. For now, we’ll only look in =/media=, but you can add more if you wish. +Now, we want to declare where to look for mount directories. For now, we’ll only +look in =/media=, but you can add more if you wish. #+BEGIN_SRC fish set -g basemount /media #+END_SRC @@ -1107,26 +1264,34 @@ Now, we want to declare where to look for mount directories. For now, we’ll on :PROPERTIES: :CUSTOM_ID: Rofi-mount-Get_the_mount_point-6c4bac06 :END: -Now, let’s declare a function that will allow us to chose the drive we want to mount. +Now, let’s declare a function that will allow us to chose the drive we want to +mount. #+BEGIN_SRC fish function getmount #+END_SRC -First, we want to get our mount point. We’ll run a =find= command on each of the directories listed in =$basemount= to look for folders on which our drive could be mounted. This list will be passed to rofi from which we will chose our mount point. +First, we want to get our mount point. We’ll run a =find= command on each of the +directories listed in =$basemount= to look for folders on which our drive could +be mounted. This list will be passed to rofi from which we will chose our mount +point. #+BEGIN_SRC fish set -g mp (for d in $basemount find $d -maxdepth 5 -type d end | rofi -dmenu -i -p 'Type in mount point.') #+END_SRC -We should verify that something has been actually selected, otherwise we should abort the script. +We should verify that something has been actually selected, otherwise we should +abort the script. #+BEGIN_SRC fish if test -z $mp || test $mp = "" return 1 end #+END_SRC -Now, if the selected mount point does not exist, we’ll ask the user whether the directory should be created. If no, the script will abort. If yes, an attempt will be made at creating the directory as the user; if that fails, a new attempt will be made as sudo. +Now, if the selected mount point does not exist, we’ll ask the user whether the +directory should be created. If no, the script will abort. If yes, an attempt +will be made at creating the directory as the user; if that fails, a new attempt +will be made as sudo. #+BEGIN_SRC fish if test ! -d $mp switch (printf "No\\nYes" | rofi -dmenu -i -p "$mp does not exist. Create it?") @@ -1147,34 +1312,42 @@ Finally, let’s close the function :PROPERTIES: :CUSTOM_ID: Rofi-mount-Mount_a_USB_drive,_hard_drive_or_partition-f5431dbe :END: -Alright, we want to mount a partition that answers by the name of =/dev/sdXX=, how do we do that? Let’s create first the function =mountusb= that will take care of it for us. +Alright, we want to mount a partition that answers by the name of =/dev/sdXX=, +how do we do that? Let’s create first the function =mountusb= that will take +care of it for us. #+BEGIN_SRC fish function mountusb #+END_SRC -Now, the first thing we want to do is select the partition we want to mount. Remember, we stored those in =$usbdrives= earlier, so let’s pipe them into rofi so we can chose from it. Also, =awk= will get their path in =/dev=. +Now, the first thing we want to do is select the partition we want to mount. +Remember, we stored those in =$usbdrives= earlier, so let’s pipe them into rofi +so we can chose from it. Also, =awk= will get their path in =/dev=. #+BEGIN_SRC fish set -g chosen (echo $usbdrives | \ rofi -dmenu -i -p "Mount which drive?" | \ awk '{print $1}') #+END_SRC -As usual after a user selection, let’s verify something has actually been selected. If not, let’s abort the script. +As usual after a user selection, let’s verify something has actually been +selected. If not, let’s abort the script. #+BEGIN_SRC fish test -z $chosen && return 1 #+END_SRC -Now, let’s select the mount point of our partition. We’ll call the function =getmount= described in [[#Rofi-mount-Get_the_mount_point-6c4bac06][Get the mount point]] to select it. +Now, let’s select the mount point of our partition. We’ll call the function +=getmount= described in [[#Rofi-mount-Get_the_mount_point-6c4bac06][Get the mount point]] to select it. #+BEGIN_SRC fish getmount #+END_SRC -Let’s verify the variable =mp= set in =getmount= is not empty, otherwise abort the script. +Let’s verify the variable =mp= set in =getmount= is not empty, otherwise abort +the script. #+BEGIN_SRC fish test -z $mp && return 1 #+END_SRC -Now, let’s mount it! We’ll use a switch which will detect the filesystem used so we know how to mount the partition. +Now, let’s mount it! We’ll use a switch which will detect the filesystem used so +we know how to mount the partition. #+BEGIN_SRC fish switch (lsblk -no "fstype" $chosen) #+END_SRC @@ -1191,18 +1364,21 @@ And =ntfs= filesystems. sudo -A mount -t ntfs $chosen $mp -o rw,umask=0000 #+END_SRC -Else, we’ll let =mount= determine which filesystem is used by the partition (generally =ext4=). +Else, we’ll let =mount= determine which filesystem is used by the partition +(generally =ext4=). #+BEGIN_SRC fish case '*' sudo -A mount $chosen $mp #+END_SRC -We’ll also run a =chown= on this newly mounted filesystem so the user can access it without any issues. +We’ll also run a =chown= on this newly mounted filesystem so the user can access +it without any issues. #+BEGIN_SRC fish sudo -A chown -R $USER:(id -g $USER) $mp #+END_SRC -Let’s close the switch block and send a notification the partition has been mounted. +Let’s close the switch block and send a notification the partition has been +mounted. #+BEGIN_SRC fish end && notify-send -a "dmount" "💻 USB mounting" "$chosen mounted to $mp." #+END_SRC @@ -1216,7 +1392,8 @@ end :PROPERTIES: :CUSTOM_ID: Rofi-mount-Mount_an_Android_device-5321f9cd :END: -The function that manages to mount Android filesystems is =mountandroid=. Let’s declare it. +The function that manages to mount Android filesystems is =mountandroid=. Let’s +declare it. #+BEGIN_SRC fish function mountandroid -d "Mount an Android device" #+END_SRC @@ -1226,7 +1403,9 @@ We’ll select which Android we want to mount. We will be asked through rofi. set chosen (echo $anddrives | rofi -dmenu -i -p "Which Android device?" | awk '{print $1 $2}' | sed 's/,$//') #+END_SRC -Now, we need to get the bus of the Android device we want to mount. It will be useful later, after we authorized mounting from our device, to get the path to our partition. +Now, we need to get the bus of the Android device we want to mount. It will be +useful later, after we authorized mounting from our device, to get the path to +our partition. #+BEGIN_SRC fish set bus (echo $chosen | sed 's/,.*//') #+END_SRC @@ -1236,19 +1415,24 @@ Let’s temporarily mount our device. jmtpfs -device=$chosen $mp #+END_SRC -Now, we need to allow our computer to mount our Android device. Depending on the Android version it is running on, we either need to specify our device is USB connected in order to exchange files, or Android will explicitely ask us if it is OK for our computer to access it. Let’s inform the user of that. +Now, we need to allow our computer to mount our Android device. Depending on the +Android version it is running on, we either need to specify our device is USB +connected in order to exchange files, or Android will explicitely ask us if it +is OK for our computer to access it. Let’s inform the user of that. #+BEGIN_SRC fish echo "OK" | \ rofi -dmenu -i -p "Press (Allow) on your phone screen, or set your USB settings to allow file transfert" #+END_SRC -Now, let’s get the actual path of our Android filesystem we wish to mount, and let’s unmount the previous temporary filesystem. +Now, let’s get the actual path of our Android filesystem we wish to mount, and +let’s unmount the previous temporary filesystem. #+BEGIN_SRC fish set newchosen (jmtpfs -l | grep $bus | awk '{print $1 $2}' | sed 's/,$//') sudo -A umount $mp #+END_SRC -Now we cam mount the new filesystem and send a notification if everything went well. +Now we cam mount the new filesystem and send a notification if everything went +well. #+BEGIN_SRC fish jmtpfs -device=$newchosen $mp && \ notify-send -a "dmount" "🤖 Android Mounting" "Android device mounted to $mp." @@ -1263,7 +1447,9 @@ end :PROPERTIES: :CUSTOM_ID: Rofi-mount-Mount_a_CD_drive-27278199 :END: -This part is way easier than the previous functions. As we will see, the function =mountcd='s body is only three lines long. First, let’s declare the function. +This part is way easier than the previous functions. As we will see, the +function =mountcd='s body is only three lines long. First, let’s declare the +function. #+BEGIN_SRC fish function mountcd #+END_SRC @@ -1273,7 +1459,8 @@ Now, let’s chose the CD drive we want to mount using =rofi=. set chosen (echo $cddrives | rofi -dmenu -i -p "Which CD drive?") #+END_SRC -We’ll also get the mountpoint thanks to the =getmount= function described earlier. +We’ll also get the mountpoint thanks to the =getmount= function described +earlier. #+BEGIN_SRC fish getmount #+END_SRC @@ -1293,17 +1480,21 @@ end :PROPERTIES: :CUSTOM_ID: Rofi-mount-Ask_what_type_of_drive_we_want_to_mount-0c15cffa :END: -The first thing we will be asked if different types of drives are detected is which of these types the user wishes to mount. This is done with the function =asktype= which is declared below. +The first thing we will be asked if different types of drives are detected is +which of these types the user wishes to mount. This is done with the function +=asktype= which is declared below. #+BEGIN_SRC fish function asktype #+END_SRC -We will use a switch statement which will use our anwser to rofi about what we wish to mount. +We will use a switch statement which will use our anwser to rofi about what we +wish to mount. #+BEGIN_SRC fish switch (cat $TMPDRIVES | rofi -dmenu -i -p "Mount which drive?") #+END_SRC -If we chose the option "USB", we’ll mount a hard drive, partition or USB drive. In which case we’ll call the =mountusb= function. +If we chose the option "USB", we’ll mount a hard drive, partition or USB drive. +In which case we’ll call the =mountusb= function. #+BEGIN_SRC fish case "USB" mountusb @@ -1321,7 +1512,8 @@ Else if we chose the "CD" option, we’ll call the =mountcd= function. mountcd #+END_SRC -If nothing is selected, the function will naturally exit. Now, let’s close our switch statement and our function. +If nothing is selected, the function will naturally exit. Now, let’s close our +switch statement and our function. #+BEGIN_SRC fish end end @@ -1331,23 +1523,28 @@ end :PROPERTIES: :CUSTOM_ID: Rofi-mount-Launch_the_mounting_functions-218ad001 :END: -Now that we have declared our functions and set our variables, we’ll read the temporary file described in [[#Rofi-mount-Get_the_mountable_elements-24db7834][Get the mountable elements]]. The amount of lines is passed in a switch statement. +Now that we have declared our functions and set our variables, we’ll read the +temporary file described in [[#Rofi-mount-Get_the_mountable_elements-24db7834][Get the mountable elements]]. The amount of lines is +passed in a switch statement. #+BEGIN_SRC fish switch (wc -l < $TMPDRIVES) #+END_SRC -If the file has no lines, i.e. it is empty, we have no mountable media. Let’s inform our user this is the case. +If the file has no lines, i.e. it is empty, we have no mountable media. Let’s +inform our user this is the case. #+BEGIN_SRC fish case 0 notify-send "No USB drive or Android device or CD detected" -a "dmount" #+END_SRC -If we only have one line, we have only one type of mountable media. We’ll pass this line to a second switch statement. +If we only have one line, we have only one type of mountable media. We’ll pass +this line to a second switch statement. #+BEGIN_SRC fish case 1 switch (cat $TMPDRIVES) #+END_SRC -This will allow the script to automatically detect what type of media it is, and mount the corresponding function. +This will allow the script to automatically detect what type of media it is, and +mount the corresponding function. #+BEGIN_SRC fish case "USB" mountusb @@ -1361,7 +1558,8 @@ Let’s close this nested switch case. end #+END_SRC -If we have more than one line, we’ll have to ask the user what type of media they want to mount. +If we have more than one line, we’ll have to ask the user what type of media +they want to mount. #+BEGIN_SRC fish case '*' asktype @@ -1384,13 +1582,15 @@ And with that, this is the end of our script! :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/rofi-umount :CUSTOM_ID: Rofi-umount-ddde1667 :END: -~rofiumount~ is the counterpart of ~rofimount~ for unmounting our mounted partitions. +~rofiumount~ is the counterpart of ~rofimount~ for unmounting our mounted +partitions. **** Get the unmountable drives :PROPERTIES: :CUSTOM_ID: Rofi-umount-Get_the_unmountable_drives-89c71040 :END: -First, we will need to list all the drives that can be safely unmounted. Let’s run this. +First, we will need to list all the drives that can be safely unmounted. Let’s +run this. #+BEGIN_SRC fish set -g drives (lsblk -nrpo "name,type,size,mountpoint" | \ awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}') @@ -1417,7 +1617,8 @@ Let’s make sure we begin with a clean, empty file. touch $undrivefile #+END_SRC -Depending on if the related variables are set, write the different types of mounted drives in the temporary file. +Depending on if the related variables are set, write the different types of +mounted drives in the temporary file. #+BEGIN_SRC fish test -n "$drives" && echo "USB" >> $undrivefile test -n "$cds" && echo "CD" >> $undrivefile @@ -1428,7 +1629,8 @@ Depending on if the related variables are set, write the different types of moun :PROPERTIES: :CUSTOM_ID: Rofi-umount-Unmount_disk_partitions-0d425a47 :END: -The function =unmountusb= will take care of unmounting any drive we can safely unmount. First, let’s declare the function. +The function =unmountusb= will take care of unmounting any drive we can safely +unmount. First, let’s declare the function. #+BEGIN_SRC fish function unmountusb #+END_SRC @@ -1440,7 +1642,8 @@ Let’s chose the drive to unmount with rofi. awk '{print $1}') #+END_SRC -Let’s verify if the user actually selected any drive. If no, let’s abort the script. +Let’s verify if the user actually selected any drive. If no, let’s abort the +script. #+BEGIN_SRC fish test -z "$chosen" && exit 0 #+END_SRC @@ -1460,7 +1663,8 @@ end :PROPERTIES: :CUSTOM_ID: Rofi-umount-Unmount_Android_device-ae1d5904 :END: -The function =unmountandroid= will take care of unmounting any mounted Android device. First, let’s declare our function. +The function =unmountandroid= will take care of unmounting any mounted Android +device. First, let’s declare our function. #+BEGIN_SRC fish function unmountandroid #+END_SRC @@ -1475,7 +1679,8 @@ We’ll verify the user chose any device. test -z "$chosen" && exit 0 #+END_SRC -If a device has been chosen, let’s unmount it and send a notification it has been successfuly unmounted. +If a device has been chosen, let’s unmount it and send a notification it has +been successfuly unmounted. #+BEGIN_SRC fish sudo -A umount -l $chosen && \ notify-send "🤖 Android unmounting" "$chosen unmounted." -a "dumount" @@ -1490,7 +1695,8 @@ end :PROPERTIES: :CUSTOM_ID: Rofi-umount-Unmount_CD_drive-369a2f61 :END: -=unmountcd= will take care of unmounting any mounted CD drive. Let’s declare this function. +=unmountcd= will take care of unmounting any mounted CD drive. Let’s declare +this function. #+BEGIN_SRC fish function unmountcd #+END_SRC @@ -1505,7 +1711,8 @@ We’ll verify the user chose any device. test -z "$chosen" && exit 0 #+END_SRC -If a drive has been chosen, let’s unmount it and send a notification it has been successfuly unmounted. +If a drive has been chosen, let’s unmount it and send a notification it has been +successfuly unmounted. #+BEGIN_SRC fish sudo -A umount -l $chosen && \ notify-send "💿 CD unmounting" "$chosen unmounted." -a "dumount" @@ -1520,17 +1727,21 @@ end :PROPERTIES: :CUSTOM_ID: Rofi-umount-Ask_what_type_of_drive_to_unmount-6287af48 :END: -If several types of unmountable drives are available, let’s ask the user which type to unmount based on the content of the temporary file declared in [[#Rofi-umount-Get_the_unmountable_drives-89c71040][Get the unmountable drives]]. First, let’s declare the function. +If several types of unmountable drives are available, let’s ask the user which +type to unmount based on the content of the temporary file declared in [[#Rofi-umount-Get_the_unmountable_drives-89c71040][Get the +unmountable drives]]. First, let’s declare the function. #+BEGIN_SRC fish function asktype #+END_SRC -Let’s create a switch statement to which will be passed the selection of the user from rofi. +Let’s create a switch statement to which will be passed the selection of the +user from rofi. #+BEGIN_SRC fish switch (cat $undrivefile | rofi -dmenu -i -p "Unmount which type of device?") #+END_SRC -Three types of values can be returned: "USB", "CD", or "Android". These values will be used to launch their corresponding function. +Three types of values can be returned: "USB", "CD", or "Android". These values +will be used to launch their corresponding function. #+BEGIN_SRC fish case 'USB' unmountusb @@ -1554,18 +1765,21 @@ end :PROPERTIES: :CUSTOM_ID: Rofi-umount-Launch_the_unmounting_functions-7c48a928 :END: -Now back to the body of our script, let’s input in a switch case the number of lines contained in our temporary file. +Now back to the body of our script, let’s input in a switch case the number of +lines contained in our temporary file. #+BEGIN_SRC fish switch (wc -l < $undrivefile) #+END_SRC -If the file containes no lines. i.e. it is empty, nothing is to be unmounted. Let’s inform the user of that. +If the file containes no lines. i.e. it is empty, nothing is to be unmounted. +Let’s inform the user of that. #+BEGIN_SRC fish case 0 notify-send "No USB drive or Android device or CD to unmount" -a "dumount" #+END_SRC -Else, if there is only one type of drive, we’ll automatically let our script choose based on the content of this sole line. +Else, if there is only one type of drive, we’ll automatically let our script +choose based on the content of this sole line. #+BEGIN_SRC fish case 1 switch (cat $undrivefile) @@ -1599,9 +1813,13 @@ rm -f $undrivefile :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/rofi-pass :CUSTOM_ID: Rofi-pass-8335357f :END: -=rofi-pass= is a simple utility that gets a password stored in the [[https://www.passwordstore.org/][=pass=]] password manager with rofi as its interface, and then stores the password in the clipboard. +=rofi-pass= is a simple utility that gets a password stored in the [[https://www.passwordstore.org/][=pass=]] +password manager with rofi as its interface, and then stores the password in the +clipboard. -Let’s parse all the arguments passed to the script. If one of them is =--type=, =-t= or =type=, the script will attempt to type the password to the text area already selected without pasting the password to the clipboard. +Let’s parse all the arguments passed to the script. If one of them is =--type=, +=-t= or =type=, the script will attempt to type the password to the text area +already selected without pasting the password to the clipboard. #+BEGIN_SRC fish for arg in $argv switch $arg @@ -1628,14 +1846,16 @@ Let the user choose which password they wish to select. end | rofi -dmenu -i -p "Select your password") #+END_SRC -Let’s verify we actually selected a password and not just exited. If no password was selected, let’s simply exit the script. +Let’s verify we actually selected a password and not just exited. If no password +was selected, let’s simply exit the script. #+BEGIN_SRC fish if test -z $password exit end #+END_SRC -Depending on the arguments passed earlier, we might want some different behavior. +Depending on the arguments passed earlier, we might want some different +behavior. #+BEGIN_SRC fish :noweb yes if test $TYPE = "yes" <> @@ -1644,13 +1864,16 @@ Depending on the arguments passed earlier, we might want some different behavior end #+END_SRC -The default behavior is to copy the password to the clipboard for 45 seconds, so let’s do that. +The default behavior is to copy the password to the clipboard for 45 seconds, so +let’s do that. #+NAME: rofi-pass-copy #+BEGIN_SRC fish :noweb yes :tangle no pass show -c $password 2> /dev/null #+END_SRC -Else, if we passed =--type=, =-t= or =type= as an argument of the script, we want it to attempt to type our password in the currently selected text input. Let’s do that. +Else, if we passed =--type=, =-t= or =type= as an argument of the script, we +want it to attempt to type our password in the currently selected text input. +Let’s do that. #+NAME: rofi-pass-type #+BEGIN_SRC fish :noweb yes :tangle no set -l IFS @@ -1658,7 +1881,8 @@ Else, if we passed =--type=, =-t= or =type= as an argument of the script, we wan printf %s $pass | xvkbd -file - #+END_SRC -To correctly get the password from ~pass~, we need to parse the output and only get the first line, hence the following command. +To correctly get the password from ~pass~, we need to parse the output and only +get the first line, hence the following command. #+NAME: rofi-pass-type-get-password #+BEGIN_SRC fish :tangle no set pass (pass show $password | string split -n \n)[1] @@ -1669,12 +1893,18 @@ set pass (pass show $password | string split -n \n)[1] :HEADER-ARGS: :shebang "#!/usr/bin/env bash" :mkdirp yes :tangle ~/.local/bin/rofi-ytdl :CUSTOM_ID: rofi-ytdl-ff8f789d :END: -This is just a simple wrapper around [[#ytdl-a-youtube-dl-wrapper-03bd63e0][ytdl]] so I can easily download a video from rofi, which we’ll use first to retrieve the URL of the video we want to download, be it from YouTube or other website supported by ~youtube-dl~. +This is just a simple wrapper around [[#ytdl-a-youtube-dl-wrapper-03bd63e0][ytdl]] so I can easily download a video from +rofi, which we’ll use first to retrieve the URL of the video we want to +download, be it from YouTube or other website supported by ~youtube-dl~. #+BEGIN_SRC bash URL=$(echo "Video to download:" | rofi -dmenu -i -p "Video to download:") #+END_SRC -Now, if the variable ~URL~ is not empty (i.e. the user specified a link and did not abort the operation), we’ll proceed to teh download. Before it begins, we’ll send a notification saying the download is about to begin. When the ~ytdl~ process ends, we’ll also send a notification notifying the user on the success or failure of the download. +Now, if the variable ~URL~ is not empty (i.e. the user specified a link and did +not abort the operation), we’ll proceed to teh download. Before it begins, we’ll +send a notification saying the download is about to begin. When the ~ytdl~ +process ends, we’ll also send a notification notifying the user on the success +or failure of the download. #+BEGIN_SRC bash if [ -n "$URL" ]; then notify-send -u normal "YTDL" "Starting downloading\n$URL" @@ -1705,7 +1935,8 @@ This little tool sets a random wallpaper using xwallpaper. :CUSTOM_ID: Wallpaper-utilities-Select-wallpaper-42f477a9 :HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/.local/bin/select-pape :END: -This script is base on what sxiv can do as an image viewer as well as xwallpaper. +This script is base on what ~sxiv~ can do as an image viewer as well as +xwallpaper. #+BEGIN_SRC sh PAPE=$(sxiv -orbft ~/Pictures/Wallpapers/*) set-pape $PAPE @@ -1716,7 +1947,11 @@ This script is base on what sxiv can do as an image viewer as well as xwallpaper :HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/.local/bin/set-pape :CUSTOM_ID: Wallpaper-utilities-Set-a-wallpaper-27eda9e6 :END: -This utility is not meant to be called by the user directly, but rather by scripts that may be written by the user. Its role is simple: check if the provided wallpaper exists and if it is an image. If both requirements are met, the path to this image is then stored in ~$XDG_CACHE_HOME/wallpaper~, or if this variable is empty in ~$HOME/.cache/wallpaper~. +This utility is not meant to be called by the user directly, but rather by +scripts that may be written by the user. Its role is simple: check if the +provided wallpaper exists and if it is an image. If both requirements are met, +the path to this image is then stored in ~$XDG_CACHE_HOME/wallpaper~, or if this +variable is empty in ~$HOME/.cache/wallpaper~. #+BEGIN_SRC sh CACHEFILE=$([ -n "$XDG_CACHE_HOME" ] && echo $XDG_CACHE_HOME/wallpaper || echo $HOME/.cache/wallpaper) [[ -f $1 ]] && \ @@ -1730,7 +1965,10 @@ This utility is not meant to be called by the user directly, but rather by scrip :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/we :CUSTOM_ID: Weather-4ed00bb0 :END: -A quick and useful script I often use is a ~curl~ request to [[http://v2.wttr.in/][v2.wttr.in]] to get a weather forecast in the terminal. By default, I want the request to be about the city I live in, but it is also possible for the script to accept as its arguments a search inquiry. +A quick and useful script I often use is a ~curl~ request to [[http://v2.wttr.in/][v2.wttr.in]] to get a +weather forecast in the terminal. By default, I want the request to be about the +city I live in, but it is also possible for the script to accept as its +arguments a search inquiry. #+BEGIN_SRC fish if count $argv > /dev/null set -l SEARCH (string join '+' $argv) diff --git a/org/config/emacs.org b/org/config/emacs.org index be2925a..986a6f4 100644 --- a/org/config/emacs.org +++ b/org/config/emacs.org @@ -10,7 +10,13 @@ :PROPERTIES: :CUSTOM_ID: Introduction-f1cbb8bb :END: -This file is the main source file for my Emacs configuration which contains most of the user code. It is exported thanks to Emacs’ code tangling from the original Org file which you can find on my dotfiles’ repository[fn:1] if you are reading the web version of it. You can also find there my ~.spacemacs~[fn:2] and its code which isn’t part of the present file. As you can see in my ~.spacemacs~, at init-time, if Emacs detects the tangled configuration files are older than the Org file, then Emacs tangles them again, and then loads them. +This file is the main source file for my Emacs configuration which contains most +of the user code. It is exported thanks to Emacs’ code tangling from the +original Org file which you can find on my dotfiles’ repository[fn:1] if you are +reading the web version of it. You can also find there my ~.spacemacs~[fn:2] and +its code which isn’t part of the present file. As you can see in my +~.spacemacs~, at init-time, if Emacs detects the tangled configuration files are +older than the Org file, then Emacs tangles them again, and then loads them. * Spacemacs layers and packages :PROPERTIES: @@ -21,53 +27,72 @@ This file is the main source file for my Emacs configuration which contains m ;; -*- lexical-binding: t -*- #+END_SRC -Here will be our layer configuration set. Everything here is set with a ~setq-default~ in the ~dotspacemacs/layers~ function like so: +Here will be our layer configuration set. Everything here is set with a +~setq-default~ in the ~dotspacemacs/layers~ function like so: #+BEGIN_SRC emacs-lisp :tangle no - (defun dotspacemacs/layers () - (setq-default - ;; configuration goes here - )) - #+END_SRC + (defun dotspacemacs/layers () + (setq-default + ;; configuration goes here + )) +#+END_SRC ** General configuration :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-General_configuration-66b4311e :END: -First, we need to tell Spacemacs which base distribution we are using. This is a layer contained in the directory ~+distribution~. For now, available distributions are ~spacemacs-base~ and ~spacemacs~ (the default one). +First, we need to tell Spacemacs which base distribution we are using. This is a +layer contained in the directory ~+distribution~. For now, available +distributions are ~spacemacs-base~ and ~spacemacs~ (the default one). #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-distribution 'spacemacs) #+END_SRC -We can seet a lazy installation of layers —i.e. layers are installed only when a file with a supported type is opened. Possible values are: -- ~all~ :: will lazy install any layer that support lazy installation even the layers listed in ~dotspacemacs-configuration-layers~ -- ~unused~ :: will lazy install only unused layers (i.e. layers not listed in the variable ~dotspacemacs-configuration-layers~) -- ~nil~ :: disables the lazy installation feature and you have to explicitly list a layer in the variable ~dotspacemacs-configuration-layers~ to install it. +We can seet a lazy installation of layers —i.e. layers are installed only when a +file with a supported type is opened. Possible values are: +- ~all~ :: will lazy install any layer that support lazy installation even the + layers listed in ~dotspacemacs-configuration-layers~ +- ~unused~ :: will lazy install only unused layers (i.e. layers not listed in + the variable ~dotspacemacs-configuration-layers~) +- ~nil~ :: disables the lazy installation feature and you have to explicitly + list a layer in the variable ~dotspacemacs-configuration-layers~ to install + it. The default value is ~unused~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-enable-lazy-installation 'lazy) #+END_SRC -If the following variable is non-nil, Spacemacs will ask for confirmation before installing a layer lazily. The default value is ~t~. +If the following variable is non-nil, Spacemacs will ask for confirmation before +installing a layer lazily. The default value is ~t~. #+BEGIN_SRC emacs-lisp - (setq-default dotspacemacs-ask-for-lazy-installation t) - #+END_SRC + (setq-default dotspacemacs-ask-for-lazy-installation t) +#+END_SRC ** Package management :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Package_management-0add1a62 :END: -It is possible to indicate to Spacemacs a list of additional paths where to look for configuration layers. Paths must have a trailing slash, i.e. =~/.mycontribs/=. As you can see, I added only one: +It is possible to indicate to Spacemacs a list of additional paths where to look +for configuration layers. Paths must have a trailing slash, i.e. +=~/.mycontribs/=. As you can see, I added only one: #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-configuration-layer-path '("~/fromGIT/emacs-packages")) #+END_SRC -However, I do have additional packages I installed either from the Elpa or the Melpa. These are set in ~dotspacemacs-additional-packages~, a list of additional packages that will be installed without being wrapped in a layer. If I need some configuration for these packages, then I should consider creating a layer. I can also puth the configuration in ~dotspacemacs/user-config~. To use a local version of a package, use the ~:location~ property, for instance: +However, I do have additional packages I installed either from the Elpa or the +Melpa. These are set in ~dotspacemacs-additional-packages~, a list of additional +packages that will be installed without being wrapped in a layer. If I need some +configuration for these packages, then I should consider creating a layer. I can +also puth the configuration in ~dotspacemacs/user-config~. To use a local +version of a package, use the ~:location~ property, for instance: #+BEGIN_SRC emacs-lisp :tangle no '(your-package :location "~/path/to/your-package/") #+END_SRC -With the variable ~dotspacemacs-additional-packages~, it is possible to install extra packages which are not already included in any layers. Dependencies should be explicitly included as they won’t be resolved automatically. Here is a table of all the extra packages I use: +With the variable ~dotspacemacs-additional-packages~, it is possible to install +extra packages which are not already included in any layers. Dependencies should +be explicitly included as they won’t be resolved automatically. Here is a table +of all the extra packages I use: #+NAME: extra-packages | name of the package | why is it installed | |----------------------------+--------------------------------------------------------| @@ -112,10 +137,14 @@ And to list packages which won’t be installed nor loaded: (setq-default dotspacemacs-excluded-packages '(company-tern)) #+END_SRC -Finally, it is possible to define the behaviour of Spacemacs when installing packages. Possible values are: -- ~used-only~ :: installs only explicitly used packages and deletes any unused packages as well as their unused dependencies -- ~used-but-keep-unused~ :: installs only the used packages but won’t delete unused ones -- ~all~ :: installs *all* packages supported by Spacemacs and never uninstalls them. +Finally, it is possible to define the behaviour of Spacemacs when installing +packages. Possible values are: +- ~used-only~ :: installs only explicitly used packages and deletes any unused + packages as well as their unused dependencies +- ~used-but-keep-unused~ :: installs only the used packages but won’t delete + unused ones +- ~all~ :: installs *all* packages supported by Spacemacs and never uninstalls + them. The default value is ~used-only~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-install-packages 'used-only) @@ -125,17 +154,19 @@ The default value is ~used-only~. :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-36e1c90c :END: -All layers are set one variable: ~dotspacemacs-configuration-layers~. This variable is a list of layers, some of them will have some custom variables. Typically, the variable will be set like so: +All layers are set one variable: ~dotspacemacs-configuration-layers~. This +variable is a list of layers, some of them will have some custom variables. +Typically, the variable will be set like so: #+BEGIN_SRC emacs-lisp :tangle no - (setq-default dotspacemacs-configuration-layers - '(emacs-lisp - helm - multiple-cursors - org - (shell :variables shell-default-height - 30 shell-default-position 'bottom) - treemacs)) - #+END_SRC + (setq-default dotspacemacs-configuration-layers + '(emacs-lisp + helm + multiple-cursors + org + (shell :variables shell-default-height + 30 shell-default-position 'bottom) + treemacs)) +#+END_SRC # Don’t delete this code block, it wraps the layers #+BEGIN_SRC emacs-lisp :exports none @@ -146,7 +177,8 @@ All layers are set one variable: ~dotspacemacs-configuration-layers~. This varia :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-Checkers-aefeae26 :END: -The two first checkers I use are for spell and syntax checking. ~spell-checking~ is disabled by default, however it should auto-detect the dictionary to use. +The two first checkers I use are for spell and syntax checking. ~spell-checking~ +is disabled by default, however it should auto-detect the dictionary to use. #+BEGIN_SRC emacs-lisp (spell-checking :variables spell-checking-enable-by-default nil @@ -158,7 +190,12 @@ The two first checkers I use are for spell and syntax checking. ~spell-checking~ :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-Completion-883e2b83 :END: -~auto-completion~ is a layer enabled in order to provide auto-completion to all supported language layers. It is set so that the =RET= key has no behavior with this layer, however the =TAB= key cycles between candidates displayed by the auto-completion toolbox. I also want the autocompletion to include snippets in the popup, and the content of the popup is sorted by usage. It is also disabled for two modes: magit and Org. +~auto-completion~ is a layer enabled in order to provide auto-completion to all +supported language layers. It is set so that the =RET= key has no behavior with +this layer, however the =TAB= key cycles between candidates displayed by the +auto-completion toolbox. I also want the autocompletion to include snippets in +the popup, and the content of the popup is sorted by usage. It is also disabled +for two modes: magit and Org. #+BEGIN_SRC emacs-lisp (auto-completion :variables auto-completion-complete-with-key-sequence-delay 0.2 @@ -178,20 +215,26 @@ The two first checkers I use are for spell and syntax checking. ~spell-checking~ :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-Email-67c16308 :END: -I use as my daily Email client ~mu4e~, so let’s enable it and tell Emacs where mu4e is installed. I also tell mu4e to use maildirs extensions, use async operations, where to keep attachments, and enable the mu4e modeline. +I use as my daily Email client ~mu4e~, so let’s enable it and tell Emacs where +mu4e is installed. I also tell mu4e to use maildirs extensions, use async +operations, where to keep attachments, and enable the mu4e modeline. #+BEGIN_SRC emacs-lisp - (mu4e :variables - mu4e-installation-path "/usr/share/emacs/site-lisp" - mu4e-use-maildirs-extension t - mu4e-enable-mode-line t - mu4e-attachment-dir "~/Documents/mu4e") - #+END_SRC + (mu4e :variables + mu4e-installation-path "/usr/share/emacs/site-lisp" + mu4e-use-maildirs-extension t + mu4e-enable-mode-line t + mu4e-attachment-dir "~/Documents/mu4e") +#+END_SRC *** Emacs :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-Emacs-8e976e5c :END: -The first layer enabled in this category is ~better-defaults~. I also made it so that when a command equivalent to ~C-a~ or ~C-e~ is pressed, the cursor will respectively first move to the beginning of code first before going past the indentation and to the end of the code before going to the end of the line before going over the end of the comments on the same line. +The first layer enabled in this category is ~better-defaults~. I also made it so +that when a command equivalent to ~C-a~ or ~C-e~ is pressed, the cursor will +respectively first move to the beginning of code first before going past the +indentation and to the end of the code before going to the end of the line +before going over the end of the comments on the same line. #+BEGIN_SRC emacs-lisp (better-defaults :variables better-defaults-move-to-beginning-of-code-first t @@ -204,7 +247,11 @@ I also enabled ~ibuffer~ and made it so that buffers are sorted by projects. ibuffer-group-buffers-by 'projects) #+END_SRC -Most important of all, the ~org~ layer is also enabled. I enabled support for Epub exports, Github, Reveal.JS exports, and sticky headers. Project support is also enabled through files named ~TODOs.org~. I also set the org-download folder for images in =~/Pictures/org/=, and I set the =RET= key to follow org links if the cursor is on one. +Most important of all, the ~org~ layer is also enabled. I enabled support for +Epub exports, Github, Reveal.JS exports, and sticky headers. Project support is +also enabled through files named ~TODOs.org~. I also set the org-download folder +for images in =~/Pictures/org/=, and I set the =RET= key to follow org links if +the cursor is on one. #+BEGIN_SRC emacs-lisp (org :variables org-enable-epub-support t @@ -228,7 +275,10 @@ The ~semantic~ layer is also enabled. :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-File_trees-5b6ed3e4 :END: -In this category, I only enabled one layer: ~treemacs~. In this layer, I set is so that treemacs syncs with my current buffer, and it automatically refreshes its buffer when there is a change in the part of the file system shown by treemacs. +In this category, I only enabled one layer: ~treemacs~. In this layer, I set is +so that treemacs syncs with my current buffer, and it automatically refreshes +its buffer when there is a change in the part of the file system shown by +treemacs. #+BEGIN_SRC emacs-lisp (treemacs :variables treemacs-use-follow-mode t @@ -239,7 +289,8 @@ In this category, I only enabled one layer: ~treemacs~. In this layer, I set is :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-Fonts-11de8977 :END: -In this category, again, one layer is enabled: ~unicode-fonts~. This layer addssupport for the ~unicode-fonts~ package. +In this category, again, one layer is enabled: ~unicode-fonts~. This layer +addssupport for the ~unicode-fonts~ package. #+BEGIN_SRC emacs-lisp (unicode-fonts :variables unicode-fonts-enable-ligatures t @@ -272,7 +323,8 @@ In this category, I only enabled two layers: ~selectric~ and ~xkcd~. :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-Internationalization-69601ff8 :END: -In this category, I enabled the ~keyboard-layout~ layer to enable compatibility with the bépo layout. This layer, however, is disabled for magit, Dired and eww. +In this category, I enabled the ~keyboard-layout~ layer to enable compatibility +with the bépo layout. This layer, however, is disabled for magit, Dired and eww. #+BEGIN_SRC emacs-lisp (keyboard-layout :variables kl-layout 'bepo @@ -287,12 +339,17 @@ In this category, I enabled the ~keyboard-layout~ layer to enable compatibility :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-Programming_languages-Domain-specific_(DSLs)-2c919937 :END: -In this category, I enabled support for the ~major-modes~ layer for the Arch Linux PKGBUILDs support, ~emacs-lisp~ and ~scheme~ layers, support for the CSV format with the ~csv~ layer, the ~yaml~ language, shell scripting languages and support for the ~dot~ tool with the ~graphviz~ layer. +In this category, I enabled support for the ~major-modes~ layer for the Arch +Linux PKGBUILDs support, ~emacs-lisp~ and ~scheme~ layers, support for the CSV +format with the ~csv~ layer, the ~yaml~ language, shell scripting languages and +support for the ~dot~ tool with the ~graphviz~ layer. #+BEGIN_SRC emacs-lisp major-modes emacs-lisp scheme graphviz yaml shell-scripts #+END_SRC -I also added support for HTML and CSS with the ~html~ layer, with the web formatting tool set to ~web-beautify~, and the LSP layer compatibility enabled for CSS, less, SCSS and HTML. +I also added support for HTML and CSS with the ~html~ layer, with the web +formatting tool set to ~web-beautify~, and the LSP layer compatibility enabled +for CSS, less, SCSS and HTML. #+BEGIN_SRC emacs-lisp (html :variables web-fmt-tool 'web-beautify @@ -308,7 +365,9 @@ The ~json~ layer is also enabled, with the format tool set to ~web-beautify~. json-fmt-tool 'web-beautify) #+END_SRC -The LaTeX layer has also been enabled, with its default compiler set to XeLaTeX. I also enabled the auto-fill feature, the folding capacity and the “magic” symbols. +The LaTeX layer has also been enabled, with its default compiler set to XeLaTeX. +I also enabled the auto-fill feature, the folding capacity and the “magic” +symbols. #+BEGIN_SRC emacs-lisp (latex :variables latex-build-command "xelatex" @@ -317,7 +376,8 @@ The LaTeX layer has also been enabled, with its default compiler set to XeLaTeX. latex-enable-magic t) #+END_SRC -The Markdown layer has been enabled, with support for live preview with ~vmd~, and and automatic MMM-mode generation for C, C++, Python, Rust and Emacs Lisp. +The Markdown layer has been enabled, with support for live preview with ~vmd~, +and and automatic MMM-mode generation for C, C++, Python, Rust and Emacs Lisp. #+BEGIN_SRC emacs-lisp (markdown :variables markdown-live-preview-engine 'vmd @@ -328,7 +388,9 @@ The Markdown layer has been enabled, with support for live preview with ~vmd~, a ("elisp" "emacs-lisp"))) #+END_SRC -PlantUML is a very useful DSL for creating UML diagrams from some text description. As you can see below, this layer will be enabled, both as a standalone mode for opening ~.pum~ files, but also for org-mode code blocks. +PlantUML is a very useful DSL for creating UML diagrams from some text +description. As you can see below, this layer will be enabled, both as a +standalone mode for opening ~.pum~ files, but also for org-mode code blocks. #+BEGIN_SRC emacs-lisp (plantuml :variables plantuml-jar-path "~/.local/bin/plantuml.jar" @@ -350,7 +412,8 @@ PlantUML is a very useful DSL for creating UML diagrams from some text descripti :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-Programming_languages-Frameworks-f7c21585 :END: -Only one framework support has been enabled so far, and is is for the Django framework. +Only one framework support has been enabled so far, and is is for the Django +framework. #+BEGIN_SRC emacs-lisp django #+END_SRC @@ -359,12 +422,17 @@ Only one framework support has been enabled so far, and is is for the Django fra :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-Programming_languages-General-purpose-1ed71a5b :END: -Among the layers I activated, the only one without any specific configuration is the ~asm~ layer for the Assembly language. +Among the layers I activated, the only one without any specific configuration is +the ~asm~ layer for the Assembly language. #+BEGIN_SRC emacs-lisp asm #+END_SRC -Next, you can find the C/C++ layer for which I set the default language for ~.h~ files to be C. I also enabled support for subprojects and organization of the include directives on a file save. I also set a couple of LSP-related variables, such as the LSP executable for C/C++ for its CCLS backend and some highlight variables. +Next, you can find the C/C++ layer for which I set the default language for ~.h~ +files to be C. I also enabled support for subprojects and organization of the +include directives on a file save. I also set a couple of LSP-related variables, +such as the LSP executable for C/C++ for its CCLS backend and some highlight +variables. #+BEGIN_SRC emacs-lisp (c-c++ :variables c-c++-default-mode-for-headers 'c-mode @@ -377,26 +445,33 @@ Next, you can find the C/C++ layer for which I set the default language for ~.h~ c++-enable-organize-includes-on-save t) #+END_SRC -Dart has also been enabled, with a custom path to the SDK of the Dart server, and to the LSP server of Dart. +Dart has also been enabled, with a custom path to the SDK of the Dart server, +and to the LSP server of Dart. #+BEGIN_SRC emacs-lisp (dart :variables lsp-dart-project-sdk-dir "/opt/dart-sdk/" lsp-dart-sdk-dir "/opt/dart-sdk/") #+END_SRC -When it comes to the Python layer, I set its backend and formatter to be bound to the LSP layer. Its fill columnn was also set to 80 characters, imports are sorted on save, and the tests can be run using either nose.el or pytest. +When it comes to the Python layer, I set its backend and formatter to be bound +to the LSP layer. Its fill columnn was also set to 80 characters, imports are +sorted on save, and the tests can be run using either nose.el or pytest. #+BEGIN_SRC emacs-lisp (python :variables python-fill-column 80 python-test-runner '(pytest nose)) #+END_SRC -With the Rust layer, the only custom configuration set is the backend being bound to the LSP layer. +With the Rust layer, the only custom configuration set is the backend being +bound to the LSP layer. #+BEGIN_SRC emacs-lisp (rust :variables rust-backend 'lsp) #+END_SRC -As regards the JavaScript layer, I set its backend to the LSP layer, and bound its format tool to ~web-beautify~ and its REPL is browser-based. I also want to include ~node_modules/.bin~ to be automatically added to the buffer local ~exec_path~. +As regards the JavaScript layer, I set its backend to the LSP layer, and bound +its format tool to ~web-beautify~ and its REPL is browser-based. I also want to +include ~node_modules/.bin~ to be automatically added to the buffer local +~exec_path~. #+BEGIN_SRC emacs-lisp (javascript :variables javascript-backend 'lsp @@ -405,13 +480,15 @@ As regards the JavaScript layer, I set its backend to the LSP layer, and bound i node-add-modules-path t) #+END_SRC -Alternatively, I also use Typescript which is a sort of better Javascript as it should have been, with the LSP backend. +Alternatively, I also use Typescript which is a sort of better Javascript as it +should have been, with the LSP backend. #+BEGIN_SRC emacs-lisp (typescript :variables typescript-backend 'lsp) #+END_SRC -I am also currently using the Awesome window manager which requires the Lua programming language, so here it is. +I am also currently using the Awesome window manager which requires the Lua +programming language, so here it is. #+BEGIN_SRC emacs-lisp (lua :variables lua-backend 'lsp-emmy @@ -420,7 +497,8 @@ I am also currently using the Awesome window manager which requires the Lua prog lua-lsp-emmy-enable-file-watchers t) #+END_SRC -Unfortunately, I have to write Java code for one of my university courses, so here is the layer: +Unfortunately, I have to write Java code for one of my university courses, so +here is the layer: #+BEGIN_SRC emacs-lisp java #+END_SRC @@ -433,92 +511,103 @@ Unfortunately, I have to write Java code for one of my university courses, so he :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-Readers-Epub_and_Pdf_readers-0ef6688f :END: - In this category, only the ~epub~ and ~pdf~ layers are enabled without any special configuration, so I can read these files from Emacs directly. - #+BEGIN_SRC emacs-lisp - epub pdf - #+END_SRC +In this category, only the ~epub~ and ~pdf~ layers are enabled without any +special configuration, so I can read these files from Emacs directly. +#+BEGIN_SRC emacs-lisp +epub pdf +#+END_SRC **** Elfeed :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-Readers-Elfeed-78877179 :END: - Elfeed is an Emacs feeed and RSS reader which can be managed through org files. Actually, through only one file in my case, located in my =~/org= directory. - #+BEGIN_SRC emacs-lisp - (elfeed :variables - rmh-elfeed-org-files '("~/org/elfeed.org")) - #+END_SRC +Elfeed is an Emacs feeed and RSS reader which can be managed through org files. +Actually, through only one file in my case, located in my =~/org= directory. +#+BEGIN_SRC emacs-lisp + (elfeed :variables + rmh-elfeed-org-files '("~/org/elfeed.org")) +#+END_SRC *** Version control :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-Version_control-bc8e286a :END: - Only the ~git~ layer is enabled in this category. - #+BEGIN_SRC emacs-lisp - git - #+END_SRC +Only the ~git~ layer is enabled in this category. +#+BEGIN_SRC emacs-lisp +git +#+END_SRC *** Themes :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-Themes-d88d1225 :END: - Here, the ~colors~ layer is the only one enabled. It activates support for identifiers colorization, and strings representing colors. - #+BEGIN_SRC emacs-lisp - colors - #+END_SRC +Here, the ~colors~ layer is the only one enabled. It activates support for +identifiers colorization, and strings representing colors. +#+BEGIN_SRC emacs-lisp + colors +#+END_SRC *** Tools :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-Tools-e57e405e :END: - In this category, the first layer to be enabled is the CMake layer for which I enabled support for the ~cmake-ide~ package. - #+BEGIN_SRC emacs-lisp - (cmake :variables - cmake-enable-cmake-ide-support t) - #+END_SRC +In this category, the first layer to be enabled is the CMake layer for which I +enabled support for the ~cmake-ide~ package. +#+BEGIN_SRC emacs-lisp + (cmake :variables + cmake-enable-cmake-ide-support t) +#+END_SRC - Next, we have the Docker, Nginx, Pass (the standard Unix password manager), Prettier, Systemd, Meson, Imenu-list, Web-beautify, Dap, Helpful, and LSP layers enabled. - #+BEGIN_SRC emacs-lisp - dap docker helpful imenu-list lsp meson nginx pass prettier systemd - web-beautify - #+END_SRC +Next, we have the Docker, Nginx, Pass (the standard Unix password manager), +Prettier, Systemd, Meson, Imenu-list, Web-beautify, Dap, Helpful, and LSP layers +enabled. +#+BEGIN_SRC emacs-lisp + dap docker helpful imenu-list lsp meson nginx pass prettier systemd + web-beautify +#+END_SRC - We also have the RestClient layer enabled for which I enabled the Org compatibility support. - #+BEGIN_SRC emacs-lisp - (restclient :variables - restclient-use-org t) - #+END_SRC +We also have the RestClient layer enabled for which I enabled the Org +compatibility support. +#+BEGIN_SRC emacs-lisp + (restclient :variables + restclient-use-org t) +#+END_SRC - LanguageTool works with Flyspell and will check for grammatical issues in my english texts. - #+BEGIN_SRC emacs-lisp - (languagetool :variables - langtool-default-language "en-US" - languagetool-show-error-on-jump t - langtool-java-classpath "/usr/share/languagetool:/usr/share/java/languagetool/*") - #+END_SRC +LanguageTool works with Flyspell and will check for grammatical issues in my +english texts. +#+BEGIN_SRC emacs-lisp + (languagetool :variables + langtool-default-language "en-US" + languagetool-show-error-on-jump t + langtool-java-classpath "/usr/share/languagetool:/usr/share/java/languagetool/*") +#+END_SRC - And finally, we also have the Shell layer for which I specified its default height when spawning at the bottom of the screen should be 40 lines high, and the default shell to invoke is Eshell. - #+BEGIN_SRC emacs-lisp - (shell :variables - shell-default-height 40 - shell-default-position 'bottom - shell-default-shell 'eshell) - #+END_SRC +And finally, we also have the Shell layer for which I specified its default +height when spawning at the bottom of the screen should be 40 lines high, and +the default shell to invoke is Eshell. +#+BEGIN_SRC emacs-lisp + (shell :variables + shell-default-height 40 + shell-default-position 'bottom + shell-default-shell 'eshell) +#+END_SRC *** Web Services :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-Web_Services-c2888251 :END: - In this category, I have only enabled a layer for Twitter support. - #+BEGIN_SRC emacs-lisp - twitter - #+END_SRC +In this category, I have only enabled a layer for Twitter support. +#+BEGIN_SRC emacs-lisp +twitter +#+END_SRC *** Custom layers :PROPERTIES: :CUSTOM_ID: Spacemacs_layers_and_packages-Layers-Custom_layers-69473533 :END: -Lastly, one custom layers have been enabled: my custom layers for conlanging tools. +Lastly, one custom layers have been enabled: my custom layer for conlanging +tools. #+BEGIN_SRC emacs-lisp conlanging #+END_SRC @@ -537,7 +626,12 @@ conlanging ;; -*- lexical-binding: t -*- #+END_SRC -The ~dotspacemacs/init~ function is the one called at the very begining of the Spacemacs startup, before any kind of configuration, including the layer configuration. Only the values of the Spacemacs settings should be modified here. By default, every values are set in a ~setq-default~ sexp, and they represent all the supported Spacemacs settings. Hence, the function looks like this: +The ~dotspacemacs/init~ function is the one called at the very begining of the +Spacemacs startup, before any kind of configuration, including the layer +configuration. Only the values of the Spacemacs settings should be modified +here. By default, every values are set in a ~setq-default~ sexp, and they +represent all the supported Spacemacs settings. Hence, the function looks like +this: #+BEGIN_SRC emacs-lisp :tangle no (defun dotspacemacs/init () (setq-default @@ -550,7 +644,11 @@ The ~dotspacemacs/init~ function is the one called at the very begining of the S :header-args:emacs-lisp: :tangle no :exports code :results silent :lexical t :CUSTOM_ID: Init-Handling-my-Spacemacs-litterate-config-679170db :END: -Just before we get onto the usual content of the ~dotspacemacs/init~ function you would find in a typical Spacemacs installation, I would like to talk a bit about how I manage writing a litterate config for Spacemacs and ensure Emacs starts with an up-to-date configuration from said litterate config. For that, I actually declared a couple of variables: +Just before we get onto the usual content of the ~dotspacemacs/init~ function +you would find in a typical Spacemacs installation, I would like to talk a bit +about how I manage writing a litterate config for Spacemacs and ensure Emacs +starts with an up-to-date configuration from said litterate config. For that, I +actually declared a couple of variables: #+BEGIN_SRC emacs-lisp (defvar phundrak//dotspacemacs-src-dir "~/.config/emacs/private/" "Directory for my exported Elisp configuration files") @@ -563,7 +661,9 @@ Just before we get onto the usual content of the ~dotspacemacs/init~ function yo (defvar phundrak//dotspacemacs-files (list phundrak//dotspacemacs-si phundrak//dotspacemacs-sl phundrak//dotspacemacs-uc phundrak//dotspacemacs-ui)) #+END_SRC -I also declared the following function that tells me if my Elisp files are more recent than my ~emacs.org~ file. The ~compiled?~ argument lets me compare either the ~.el~ files if it is ~nil~, or the ~.elc~ files if it is ~t~. +I also declared the following function that tells me if my Elisp files are more +recent than my ~emacs.org~ file. The ~compiled?~ argument lets me compare either +the ~.el~ files if it is ~nil~, or the ~.elc~ files if it is ~t~. #+BEGIN_SRC emacs-lisp (defun phundrak/update-config-files-p (&optional compiled?) "Verify if any of my exported Elisp configuration files are @@ -580,7 +680,12 @@ I also declared the following function that tells me if my Elisp files are more (throw 'ret t))))) #+END_SRC -Now I know a couple of my files that get exported by this document. If I compare how recent these files are compared to my litterate config, I know if Emacs missed tangling its configuration before launching, so if any of my ~si~, ~sl~, ~uc~, or ~ui~ files are older than my ~emacs.org~, then I’ll tangle the latter; and since my user config is growing longer and longer, I want Emacs to be able to parse it fast next time it boots, so let’s compile my exported ~.el~ files! +Now I know a couple of my files that get exported by this document. If I compare +how recent these files are compared to my litterate config, I know if Emacs +missed tangling its configuration before launching, so if any of my ~si~, ~sl~, +~uc~, or ~ui~ files are older than my ~emacs.org~, then I’ll tangle the latter; +and since my user config is growing longer and longer, I want Emacs to be able +to parse it fast next time it boots, so let’s compile my exported ~.el~ files! #+BEGIN_SRC emacs-lisp (when (or (file-newer-than-file-p phundrak//dotspacemacs-src (concat phundrak//dotspacemacs-si ".el")) (file-newer-than-file-p phundrak//dotspacemacs-src (concat phundrak//dotspacemacs-sl ".el")) @@ -599,23 +704,36 @@ Now I know a couple of my files that get exported by this document. If I compare (byte-recompile-directory phundrak//dotspacemacs-src-dir 0 t))) #+END_SRC -All that’s left to do in the Spacemacs functions is to call ~load~ on ~si~, ~sl~, ~uc~, and ~ui~. Be aware this sub-chapter won’t be tangled, so it might not be up to date with the [[https://labs.phundrak.com/phundrak/dotfiles/src/branch/master/.spacemacs][actual dotspacemacs file]]. Please check it just in case something changed and I forgot to update this part of ~emacs.org~. +All that’s left to do in the Spacemacs functions is to call ~load~ on ~si~, +~sl~, ~uc~, and ~ui~. Be aware this sub-chapter won’t be tangled, so it might +not be up to date with the [[https://labs.phundrak.com/phundrak/dotfiles/src/branch/master/.spacemacs][actual dotspacemacs file]]. Please check it just in +case something changed and I forgot to update this part of ~emacs.org~. ** Emacs with pdumper :PROPERTIES: :CUSTOM_ID: Init-Emacs_with_pdumper-f24ab30b :END: -It is possible to compile Emacs 27 from source with support for the portable dumper, as shown in Spacemacs’ ~EXPERIMENTAL.org~ file. I do not use this feature yet, as I am still on Emacs 26 provided from Arch Linux’s repositories, so I’ll disable the Spacemacs support for this feature. The default value of this variable is ~nil~. +It is possible to compile Emacs 27 from source with support for the portable +dumper, as shown in Spacemacs’ ~EXPERIMENTAL.org~ file. I do not use this +feature yet, as I am still on Emacs 26 provided from Arch Linux’s repositories, +so I’ll disable the Spacemacs support for this feature. The default value of +this variable is ~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-enable-emacs-pdumper t) #+END_SRC -In case the support for pdumper was enabled, Spacemacs needs to know the name of the Emacs executable which supports such a feature. The executable must be in the user’s ~PATH~. By default, the value of the variable is ~"emacs"~. +In case the support for pdumper was enabled, Spacemacs needs to know the name of +the Emacs executable which supports such a feature. The executable must be in +the user’s ~PATH~. By default, the value of the variable is ~"emacs"~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-emacs-pdumper-executable-file "emacs") #+END_SRC -And finally, we can name the Spacemacs dump file. This is the file that will be created by the portable dumper in the cache directory under the ~dumps~ sub-directory. To load it when starting Emacs, the parameter ~--dump-file~ should be added when invoking Emacs 27.1 executable from the command line, for instance: +And finally, we can name the Spacemacs dump file. This is the file that will be +created by the portable dumper in the cache directory under the ~dumps~ +sub-directory. To load it when starting Emacs, the parameter ~--dump-file~ +should be added when invoking Emacs 27.1 executable from the command line, for +instance: #+BEGIN_SRC sh :tangle no :exports code ./emacs --dump-file=~/.config/emacs/.cache/dumps/spacemacs.pdmp #+END_SRC @@ -630,17 +748,25 @@ The default value of this variable is ~"spacemacs.pdmp"~. :PROPERTIES: :CUSTOM_ID: Init-Package_managment_and_updates-79363da3 :END: -Spacemacs’ core configuration can be updated via git commands using Github services. If Spacemacs is not set to the ~develop~ branch, it can check by itself if any update is available. However, I am using said branch, therefore I should set this variable to ~nil~. The default value is ~nil~. +Spacemacs’ core configuration can be updated via git commands using Github +services. If Spacemacs is not set to the ~develop~ branch, it can check by +itself if any update is available. However, I am using said branch, therefore I +should set this variable to ~nil~. The default value is ~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-check-for-update nil) #+END_SRC -When it comes to package management, Spacemacs is able to store them in different directories depending on the version of Emacs used or based on other variables. I personally prefer to use the value ~emacs-version~ since it makes it easier to upgrade or downgrade Emacs without any conflict with the already installed packages. The default value is ~emacs-version~. +When it comes to package management, Spacemacs is able to store them in +different directories depending on the version of Emacs used or based on other +variables. I personally prefer to use the value ~emacs-version~ since it makes +it easier to upgrade or downgrade Emacs without any conflict with the already +installed packages. The default value is ~emacs-version~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-elpa-subdirectory 'emacs-version) #+END_SRC -Spacemacs has a capacity of performing rollbacks after updates. We can set the maximum number of rollback slots to keep in the cache. The default value is ~5~. +Spacemacs has a capacity of performing rollbacks after updates. We can set the +maximum number of rollback slots to keep in the cache. The default value is ~5~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-max-rollback-slots 5) #+END_SRC @@ -649,12 +775,18 @@ Spacemacs has a capacity of performing rollbacks after updates. We can set the m :PROPERTIES: :CUSTOM_ID: Init-Package_managment_and_updates-Elpa_repository-c07fb1c4 :END: -It is possible to ask Emacs to use an HTTPS connection when contacting the Elpa whenever possible. This value should be set to ~nil~ when the user has no way to contact the Elpa though HTTPS, otherwise it is strongly recommended to let it set to ~t~. This variable however has no effect if Emacs is launched with the parameter ~--insecure~ which forces the value of this variable to ~nil~. The default value is ~t~. +It is possible to ask Emacs to use an HTTPS connection when contacting the Elpa +whenever possible. This value should be set to ~nil~ when the user has no way to +contact the Elpa though HTTPS, otherwise it is strongly recommended to let it +set to ~t~. This variable however has no effect if Emacs is launched with the +parameter ~--insecure~ which forces the value of this variable to ~nil~. The +default value is ~t~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-elpa-https t) #+END_SRC -We can set a maximum amount of seconds which will represent the maximum allowed time to contact the Elpa repository. By default, this setting is set on ~5~. +We can set a maximum amount of seconds which will represent the maximum allowed +time to contact the Elpa repository. By default, this setting is set on ~5~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-elpa-timeout 5) #+END_SRC @@ -663,12 +795,17 @@ We can set a maximum amount of seconds which will represent the maximum allowed :PROPERTIES: :CUSTOM_ID: Init-Package_managment_and_updates-Spacelpa_repository-a431b288 :END: -The Spacelpa repository is a Spacemacs-specific package repository. It is possible to use it as the primary source to install a locked version of a package. If the below value is set to ~nil~, then Spacemacs will install the latest version of packages from MELPA. I personally don’t use it, so I let it set to ~nil~. The default value is ~nil~. +The Spacelpa repository is a Spacemacs-specific package repository. It is +possible to use it as the primary source to install a locked version of a +package. If the below value is set to ~nil~, then Spacemacs will install the +latest version of packages from MELPA. I personally don’t use it, so I let it +set to ~nil~. The default value is ~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-use-spacelpa nil) #+END_SRC -If the below value is not ~nil~, then the signature for the downloaded Spacelpa packages must be verified. +If the below value is not ~nil~, then the signature for the downloaded Spacelpa +packages must be verified. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-verify-spacelpa-archives t) #+END_SRC @@ -677,11 +814,19 @@ If the below value is not ~nil~, then the signature for the downloaded Spacelpa :PROPERTIES: :CUSTOM_ID: Init-Editing_style-56d58a4b :END: -By default, Spacemacs encourages the use of evil-mode, which brings vim keybinding in Emacs. Still, it has three different styles available: -- ~vim~, which goes full evil-mode usage and most adapted to Emacs newcomers, especially if they were used to vim before, with the use of a normal mode and an insert mode. -- ~emacs~ which keeps an Emacs-like feel to the keybindings, without any difference between an insert or normal mode. -- ~hybrid~ is a modification of the ~vim~ mode which brings the ~emacs~ style in insert mode, but otherwise behaves like the ~vim~ style in normal mode. This is the style I personally use. -The value can also be a list with the ~:variables~ keyword (similar to layers). Check the editing styles section of the documentation for details on available variables. The default value is ~vim~. +By default, Spacemacs encourages the use of evil-mode, which brings vim +keybinding in Emacs. Still, it has three different styles available: +- ~vim~, which goes full evil-mode usage and most adapted to Emacs newcomers, + especially if they were used to vim before, with the use of a normal mode and + an insert mode. +- ~emacs~ which keeps an Emacs-like feel to the keybindings, without any + difference between an insert or normal mode. +- ~hybrid~ is a modification of the ~vim~ mode which brings the ~emacs~ style in + insert mode, but otherwise behaves like the ~vim~ style in normal mode. This + is the style I personally use. +The value can also be a list with the ~:variables~ keyword (similar to layers). +Check the editing styles section of the documentation for details on available +variables. The default value is ~vim~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-editing-style '(hybrid :variables @@ -689,7 +834,9 @@ The value can also be a list with the ~:variables~ keyword (similar to layers). hybrid-mode-default-state 'normal)) #+END_SRC -If non-nil, the paste transient-state is enabled. While enabled, after you paste something, pressing ~C-j~ and ~C-k~ several times cycles through the elements in the ~kill-ring~. Default ~nil~. +If non-nil, the paste transient-state is enabled. While enabled, after you paste +something, pressing ~C-j~ and ~C-k~ several times cycles through the elements in +the ~kill-ring~. Default ~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-enable-paste-transient-state t) #+END_SRC @@ -698,29 +845,41 @@ If non-nil, the paste transient-state is enabled. While enabled, after you paste :PROPERTIES: :CUSTOM_ID: Init-Spacemacs_home_configuration-8375cdcc :END: -The value below specifies the startup banner of Spacemacs. The default value is ~official~, it displays the official Spacemacs logo. An integer value is the index of text banner, ~random~ chooses a random text banner in the ~core/banners~ directory. A string value must be a path to an image format supported by your Emacs build. If the value is nil, then no banner is displayed. The default value is ~official~. +The value below specifies the startup banner of Spacemacs. The default value is +~official~, it displays the official Spacemacs logo. An integer value is the +index of text banner, ~random~ chooses a random text banner in the +~core/banners~ directory. A string value must be a path to an image format +supported by your Emacs build. If the value is nil, then no banner is displayed. +The default value is ~official~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-startup-banner 'official) #+END_SRC -On the Spacemacs homepage, a list of elements can also be shown, be it recent files, projects, agenda items,… Each of the elements making up the list value of the below variable are pairs in the form ~(list-type . list-size)~. If the value is ~nil~, then it is disabled. The possible values for ~list-type~ are: +On the Spacemacs homepage, a list of elements can also be shown, be it recent +files, projects, agenda items,… Each of the elements making up the list value of +the below variable are pairs in the form ~(list-type . list-size)~. If the value +is ~nil~, then it is disabled. The possible values for ~list-type~ are: - ~recents~ :: displays recently opened files - ~bookmarks~ :: displays saved bookmarks - ~projects~ :: displays projectile projects recently opened - ~agenda~ :: displays upcoming events from Org-mode agendas - ~todos~ :: displays recent TODOs detected in projectile projects -The order in which they are set in the below list affects their order on the Spacemacs startup page. List sikes may be ~nil~, in which case ~spacemacs-buffer-startup-lists-length~ takes effect. +The order in which they are set in the below list affects their order on the +Spacemacs startup page. List sikes may be ~nil~, in which case +~spacemacs-buffer-startup-lists-length~ takes effect. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-startup-lists '((recents . 15) (projects . 15))) #+END_SRC -The below variable allows the startup page to respond to resize events. Its default value is ~t~. +The below variable allows the startup page to respond to resize events. Its +default value is ~t~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-startup-buffer-responsive t) #+END_SRC -If non-nil show the version string in the Spacemacs buffer. It will appear as ~(spacemacs version)@(emacs version)~. Default ~t~. +If non-nil show the version string in the Spacemacs buffer. It will appear as +~(spacemacs version)@(emacs version)~. Default ~t~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-startup-buffer-show-version t) #+END_SRC @@ -729,17 +888,22 @@ If non-nil show the version string in the Spacemacs buffer. It will appear as ~( :PROPERTIES: :CUSTOM_ID: Init-Default_major_modes-37f4a891 :END: -The below variable sets a default major mode for a new empty buffer. Possible values are mode names such as ~text-mode~, or ~nil~ to use Fundamental mode. The default value is ~text-mode~, but I prefer to use ~org-mode~ by default. +The below variable sets a default major mode for a new empty buffer. Possible +values are mode names such as ~text-mode~, or ~nil~ to use Fundamental mode. The +default value is ~text-mode~, but I prefer to use ~org-mode~ by default. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-new-empty-buffer-major-mode 'org-mode) #+END_SRC -Similarly, the below variable sets the default mode for the scratch buffer. Its default value is ~text-mode~, but I set it to use ~emacs-lisp-mode~ by default. +Similarly, the below variable sets the default mode for the scratch buffer. Its +default value is ~text-mode~, but I set it to use ~emacs-lisp-mode~ by default. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-scratch-mode 'emacs-lisp-mode) #+END_SRC -By the way, it is possible to set a default message for the scratch buffer, such as “Welcome to Spacemacs!”. I prefer to keep it clean. The default value is ~nil~. +By the way, it is possible to set a default message for the scratch buffer, such +as “Welcome to Spacemacs!”. I prefer to keep it clean. The default value is +~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-initial-scratch-message nil) #+END_SRC @@ -752,7 +916,9 @@ By the way, it is possible to set a default message for the scratch buffer, such :PROPERTIES: :CUSTOM_ID: Init-Visual_configuration-Themes-315992bb :END: -Spacemacs makes it quite easy to use themes and organize them. The below value is a list of themes, the first of the list is loaded when Spacemacs starts. The user can press ~SPC T n~ to cycle to the next theme in the list. +Spacemacs makes it quite easy to use themes and organize them. The below value +is a list of themes, the first of the list is loaded when Spacemacs starts. The +user can press ~SPC T n~ to cycle to the next theme in the list. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-themes '(nord doom-nord doom-vibrant spacemacs-dark doom-one doom-opera doom-dracula doom-molokai @@ -762,32 +928,43 @@ Spacemacs makes it quite easy to use themes and organize them. The below value i kaolin-valley-dark)) #+END_SRC -Emacs also makes use of themes for the Spaceline at the bottom of buffers. Supported themes are: +Emacs also makes use of themes for the Spaceline at the bottom of buffers. +Supported themes are: - ~spacemacs~ - ~all-the-icons~ - ~custom~ - ~doom~ (the one I use) - ~vim-powerline~ - ~vanilla~ -The first three are Spaceline themes. ~doom~ is the Doom-Emacs mode-line, and ~vanilla~ is the default Emacs mode-line. ~custom~ is a user defined theme, refer to Spacemacs’ ~DOCUMENTATION.org~ file for more info on how to create your own Spaceline theme. Value can be a symbol or list with additional properties. The default value is ~'(spacemacs :separator wave :separator-scale 1.5))~. +The first three are Spaceline themes. ~doom~ is the Doom-Emacs mode-line, and +~vanilla~ is the default Emacs mode-line. ~custom~ is a user defined theme, +refer to Spacemacs’ ~DOCUMENTATION.org~ file for more info on how to create your +own Spaceline theme. Value can be a symbol or list with additional properties. +The default value is ~'(spacemacs :separator wave :separator-scale 1.5))~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-mode-line-theme '(doom :separator wave :separator-scale 1.0)) #+END_SRC -It is also possible to color the cursor depending on which mode Spacemacs is in, in order to mach the state color in GUI Emacs. The default value is ~t~. +It is also possible to color the cursor depending on which mode Spacemacs is in, +in order to mach the state color in GUI Emacs. The default value is ~t~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-colorize-cursor-according-to-state t) #+END_SRC -The below variable sets either the default font or a prioritized list of fonts to be used by Emacs. The ~:size~ can be specified as a non-negative integer (pixel size), or a floating-point (point size). Point size is recommended, because it’s device independent (add a ~.0~ to make an integer a floating point). The default size is ~10.0~. +The below variable sets either the default font or a prioritized list of fonts +to be used by Emacs. The ~:size~ can be specified as a non-negative integer +(pixel size), or a floating-point (point size). Point size is recommended, +because it’s device independent (add a ~.0~ to make an integer a floating +point). The default size is ~10.0~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-default-font '("Cascadia Code" :size 9.0)) #+END_SRC -I also added the following code in order to define a fallback font for emojis, defined only on their unicode range: +I also added the following code in order to define a fallback font for emojis, +defined only on their unicode range: #+BEGIN_SRC emacs-lisp (set-fontset-font "fontset-default" '(#x1f600 . #x1f64f) "NotoEmoji Nerd Font") #+END_SRC @@ -796,7 +973,9 @@ I also added the following code in order to define a fallback font for emojis, d :PROPERTIES: :CUSTOM_ID: Init-Visual_configuration-Other_on-screen_elements-7d334e09 :END: -~which-key~ is a helper which displays available keyboard shortcuts. This variable sets in seconds the time Spacemacs should wait between a key press and the moment ~which-key~ should be shown. +~which-key~ is a helper which displays available keyboard shortcuts. This +variable sets in seconds the time Spacemacs should wait between a key press and +the moment ~which-key~ should be shown. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-which-key-delay 1) #+END_SRC @@ -805,42 +984,61 @@ This variable sets ~which-key~'s frame position. Possible values are: - ~right~ - ~bottom~ - ~right-then-bottom~ -~right-then-bottom~ tries to display the frame to the right, but if there is insufficient space it displays it at the bottom. The default value is ~bottom~. +~right-then-bottom~ tries to display the frame to the right, but if there is +insufficient space it displays it at the bottom. The default value is ~bottom~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-which-key-position 'right-then-bottom) #+END_SRC -This controls where ~switch-to-buffer~ displays the buffer. If the value is ~nil~, ~switch-to-buffer~ displays the buffer in the current window even if another same-purpose window is available. If non-nil, ~switch-to-buffer~ displays the buffer in a same-purpose window even if the buffer can be displayed in the current window. The default value is ~nil~. +This controls where ~switch-to-buffer~ displays the buffer. If the value is +~nil~, ~switch-to-buffer~ displays the buffer in the current window even if +another same-purpose window is available. If non-nil, ~switch-to-buffer~ +displays the buffer in a same-purpose window even if the buffer can be displayed +in the current window. The default value is ~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-switch-to-buffer-prefers-purpose nil) #+END_SRC -If this variable is non-nil, a progress bar is displayed when Spacemacs is loading. This may increase the boot time on some systems and emacs builds, set it to ~nil~ to boost the loading time. The default value is ~t~. +If this variable is non-nil, a progress bar is displayed when Spacemacs is +loading. This may increase the boot time on some systems and emacs builds, set +it to ~nil~ to boost the loading time. The default value is ~t~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-loading-progress-bar t) #+END_SRC -If the value is non-nil, Emacs will show the title of the transient states. The default value is ~t~. +If the value is non-nil, Emacs will show the title of the transient states. The +default value is ~t~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-show-transient-state-title t) #+END_SRC -If non-nil, this will show the color guide hint for transient state keys. The default value is ~t~. +If non-nil, this will show the color guide hint for transient state keys. The +default value is ~t~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-show-transient-state-color-guide t) #+END_SRC -If non-nil, unicode symbols are displayed in the mode line. If you use Emacs as a daemon and want unicode characters only in GUI set the value to quoted ~display-graphic-p~. The default value is ~t~. +If non-nil, unicode symbols are displayed in the mode line. If you use Emacs as +a daemon and want unicode characters only in GUI set the value to quoted +~display-graphic-p~. The default value is ~t~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-mode-line-unicode-symbols t) #+END_SRC -If non-nil, smooth scrolling (native-scrolling) is enabled. Smooth scrolling overrides the default behavior of Emacs which recenters point when it reaches the top or bottom of the screen. The default value is ~t~. +If non-nil, smooth scrolling (native-scrolling) is enabled. Smooth scrolling +overrides the default behavior of Emacs which recenters point when it reaches +the top or bottom of the screen. The default value is ~t~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-smooth-scrolling t) #+END_SRC -The following value controls the line number activation. If set to ~t~, ~relative~ or ~visual~ then line numbers are enabled in all ~prog-mode~ and ~text-mode~ derivatives. If set to ~relative~, line numbers are relative. If set to ~visual~, line numbers are also relative, but only visual lines are counted. For example, folded lines will not be counted and wrapped lines are counted as multiple lines. This variable can also be set to a property list for finer control: +The following value controls the line number activation. If set to ~t~, +~relative~ or ~visual~ then line numbers are enabled in all ~prog-mode~ and +~text-mode~ derivatives. If set to ~relative~, line numbers are relative. If set +to ~visual~, line numbers are also relative, but only visual lines are counted. +For example, folded lines will not be counted and wrapped lines are counted as +multiple lines. This variable can also be set to a property list for finer +control: #+BEGIN_SRC emacs-lisp :tangle no '(:relative nil :visual nil @@ -869,17 +1067,20 @@ The default value is ~all~ (highlights any scope and emphasis the current one). (setq-default dotspacemacs-highlight-delimiters 'all) #+END_SRC -After a certain amount of time in seconds, Spacemacs can zone-out. The default value is ~nil~. I set it so Spacemacs zones out after 15 minutes. +After a certain amount of time in seconds, Spacemacs can zone-out. The default +value is ~nil~. I set it so Spacemacs zones out after 15 minutes. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-zone-out-when-idle 900) #+END_SRC -Run ~spacemacs/prettify-org-buffer~ when visiting the ~README.org~ files of Spacemacs. The default value is ~nil~. +Run ~spacemacs/prettify-org-buffer~ when visiting the ~README.org~ files of +Spacemacs. The default value is ~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-pretty-docs nil) #+END_SRC -If ~nil~, the home buffer shows the full path of agenda items and todos. If non ~nil~, only the file name is shown. +If ~nil~, the home buffer shows the full path of agenda items and todos. If non +~nil~, only the file name is shown. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-home-shorten-agenda-source t) #+END_SRC @@ -888,32 +1089,47 @@ If ~nil~, the home buffer shows the full path of agenda items and todos. If non :PROPERTIES: :CUSTOM_ID: Init-Visual_configuration-Appearance_of_Emacs_frames-59700bb7 :END: -Starting from Emacs 24.4, it is possible to make the Emacs frame fullscreen when Emacs starts up if the variable is set to a non-nil value. The default value is ~nil~. +Starting from Emacs 24.4, it is possible to make the Emacs frame fullscreen when +Emacs starts up if the variable is set to a non-nil value. The default value is +~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-fullscreen-at-startup nil) #+END_SRC -This variable is to be used if the user does not want to use native fullscreen with ~spacemacs/toggle-fullscreen~. This disables for instance the fullscreen animation under OSX. The default value is ~nil~. +This variable is to be used if the user does not want to use native fullscreen +with ~spacemacs/toggle-fullscreen~. This disables for instance the fullscreen +animation under OSX. The default value is ~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-fullscreen-use-non-native nil) #+END_SRC -If you do not start Emacs in fullscreen at startup, you might want it to be maximized by default. If the value for the variable below is set to be non-nil, the frame will be maximized. This can only work if ~dotspacemacs-fullscreen-at-startup~ is set to ~nil~, and it is only available from Emacs 24.4 onwards. The default value is ~nil~. +If you do not start Emacs in fullscreen at startup, you might want it to be +maximized by default. If the value for the variable below is set to be non-nil, +the frame will be maximized. This can only work if +~dotspacemacs-fullscreen-at-startup~ is set to ~nil~, and it is only available +from Emacs 24.4 onwards. The default value is ~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-maximized-at-startup nil) #+END_SRC -If non-nil, the frame is undecorated when Emacs starts up. Combine this with the variable ~dotspacemacs-maximized-at-startup~ in OSX to obtain borderless fullscreen. The default value is ~nil~. +If non-nil, the frame is undecorated when Emacs starts up. Combine this with the +variable ~dotspacemacs-maximized-at-startup~ in OSX to obtain borderless +fullscreen. The default value is ~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-undecorated-at-startup nil) #+END_SRC -You can also set a transparency level for Emacs when you toggle the transparency of the frame with ~toggle-transparency~. The value of the transparency, going from 0 to 100 in increasing opacity, describes the transparency level of a frame when it’s active or selected. The default value is ~90~. +You can also set a transparency level for Emacs when you toggle the transparency +of the frame with ~toggle-transparency~. The value of the transparency, going +from 0 to 100 in increasing opacity, describes the transparency level of a frame +when it’s active or selected. The default value is ~90~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-active-transparency 85) #+END_SRC -Similarly, you can set a value from 0 to 100 in increasing opacity which describes the transparency level of a frame when it’s inactive or deselected. The default value is ~90~. +Similarly, you can set a value from 0 to 100 in increasing opacity which +describes the transparency level of a frame when it’s inactive or deselected. +The default value is ~90~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-inactive-transparency 80) #+END_SRC @@ -929,7 +1145,8 @@ The variable below sets the format of frame title. You can use: - ~%F~ :: frame name - ~%s~ :: process status - ~%p~ :: percent of buffer above top of window, or Top, Bot, or All -- ~%P~ :: percent of buffer above bottom of window, perhaps plus Top, or Bot, or All +- ~%P~ :: percent of buffer above bottom of window, perhaps plus Top, or Bot, or + All - ~%m~ :: mode name - ~%n~ :: Narrow if appropriate - ~%z~ :: mnemonics of buffer, terminal, and keyboard coding systems @@ -939,7 +1156,8 @@ The default value is ~"%I@%S"~. (setq-default dotspacemacs-frame-title-format "Emacs: %b (%t) %U@%S") #+END_SRC -Format specification for setting the icon title format. The default value is ~nil~, same as ~frame-title-format~. +Format specification for setting the icon title format. The default value is +~nil~, same as ~frame-title-format~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-icon-title-format nil) #+END_SRC @@ -948,38 +1166,49 @@ Format specification for setting the icon title format. The default value is ~ni :PROPERTIES: :CUSTOM_ID: Init-Spacemacs_leader_keys_and_shortcuts-ebf21abe :END: -The below setting sets the Spacemacs leader key. By default, this is the ~SPC~ key. +The below setting sets the Spacemacs leader key. By default, this is the ~SPC~ +key. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-leader-key "SPC") #+END_SRC -Once the leader key has been pressed, it is possible to set another key in order to call Emacs’ command ~M-x~. By default, it is again the ~SPC~ key. +Once the leader key has been pressed, it is possible to set another key in order +to call Emacs’ command ~M-x~. By default, it is again the ~SPC~ key. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-emacs-command-key "SPC") #+END_SRC -It is also possible to invoke Vim Ex commands with the press of a key, and by default it is the ~:~ key. +It is also possible to invoke Vim Ex commands with the press of a key, and by +default it is the ~:~ key. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-ex-command-key ":") #+END_SRC -The below variable sets the leader key accessible in ~emacs-state~ and ~insert-state~: +The below variable sets the leader key accessible in ~emacs-state~ and +~insert-state~: #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-emacs-leader-key "M-m") #+END_SRC -The major mode leader key is a shortcut key which is the equivalent of pressing ~ m~. Set it to ~nil~ to disable it. Its default value is ~,~. +The major mode leader key is a shortcut key which is the equivalent of pressing +~ m~. Set it to ~nil~ to disable it. Its default value is ~,~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-major-mode-leader-key ",") #+END_SRC -In ~emacs-state~ and ~insert-state~, the same major mode leader key can be accessible from another shortcut, which by default is ~C-M-m~ in terminal mode, or ~M-return~ in GUI mode. +In ~emacs-state~ and ~insert-state~, the same major mode leader key can be +accessible from another shortcut, which by default is ~C-M-m~ in terminal mode, +or ~M-return~ in GUI mode. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-major-mode-emacs-leader-key (if window-system "" "C-M-m")) #+END_SRC -These variables control whether separate commands are bound in the GUI to the key pairs ~C-i~ and ~TAB~, and ~C-m~ and ~RET~. Setting it to a non-nil value allows for separate commands under ~C-i~ and ~TAB~, and ~C-m~ and ~RET~. In the terminal, these pairs are generally indistinguishable, so this only works in the GUI. The default value is ~nil~. +These variables control whether separate commands are bound in the GUI to the +key pairs ~C-i~ and ~TAB~, and ~C-m~ and ~RET~. Setting it to a non-nil value +allows for separate commands under ~C-i~ and ~TAB~, and ~C-m~ and ~RET~. In the +terminal, these pairs are generally indistinguishable, so this only works in the +GUI. The default value is ~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-distinguish-gui-tab nil) #+END_SRC @@ -988,22 +1217,27 @@ These variables control whether separate commands are bound in the GUI to the ke :PROPERTIES: :CUSTOM_ID: Init-Layouts-61c0374d :END: -The variable belows sets the name of the default layout. Its default value is ~"Default"~. +The variable belows sets the name of the default layout. Its default value is +~"Default"~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-default-layout-name "Default") #+END_SRC -If non-nil, the default layout name is displayed in the mode-line. The default value is ~nil~. +If non-nil, the default layout name is displayed in the mode-line. The default +value is ~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-display-default-layout nil) #+END_SRC -If non-nil, then the last auto saved layouts are resumed automatically upon start. The default value is ~nil~. +If non-nil, then the last auto saved layouts are resumed automatically upon +start. The default value is ~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-auto-resume-layouts nil) #+END_SRC -If non-nil, the layout name will be auto-generated when creating new layouts. It only has an effect when using the “jump to layout by number” command. The default value is ~nil~. +If non-nil, the layout name will be auto-generated when creating new layouts. It +only has an effect when using the “jump to layout by number” command. The +default value is ~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-auto-generate-layout-names nil) #+END_SRC @@ -1012,7 +1246,9 @@ If non-nil, the layout name will be auto-generated when creating new layouts. It :PROPERTIES: :CUSTOM_ID: Init-Files-related_settings-67fba383 :END: -The below value sets the size in MB above which Spacemacs will prompt to open the file literally in order to avoid preformance issues. Opening a file literally means that no major or minor mode is active. The default value is ~1~. +The below value sets the size in MB above which Spacemacs will prompt to open +the file literally in order to avoid preformance issues. Opening a file +literally means that no major or minor mode is active. The default value is ~1~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-large-file-size 5) #+END_SRC @@ -1030,17 +1266,22 @@ The default value is ~cache~. :PROPERTIES: :CUSTOM_ID: Init-Emacs_server-d3947c28 :END: -Emacs can be launched as a server if the following value is set to non-nil and if one isn’t already running. The default value is ~nil~. +Emacs can be launched as a server if the following value is set to non-nil and +if one isn’t already running. The default value is ~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-enable-server nil) #+END_SRC -You can also set a custom emacs server socket location. If the value is ~nil~, Emacs will use whatever the Emacs default is, otherwise a directory path like ="$HOME/.config/emacs/server"=. It has no effect if ~dotspacemacs-enable-server~ is ~nil~. +You can also set a custom emacs server socket location. If the value is ~nil~, +Emacs will use whatever the Emacs default is, otherwise a directory path like +="$HOME/.config/emacs/server"=. It has no effect if ~dotspacemacs-enable-server~ +is ~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-server-socket-dir nil) #+END_SRC -It is also possible to tell Emacs that the quit function should keep the server open when quitting. The default value is ~nil~. +It is also possible to tell Emacs that the quit function should keep the server +open when quitting. The default value is ~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-persistent-server t) #+END_SRC @@ -1049,22 +1290,27 @@ It is also possible to tell Emacs that the quit function should keep the server :PROPERTIES: :CUSTOM_ID: Init-Miscellaneous-6b4f0b76 :END: -This value changes the folding method of code blocks. The possible values are either ~evil~, the default value, or ~origami~. +This value changes the folding method of code blocks. The possible values are +either ~evil~, the default value, or ~origami~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-folding-method 'evil) #+END_SRC -If non-nil, ~smartparens-strict-mode~ will be enabled in programming modes. The default value is ~nil~. +If non-nil, ~smartparens-strict-mode~ will be enabled in programming modes. The +default value is ~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-smartparens-strict-mode nil) #+END_SRC -If non-nil, pressing the closing parenthesis ~)~ key in insert mode passes over any automatically added closing parenthesis, bracket, quote, etc… This can temporarily disabled by pressing ~C-q~ before ~)~. The default value is ~nil~. +If non-nil, pressing the closing parenthesis ~)~ key in insert mode passes over +any automatically added closing parenthesis, bracket, quote, etc… This can +temporarily disabled by pressing ~C-q~ before ~)~. The default value is ~nil~. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-smart-closing-parenthesis nil) #+END_SRC -List of search tool executable names. Spacemacs uses the first installed tool of the list. Supported tools are: +List of search tool executable names. Spacemacs uses the first installed tool of +the list. Supported tools are: - ~rg~ - ~ag~ - ~pt~ @@ -1085,25 +1331,35 @@ The default value is ~nil~. (setq-default dotspacemacs-whitespace-cleanup nil) #+END_SRC -et ~gc-cons-threshold~ and ~gc-cons-percentage~ when startup finishes. This is an advanced option and should not be changed unless you suspect performance issues due to garbage collection operations. The default is ~'(100000000 0.1)~ -+BEGIN_SRC emacs-lisp - (setq-default dotspacemacs-gc-cons '(100000000 0.1)) -+END_SRC +Set ~gc-cons-threshold~ and ~gc-cons-percentage~ when startup finishes. This is +an advanced option and should not be changed unless you suspect performance +issues due to garbage collection operations. The default is ~'(100000000 0.1)~ +#+BEGIN_SRC emacs-lisp + (setq-default dotspacemacs-gc-cons '(100000000 0.1)) +#+END_SRC -f non nil activate ~clean-aindent-mode~ which tries to correct virtual indentation of simple modes. This can interfer with mode specific indent handling like has been reported for ~go-mode~. If it does deactivate it here. Default ~t~. -+BEGIN_SRC emacs-lisp - (setq-default dotspacemacs-use-clean-aindent-mode t) -+END_SRC +If non nil activate ~clean-aindent-mode~ which tries to correct virtual +indentation of simple modes. This can interfer with mode specific indent +handling like has been reported for ~go-mode~. If it does deactivate it here. +Default ~t~. +#+BEGIN_SRC emacs-lisp + (setq-default dotspacemacs-use-clean-aindent-mode t) +#+END_SRC -f non ~nil~, shift your number row to match the entered keyboard layout (only in insert state). Currently supported keyboard layouts are ~querty-us~, ~quertz-de~ and ~querty-ca-fr~. New layouts can be added in ~spacemacs-editing~ layer. Default ~nil~. -+BEGIN_SRC emacs-lisp - (setq-default dotspacemacs-swap-number-row nil) -+END_SRC +If non ~nil~, shift your number row to match the entered keyboard layout (only +in insert state). Currently supported keyboard layouts are ~querty-us~, +~quertz-de~ and ~querty-ca-fr~. New layouts can be added in ~spacemacs-editing~ +layer. Default ~nil~. +#+BEGIN_SRC emacs-lisp + (setq-default dotspacemacs-swap-number-row nil) +#+END_SRC -et ~read-process-output-max~ when startup finishes. This defines how much data is read from a foreign process. Setting this >= 1 MB should increase performance for lsp servers in emacs 27. -+BEGIN_SRC emacs-lisp - (setq-default dotspacemacs-read-process-output-max (* 1024 1024 8)) -+END_SRC +Set ~read-process-output-max~ when startup finishes. This defines how much data +is read from a foreign process. Setting this >= 1 MB should increase performance +for lsp servers in emacs 27. +#+BEGIN_SRC emacs-lisp + (setq-default dotspacemacs-read-process-output-max (* 1024 1024 8)) +#+END_SRC * User Initialization :PROPERTIES: @@ -1114,12 +1370,15 @@ et ~read-process-output-max~ when startup finishes. This defines how much data i ;; -*- lexical-binding: t -*- #+END_SRC -While Emacs and especially Spacemacs loads, I want it to initialize some elements and load some packages. First of all, I want it to load my private Emacs config file: +While Emacs and especially Spacemacs loads, I want it to initialize some +elements and load some packages. First of all, I want it to load my private +Emacs config file: #+BEGIN_SRC emacs-lisp (load "~/.config/emacs/private/private_emacs") #+END_SRC -I’ll also load a package I cloned locally as it is not (yet?) available in the MELPA: [[https://github.com/awth13/org-appear][org-appear]]. +I’ll also load a package I cloned locally as it is not (yet?) available in the +MELPA: [[https://github.com/awth13/org-appear][org-appear]]. #+BEGIN_SRC emacs-lisp (require 'org-appear "~/fromGIT/emacs-packages/org-appear/org-appear.el") #+END_SRC @@ -1134,7 +1393,8 @@ Then, I want a couple of requires: (require 'tramp) #+END_SRC -I would also like to enable the setup of flycheck for Rust when Flycheck is loaded: +I would also like to enable the setup of flycheck for Rust when Flycheck is +loaded: #+BEGIN_SRC emacs-lisp (add-hook 'flycheck-mode-hook #'flycheck-rust-setup) #+END_SRC @@ -1144,7 +1404,8 @@ By default, Flyspell should be disabled and only enabled manually. (flyspell-mode 0) #+END_SRC -Finally, here is a quick workaround for Tramp, sometimes it cannot connect to my hosts if I don’t have this code snippet. +Finally, here is a quick workaround for Tramp, sometimes it cannot connect to my +hosts if I don’t have this code snippet. #+BEGIN_SRC emacs-lisp (setq tramp-ssh-controlmaster-options "-o ControlMaster=auto -o ControlPath='tramp.%%C' -o ControlPersist=no") @@ -1162,15 +1423,20 @@ Finally, here is a quick workaround for Tramp, sometimes it cannot connect to my :PROPERTIES: :CUSTOM_ID: User_Configuration-Custom_functions-ceb4bc42 :END: -In this section, I will put my various custom functions that do not fit in other sections and which are more oriented towards general usage throughout Emacs and in Elisp code. +In this section, I will put my various custom functions that do not fit in other +sections and which are more oriented towards general usage throughout Emacs and +in Elisp code. -Almost all of my code snippets will be prefixed by either my name or the name of the package or layer they are part of, unless they are an explicit overwrite of a function that already exists. +Almost all of my code snippets will be prefixed by either my name or the name of +the package or layer they are part of, unless they are an explicit overwrite of +a function that already exists. *** Nord theming variables :PROPERTIES: :CUSTOM_ID: User_Configuration-Custom_functions_and_variables-Some_theming_variables-9b853a99 :END: -Yes, I do use a preconfigured theme, as mentioned above, but for some elements such as Eshell, I need to define some variables for color, and I’ll do it here. +Yes, I do use a preconfigured theme, as mentioned above, but for some elements +such as Eshell, I need to define some variables for color, and I’ll do it here. #+BEGIN_SRC emacs-lisp (defvar phundrak/nord0 "#2e3440") (defvar phundrak/nord1 "#3b4252") @@ -1194,7 +1460,9 @@ Yes, I do use a preconfigured theme, as mentioned above, but for some elements s :PROPERTIES: :CUSTOM_ID: User-Configuration-Custom-functions-macros-and-variables-with-face-7974e15f :END: -~with-face~ is a simple yet very useful macro that allows me to easily create strings with faces defined as properties to the string passed as the first argument. Here is how it is implemented: +~with-face~ is a simple yet very useful macro that allows me to easily create +strings with faces defined as properties to the string passed as the first +argument. Here is how it is implemented: #+BEGIN_SRC emacs-lisp (defmacro with-face ($str &rest $properties) "Helper macro for creating strings with faces" @@ -1205,7 +1473,10 @@ Yes, I do use a preconfigured theme, as mentioned above, but for some elements s :PROPERTIES: :CUSTOM_ID: User-Configuration-Custom-functions-macros-and-variables-phundrak-abbr-path-559b46e3 :END: -The following is a nice little function I use in my Eshell prompt. It shortens the name of all the parent directories of the current one in its path, but leaves the current one written in full. It also abbreviates the equivalent of the ~$HOME~ (~/home//~) directory to a simple =~=. +The following is a nice little function I use in my Eshell prompt. It shortens +the name of all the parent directories of the current one in its path, but +leaves the current one written in full. It also abbreviates the equivalent of +the ~$HOME~ (~/home//~) directory to a simple =~=. #+BEGIN_SRC emacs-lisp (defun phundrak/abbr-path ($path &optional $abbreviate) "Abbreviate `$path'. If `$abbreviate' is `t', then all parent @@ -1255,7 +1526,10 @@ The following is a nice little function I use in my Eshell prompt. It shortens t :PROPERTIES: :CUSTOM_ID: User-Configuration-Custom-functions-macros-and-variables-phundrak-blog-publish-99c96b2d :END: -This function is quite a simple function made to automatically publish [[https://blog.phundrak.com][my blog]] based on Hugo. After exporting my blog using ~ox-hugo~, I simply have to call this function which will look for all files located in =~/org/blog/public= and copy them to my remote server once ~hugo~ has been executed in =~/org/blog=. +This function is quite a simple function made to automatically publish [[https://blog.phundrak.com][my blog]] +based on Hugo. After exporting my blog using ~ox-hugo~, I simply have to call +this function which will look for all files located in =~/org/blog/public= and +copy them to my remote server once ~hugo~ has been executed in =~/org/blog=. #+BEGIN_SRC emacs-lisp (defun phundrak/blog-publish () (interactive) @@ -1276,7 +1550,12 @@ This function is quite a simple function made to automatically publish [[https:/ :PROPERTIES: :CUSTOM_ID: User-Configuration-Custom-functions-macros-and-variables-phundrak-eshell-git-status-28f16e94 :END: -This function is used in my Eshell prompt which you can consult [[#User_Configuration-Eshell-Eshell_theme-a06715a9][here]]. This function basically executes two git calls to get some information about a git repo, which path we provide as an argument. Based on the result of these git calls, the function will know what it needs to know about the repo to build a git prompt that will be inserted in my Eshell prompt. And just for shit and giggles, I’ve made it so it is a powerline prompt. +This function is used in my Eshell prompt which you can consult [[#User_Configuration-Eshell-Eshell_theme-a06715a9][here]]. This +function basically executes two git calls to get some information about a git +repo, which path we provide as an argument. Based on the result of these git +calls, the function will know what it needs to know about the repo to build a +git prompt that will be inserted in my Eshell prompt. And just for shit and +giggles, I’ve made it so it is a powerline prompt. #+BEGIN_SRC emacs-lisp (defun phundrak/eshell-git-status ($path &optional $background-color) "Returns a string indicating the status of the current @@ -1345,13 +1624,22 @@ This function is used in my Eshell prompt which you can consult [[#User_Configur :PROPERTIES: :CUSTOM_ID: Custom-functions-phundrak-find-org-files-a8fd200f :END: -There are lots of files which I want to be able to quickly open. I used to have one shortcut for each one of these files, but as their number grew, I decided to switch to helm for my file selector which will be called by only one common shortcut. Most of my files will be located in =~/org=, but I have some conlanging files which are located in =~/Documents/conlanging=, and all my university notes are in =~/Documents/university=. Let’s declare these directories in a variable: +There are lots of files which I want to be able to quickly open. I used to have +one shortcut for each one of these files, but as their number grew, I decided to +switch to helm for my file selector which will be called by only one common +shortcut. Most of my files will be located in =~/org=, but I have some +conlanging files which are located in =~/Documents/conlanging=, and all my +university notes are in =~/Documents/university=. Let’s declare these +directories in a variable: #+BEGIN_SRC emacs-lisp (defvar phundrak/org-directories '("~/org" "~/Documents/university/S8" "~/Documents/conlanging") "Directories in which to look for org files with the function `phundrak/find-org-files'") #+END_SRC -With this established, let’s write some emacs-lisp that will allow me to get a list of all these files and select them through helm. Be aware that I will be using some functions from third party packages, such as [[https://github.com/magnars/s.el][s.el]] and [[https://github.com/magnars/dash.el][dash]], as well as [[https://github.com/sharkdp/fd][fd]]. +With this established, let’s write some emacs-lisp that will allow me to get a +list of all these files and select them through helm. Be aware that I will be +using some functions from third party packages, such as [[https://github.com/magnars/s.el][s.el]] and [[https://github.com/magnars/dash.el][dash]], as well +as [[https://github.com/sharkdp/fd][fd]]. #+BEGIN_SRC emacs-lisp (defun phundrak/find-org-files () "Find all org files in the directories listed in @@ -1373,7 +1661,9 @@ With this established, let’s write some emacs-lisp that will allow me to get a :PROPERTIES: :CUSTOM_ID: User-Configuration-Custom-functions-macros-and-variables-phundrak-git-repo-root-f7cf3bb9 :END: -This function detects if the path passed as an argument points to a git directory or to one of its subdirectories. If it is, it will return the path to the root of the git repository, else it will return ~nil~. +This function detects if the path passed as an argument points to a git +directory or to one of its subdirectories. If it is, it will return the path to +the root of the git repository, else it will return ~nil~. #+BEGIN_SRC emacs-lisp (defun phundrak/git-repo-root ($path) "Return `$path' if it points to a git repository or one of its @@ -1404,7 +1694,9 @@ This function detects if the path passed as an argument points to a git director :PROPERTIES: :CUSTOM_ID: User-Configuration-Custom-functions-macros-and-variables-phundrak-open-marked-files-b87d37f7 :END: -This function is particularly useful in Dired buffers when someone wants to open multiple files. This function will basically look for all marked files in the current dired buffer and open each one of them in their individual buffer. +This function is particularly useful in Dired buffers when someone wants to open +multiple files. This function will basically look for all marked files in the +current dired buffer and open each one of them in their individual buffer. #+BEGIN_SRC emacs-lisp (defun phundrak/open-marked-files () (interactive) @@ -1420,7 +1712,8 @@ This function is particularly useful in Dired buffers when someone wants to open :PROPERTIES: :CUSTOM_ID: User-Configuration-Custom-functions-macros-and-variables-phundrak-var-or-if-nil-40e2e54a :END: -This simple function helps me return either the value ~var~ holds, or if it is ~nil~ it will return the value ~value~ holds (or will return). +This simple function helps me return either the value ~var~ holds, or if it is +~nil~ it will return the value ~value~ holds (or will return). #+BEGIN_SRC emacs-lisp (defun phundrak/var-or-if-nil ($var $value) "Return the result yield by `$value' if `$var' is `nil', return @@ -1434,7 +1727,11 @@ This simple function helps me return either the value ~var~ holds, or if it is ~ :PROPERTIES: :CUSTOM_ID: Custom-functions-yas-rust-new-assignments-4ad16bde :END: -The following function is a function that will allow me to easily create ~new~ functions for Rust structs. Inspired from [[https://github.com/jorgenschaefer/elpy][elpy]]’s ~elpy-snippet-init-assignments~ function, it will automatically write assignments to my new struct as I write new parameters in the ~new~ function. It also comes with a helper function that parses the arguments given to the ~new~ function. +The following function is a function that will allow me to easily create ~new~ +functions for Rust structs. Inspired from [[https://github.com/jorgenschaefer/elpy][elpy]]’s ~elpy-snippet-init-assignments~ +function, it will automatically write assignments to my new struct as I write +new parameters in the ~new~ function. It also comes with a helper function that +parses the arguments given to the ~new~ function. #+BEGIN_SRC emacs-lisp (defun phundrak//yas-snippet-split-rust-args ($arg-string) "Split a Rust argument string into ((name, default)...) tuples" @@ -1462,7 +1759,8 @@ The following function is a function that will allow me to easily create ~new~ f :PROPERTIES: :CUSTOM_ID: User-Configuration-Custom-functions-macros-and-variables-screenshot-svg-9e2e21d2 :END: -This function allows for taking SVG screenshots of Emacs from itself using Cairo. The function definition was taken [[https://github.com/caiohcs/my-emacs#screenshots][from here]]. +This function allows for taking SVG screenshots of Emacs from itself using +Cairo. The function definition was taken [[https://github.com/caiohcs/my-emacs#screenshots][from here]]. #+BEGIN_SRC emacs-lisp (defun screenshot-svg () "Save a screenshot of the current frame as an SVG image. @@ -1480,7 +1778,11 @@ This function allows for taking SVG screenshots of Emacs from itself using Cairo :PROPERTIES: :CUSTOM_ID: User-Configuration-Custom-functions-macros-and-variables-terminal-here-default-terminal-command-9baa3715 :END: -This function is actually an overwrite of the default one which apparently does not work on my machine. This function is called by ~terminal-here-launch~ and spawns an external terminal emulator in the directory emacs was in when the terminal was invoked. I simply point out to this function the name of my terminal emulator. Here is the code: +This function is actually an overwrite of the default one which apparently does +not work on my machine. This function is called by ~terminal-here-launch~ and +spawns an external terminal emulator in the directory emacs was in when the +terminal was invoked. I simply point out to this function the name of my +terminal emulator. Here is the code: #+BEGIN_SRC emacs-lisp (defun terminal-here-default-terminal-command (_dir) '("st")) @@ -1490,7 +1792,8 @@ This function is actually an overwrite of the default one which apparently does :PROPERTIES: :CUSTOM_ID: User-Configuration-Custom-functions-macros-and-variables-xah-dired-sort-28bde838 :END: -This function comes directly from Xah Lee’s website and allows the user to sort files in a dired buffer depending on four factors: +This function comes directly from Xah Lee’s website and allows the user to sort +files in a dired buffer depending on four factors: * File name * File size * Last modification date @@ -1516,7 +1819,9 @@ This function comes directly from Xah Lee’s website and allows the user to sor :PROPERTIES: :CUSTOM_ID: User-Configuration-Custom-functions-macros-and-variables-xah-open-in-external-app-2655f31c :END: -Here is another of Xah’s functions, this time to open a file externally to Emacs. For instance, I sometimes want to open a PDF in Zathura rather than in Emacs, or an HTML file in Firefox. With this function, it is now possible! +Here is another of Xah’s functions, this time to open a file externally to +Emacs. For instance, I sometimes want to open a PDF in Zathura rather than in +Emacs, or an HTML file in Firefox. With this function, it is now possible! #+BEGIN_SRC emacs-lisp (defun xah/open-in-external-app (&optional files) "Open the current file or dired marked file in external app. @@ -1550,17 +1855,22 @@ Here is another of Xah’s functions, this time to open a file externally to Ema :PROPERTIES: :CUSTOM_ID: User_Configuration-Dired-ef8a7cac :END: -When it comes to dired, I chose do modify some elements on how things are sorted and shown, but there isn’t much configuration. First, I want to always copy folders in a recursive way, no questions asked. +When it comes to dired, I chose do modify some elements on how things are sorted +and shown, but there isn’t much configuration. First, I want to always copy +folders in a recursive way, no questions asked. #+BEGIN_SRC emacs-lisp (setq dired-recursive-copies 'always) #+END_SRC -Also, when I have two Dired buffers opened side by side, I generally want them to interact with each other, for example if I want to move around or copy stuff. So, let’s tell Emacs that: +Also, when I have two Dired buffers opened side by side, I generally want them +to interact with each other, for example if I want to move around or copy stuff. +So, let’s tell Emacs that: #+BEGIN_SRC emacs-lisp (setq dired-dwim-target t) #+END_SRC -Finally, let’s tell Dired how to sort the elements to be displayed: directories first, non-hidden first. +Finally, let’s tell Dired how to sort the elements to be displayed: directories +first, non-hidden first. #+BEGIN_SRC emacs-lisp (setq dired-listing-switches "-ahl --group-directories-first") #+END_SRC @@ -1570,7 +1880,8 @@ By the way, let’s enable ~org-download~ when we are in a Dired buffer: (add-hook 'dired-mode-hook 'org-download-enable) #+END_SRC -Finally, let’s enable globally ~diredfl~ so we can get a colourful Dired buffer each time we open one: +Finally, let’s enable globally ~diredfl~ so we can get a colourful Dired buffer +each time we open one: #+BEGIN_SRC emacs-lisp (diredfl-global-mode 1) #+END_SRC @@ -1579,9 +1890,11 @@ Finally, let’s enable globally ~diredfl~ so we can get a colourful Dired buffe :PROPERTIES: :CUSTOM_ID: User_Configuration-Eshell-3012e67e :END: -Eshell is a built-in shell available from Emacs which I use almost as often as Fish. Some adjustments are necessary for making this shell usable for me. +Eshell is a built-in shell available from Emacs which I use almost as often as +Fish. Some adjustments are necessary for making this shell usable for me. -But first, here is a screenshot of what to expect visually from my configuration of Eshell when it is launched: +But first, here is a screenshot of what to expect visually from my configuration +of Eshell when it is launched: #+include: ./img/eshell.svg export html @@ -1589,23 +1902,28 @@ But first, here is a screenshot of what to expect visually from my configuration :PROPERTIES: :CUSTOM_ID: User_Configuration-Eshell-Aliases-ef06615f :END: -This function is a function that will come in very handy for Eshell functions that call shell processes. It concatenates the initial string ~command~ with all the arguments ~args~, each separated with a space. +This function is a function that will come in very handy for Eshell functions +that call shell processes. It concatenates the initial string ~command~ with all +the arguments ~args~, each separated with a space. #+BEGIN_SRC emacs-lisp (defun phundrak/concatenate-shell-command ($command &rest $args) (string-join (cons $command $args) " ")) #+END_SRC -Just like most shells, it is possible to declare in Eshell aliases. First, I would like to be able to use ~open~ to open files in Emacs: +Just like most shells, it is possible to declare in Eshell aliases. First, I +would like to be able to use ~open~ to open files in Emacs: #+BEGIN_SRC emacs-lisp (defalias 'open 'find-file) #+END_SRC -I also have ~openo~ which allows me to perform the same action, but in another window: +I also have ~openo~ which allows me to perform the same action, but in another +window: #+BEGIN_SRC emacs-lisp (defalias 'openo 'find-file-other-window) #+END_SRC -The function ~yes-or-no-p~ is also aliased to ~y-or-n-p~ so I only have to answer by ~y~ or ~n~ instead of typing ~yes~ or ~no~. +The function ~yes-or-no-p~ is also aliased to ~y-or-n-p~ so I only have to +answer by ~y~ or ~n~ instead of typing ~yes~ or ~no~. #+BEGIN_SRC emacs-lisp (defalias 'yes-or-no-p 'y-or-n-p) #+END_SRC @@ -1615,7 +1933,8 @@ For some ease of use, I’ll also declare ~list-buffers~ as an alias of ~ibuffer (defalias 'list-buffers 'ibuffer) #+END_SRC -~mkcd~ is a function that allows me to create a directory and ~cd~ into it at the same time. +~mkcd~ is a function that allows me to create a directory and ~cd~ into it at +the same time. #+begin_src emacs-lisp (defun eshell/mkcd ($directory) (eshell/mkdir "-p" $directory) @@ -1626,7 +1945,9 @@ For some ease of use, I’ll also declare ~list-buffers~ as an alias of ~ibuffer :PROPERTIES: :CUSTOM_ID: User_Configuration-Eshell-Custom_functions-79d98245 :END: -When I’m in Eshell, sometimes I wish to open multiple files at once in Emacs. For this, when I have several arguments for ~find-file~, I want to be able to open them all at once. Let’s modify ~find-file~ like so: +When I’m in Eshell, sometimes I wish to open multiple files at once in Emacs. +For this, when I have several arguments for ~find-file~, I want to be able to +open them all at once. Let’s modify ~find-file~ like so: #+BEGIN_SRC emacs-lisp (defadvice find-file (around find-files activate) "Also find all files within a list of files. This even works recursively." @@ -1635,7 +1956,8 @@ When I’m in Eshell, sometimes I wish to open multiple files at once in Emacs. ad-do-it)) #+END_SRC -I also want to be able to have multiple instances of Eshell opened at once. For that, I declared the function ~eshell-new~ that does exactly that. +I also want to be able to have multiple instances of Eshell opened at once. For +that, I declared the function ~eshell-new~ that does exactly that. #+BEGIN_SRC emacs-lisp (defun eshell-new() "Open a new instance of eshell." @@ -1647,7 +1969,10 @@ I also want to be able to have multiple instances of Eshell opened at once. For :PROPERTIES: :CUSTOM_ID: User_Configuration-Eshell-Custom_functions-Redirect_text_editors_to_Emacs-dff362c6 :END: -I still have some stupid muscle memory telling me to open ~emacs~ in the terminal, which is stupid with Eshell since I’m already inside Emacs. So, let’s open each file passed to the ~emacs~ command and bury the eshell buffer (we’ll get back to it later). +I still have some stupid muscle memory telling me to open ~emacs~ in the +terminal, which is stupid with Eshell since I’m already inside Emacs. So, let’s +open each file passed to the ~emacs~ command and bury the eshell buffer (we’ll +get back to it later). #+BEGIN_SRC emacs-lisp (defun eshell/emacs (&rest $files) "Open a file in a new buffer. Old habits die hard" @@ -1662,7 +1987,9 @@ I still have some stupid muscle memory telling me to open ~emacs~ in the termina :PROPERTIES: :CUSTOM_ID: User_Configuration-Eshell-Environment_variables-8dac73e0 :END: -Some environment variables need to be correctly set so Eshell can correctly work. The first environment variable to be set is the ~PATH~, as I have a couple of directories where executables are located. Let’s add them to our path. +Some environment variables need to be correctly set so Eshell can correctly +work. The first environment variable to be set is the ~PATH~, as I have a couple +of directories where executables are located. Let’s add them to our path. #+BEGIN_SRC emacs-lisp (setenv "PATH" (concat @@ -1674,7 +2001,8 @@ Some environment variables need to be correctly set so Eshell can correctly work ":" (getenv "PATH"))) #+END_SRC -I would also like to set two environment variables related to Dart development: the ~DART_SDK~ and ~ANDROID_HOME~ variables. +I would also like to set two environment variables related to Dart development: +the ~DART_SDK~ and ~ANDROID_HOME~ variables. #+BEGIN_SRC emacs-lisp (setenv "DART_SDK" "/opt/dart-sdk/bin") (setenv "ANDROID_HOME" (concat (getenv "HOME") "/Android/Sdk/")) @@ -1687,7 +2015,8 @@ Finally, I’d like to add a custom directory to the ~PKG_CONFIG_PATH~: (getenv "PKG_CONFIG_PATH"))) #+END_SRC -The ~EDITOR~ variable also needs to be set for git commands, especially the ~yadm~ commands. +The ~EDITOR~ variable also needs to be set for git commands, especially the +~yadm~ commands. #+BEGIN_SRC emacs-lisp (setenv "EDITOR" "emacsclient -c") #+END_SRC @@ -1696,29 +2025,40 @@ The ~EDITOR~ variable also needs to be set for git commands, especially the ~yad :PROPERTIES: :CUSTOM_ID: User-Configuration-Emacs-builtins-Eshell-Eshell-banner-12d63d67 :END: -The code creating the Eshell banner is a bit lengthy and requires some additional explanations that would make the following chapter [[#User_Configuration-Eshell-Eshell_theme-a06715a9][Eshell theme]] too long. So, here it is! +The code creating the Eshell banner is a bit lengthy and requires some +additional explanations that would make the following chapter [[#User_Configuration-Eshell-Eshell_theme-a06715a9][Eshell theme]] too +long. So, here it is! -The banner for Eshell will collect some system information and display them gracefully. These pieces of information are: +The banner for Eshell will collect some system information and display them +gracefully. These pieces of information are: - The GNU/Linux distribution running (I do not use any other OS on my computer) - The kernel name and its version - The machine’s hostname - Its uptime - Its RAM and Swap usage - How full are its mountpoints -Some of these information can be grabbed directly from Emacs built-in functions, but some others need to be retrieved manually. Let’s first get into it with the mounted partitions for which we’ll define a structure: +Some of these information can be grabbed directly from Emacs built-in functions, +but some others need to be retrieved manually. Let’s first get into it with the +mounted partitions for which we’ll define a structure: #+BEGIN_SRC emacs-lisp (cl-defstruct phundrak/mounted-partitions "Object representing a mounted partition found in the system" path size used percent) #+END_SRC -We’ll also define a variable setting the maximum length of a partition path before it gets abbreviated: +We’ll also define a variable setting the maximum length of a partition path +before it gets abbreviated: #+BEGIN_SRC emacs-lisp (defvar phundrak//eshell-banner--max-length-part 13 "Maximum length of a partition path") #+END_SRC -Now, we can get our partitions. For this, we’ll make a call to the shell command ~df -lH~ and we’ll keep only the partitions mounted on a device stored in ~/dev~, for instance on ~/dev/sda~. And as mentioned above, if the mount path of the partition exceeds the length specified by ~phundrak//eshell-banner--max-length-part~, it will get abbreviated by [[#User-Configuration-Custom-functions-macros-and-variables-phundrak-abbr-path-559b46e3][~phundrak/abbr-path~]]. +Now, we can get our partitions. For this, we’ll make a call to the shell command +~df -lH~ and we’ll keep only the partitions mounted on a device stored in +~/dev~, for instance on ~/dev/sda~. And as mentioned above, if the mount path of +the partition exceeds the length specified by +~phundrak//eshell-banner--max-length-part~, it will get abbreviated by +[[#User-Configuration-Custom-functions-macros-and-variables-phundrak-abbr-path-559b46e3][~phundrak/abbr-path~]]. #+BEGIN_SRC emacs-lisp (defun phundrak/get-mounted-partitions () (let ((partitions (s-split "\n" @@ -1742,7 +2082,10 @@ Now, we can get our partitions. For this, we’ll make a call to the shell comma partitions))) #+END_SRC -We’ll need some padding for the name of the information displayed on the left hand side of the banner. The maximum length without any partitions is eight characters due to the text ~Hostname~, so if any partition path is longer than this, the left padding will increase. +We’ll need some padding for the name of the information displayed on the left +hand side of the banner. The maximum length without any partitions is eight +characters due to the text ~Hostname~, so if any partition path is longer than +this, the left padding will increase. #+BEGIN_SRC emacs-lisp (defun phundrak//eshell-banner--get-left-pad (initial-pad partitions) (if partitions @@ -1754,7 +2097,14 @@ We’ll need some padding for the name of the information displayed on the left initial-pad)) #+END_SRC -Now, Let’s set three variables that will be used in the function following this declaration. They will be used to determine in which color a percentage should be displayed. I’ll consider any percentage below 60% to be acceptable and therefore displayed in green. However, starting from this threshold, I want the user to be noticed of the usage of whatever percentage shown that it has gone up and it should be watched and displayed in yellow. Above 75%, the user should consider this a warning, and the percentage will be displayed in orange. Above 90%, it is considered critical and the percentage will be displayed in red. +Now, Let’s set three variables that will be used in the function following this +declaration. They will be used to determine in which color a percentage should +be displayed. I’ll consider any percentage below 60% to be acceptable and +therefore displayed in green. However, starting from this threshold, I want the +user to be noticed of the usage of whatever percentage shown that it has gone up +and it should be watched and displayed in yellow. Above 75%, the user should +consider this a warning, and the percentage will be displayed in orange. Above +90%, it is considered critical and the percentage will be displayed in red. #+BEGIN_SRC emacs-lisp (defvar phundrak//eshell-banner--critical-percentage 90) (defvar phundrak//eshell-banner--warning-percentage 75) @@ -1772,7 +2122,11 @@ Now, Let’s set three variables that will be used in the function following thi (with-face (format "%2d" percentage) :foreground phundrak/nord14)))) #+END_SRC -This function will be used when displaying progress bars. These will be used for displaying the Ram, Swap and partitions usage of the system, displaying the used part in red and the free part in green. For this, we just need to know the size of the progress bar we wish to use as well as how full it should be. Note that the percentage should be between 0 and 100. +This function will be used when displaying progress bars. These will be used for +displaying the Ram, Swap and partitions usage of the system, displaying the used +part in red and the free part in green. For this, we just need to know the size +of the progress bar we wish to use as well as how full it should be. Note that +the percentage should be between 0 and 100. #+BEGIN_SRC emacs-lisp (defun phundrak//eshell-banner--progress-bar (length percentage) (let* ((length-green (if (= 0 percentage) @@ -1787,7 +2141,10 @@ This function will be used when displaying progress bars. These will be used for (with-face "]" :weight 'bold)))) #+END_SRC -This function will be used in two distinct functions: ~phundrak/eshell-banner~ which we will see later, and ~phundrak//eshell-banner--display-memory~ which we will see now. This function displays information for the two types of memory we have, RAM and Swap memory. Here is the definition of this function: +This function will be used in two distinct functions: ~phundrak/eshell-banner~ +which we will see later, and ~phundrak//eshell-banner--display-memory~ which we +will see now. This function displays information for the two types of memory we +have, RAM and Swap memory. Here is the definition of this function: #+BEGIN_SRC emacs-lisp (defun phundrak//eshell-banner--display-memory (type used total text-padding ramp-length) (let ((percentage (if (= used 0) @@ -1805,7 +2162,8 @@ This function will be used in two distinct functions: ~phundrak/eshell-banner~ w "%)\n"))) #+END_SRC -We now need a function for displaying partitions. As you can see, it will be quite similar to the above one: +We now need a function for displaying partitions. As you can see, it will be +quite similar to the above one: #+BEGIN_SRC emacs-lisp (defun phundrak//eshell-banner--display-partition (part left-pad ramp-length) (concat (s-pad-right left-pad "." @@ -1877,7 +2235,10 @@ And we can now build our banner! Here is our function that does exactly that: (format "\n%s\n" (s-repeat 79 "="))))) #+END_SRC -We now only have to set the result of this function as our Eshell banner. Since a simple ~setq~ would only run ~phundrak/eshell-banner~ once when Emacs starts, we’ll actually make Emacs set the value of ~eshell-banner-message~ each time it is required by Eshell with a hook: +We now only have to set the result of this function as our Eshell banner. Since +a simple ~setq~ would only run ~phundrak/eshell-banner~ once when Emacs starts, +we’ll actually make Emacs set the value of ~eshell-banner-message~ each time it +is required by Eshell with a hook: #+BEGIN_SRC emacs-lisp (add-hook 'eshell-banner-load-hook (lambda () @@ -1888,7 +2249,13 @@ We now only have to set the result of this function as our Eshell banner. Since :PROPERTIES: :CUSTOM_ID: User_Configuration-Eshell-Eshell_theme-a06715a9 :END: -As with most shells, again, it is possible to customize the appearance of the Eshell prompt. As you can see, my prompt has some Nord colors, a shortened path, a git prompt, and an indicator of whether the previous command succeeded or failed. Note however that the abbreviation of the current path depends on the value of ~phundrak/prompt--abbreviate~, if it is ~t~ it is abbreviated; otherwise, it is kept in full. It can be toggled with a keyboard shortcut, see [[#User_Configuration-Shortcuts-Toggle-d53c27ef][Keybindings: Toggle]]. +As with most shells, again, it is possible to customize the appearance of the +Eshell prompt. As you can see, my prompt has some Nord colors, a shortened path, +a git prompt, and an indicator of whether the previous command succeeded or +failed. Note however that the abbreviation of the current path depends on the +value of ~phundrak/prompt--abbreviate~, if it is ~t~ it is abbreviated; +otherwise, it is kept in full. It can be toggled with a keyboard shortcut, see +[[#User_Configuration-Shortcuts-Toggle-d53c27ef][Keybindings: Toggle]]. #+BEGIN_SRC emacs-lisp (defun phundrak/eshell-prompt () "Definition of my prompt for Eshell @@ -1946,7 +2313,8 @@ Now, let’s declare our prompt regexp and our prompt functions: eshell-prompt-function 'phundrak/eshell-prompt) #+END_SRC -I also don't want the banner to be displayed, I know I entered the Elisp shell, no need to remind me. Maybe I’ll do something with it one day. +I also don't want the banner to be displayed, I know I entered the Elisp shell, +no need to remind me. Maybe I’ll do something with it one day. #+BEGIN_SRC emacs-lisp (setq eshell-banner-message "") #+END_SRC @@ -1960,7 +2328,8 @@ Finally, let’s enable some fish-like syntax highlighting: :PROPERTIES: :CUSTOM_ID: User_Configuration-Eshell-Visual_commands-2b15e0dc :END: -With Eshell, some commands don’t work very well, especially commands that create a TUI. So, let’s declare them as visual commands or subcommands: +With Eshell, some commands don’t work very well, especially commands that create +a TUI. So, let’s declare them as visual commands or subcommands: #+BEGIN_SRC emacs-lisp (setq eshell-visual-commands '("fish" "zsh" "bash" "tmux" "htop" "top" "vim" "bat" "nano") @@ -1973,7 +2342,10 @@ With Eshell, some commands don’t work very well, especially commands that crea :CUSTOM_ID: User_Configuration-Org-mode-04ab8ad3 :header-args:emacs-lisp: :tangle no :exports code :results silent :END: -Org-mode is probably one of the best if not the best Emacs feature I have ever discovered. It is awesome for writing documents, regardless of the format you need it to be exported to, for agenda management, and for literary programming, such as with this document. +Org-mode is probably one of the best if not the best Emacs feature I have ever +discovered. It is awesome for writing documents, regardless of the format you +need it to be exported to, for agenda management, and for literary programming, +such as with this document. #+BEGIN_SRC emacs-lisp (with-eval-after-load 'org ;; configuration goes here @@ -2039,13 +2411,15 @@ Org-mode is probably one of the best if not the best Emacs feature I have ever d :PROPERTIES: :CUSTOM_ID: User_Configuration-Org-mode-Org_agenda-53f9d319 :END: -One awesome feature of Org mode is the agenda. By default, my agendas are stored in =~/org/agenda=. +One awesome feature of Org mode is the agenda. By default, my agendas are stored +in =~/org/agenda=. #+NAME: org-agenda-files #+BEGIN_SRC emacs-lisp (setq org-agenda-files (list "~/org/agenda" "~/org/notes.org")) #+END_SRC -I also have a custom command in Org agenda to mark some tasks as daily tasks with the =:DAILY:= tag,: +I also have a custom command in Org agenda to mark some tasks as daily tasks +with the =:DAILY:= tag,: #+NAME: org-agenda-custom-commands #+BEGIN_SRC emacs-lisp (setq org-agenda-custom-commands @@ -2070,7 +2444,10 @@ I also have a custom command in Org agenda to mark some tasks as daily tasks wit :PROPERTIES: :CUSTOM_ID: User_Configuration-Org-mode-Org_babel_languages-c062fc16 :END: -One of the amazing features of org-mode is its literary programming capacities by running code blocks from within Org-mode itself. But for that, only a couple of languages are supported directly by Org-mode itself, and they need to be activated. Here are the languages I activated in my Org-mode configuration: +One of the amazing features of org-mode is its literary programming capacities +by running code blocks from within Org-mode itself. But for that, only a couple +of languages are supported directly by Org-mode itself, and they need to be +activated. Here are the languages I activated in my Org-mode configuration: #+NAME: org-babel-languages-table | C | | dot | @@ -2128,13 +2505,16 @@ Scheme requires a default implementation for geiser: (setq geiser-default-implementation 'racket) #+END_SRC -By the way, I wish to see source code behave the same way in the source blocks as in their own major mode. Let’s tell Emacs so: +By the way, I wish to see source code behave the same way in the source blocks +as in their own major mode. Let’s tell Emacs so: #+NAME: org-src-tab-acts-natively #+BEGIN_SRC emacs-lisp (setq org-src-tab-acts-natively t) #+END_SRC -Lastly, I know this can be a terrible idea, but I want Emacs to just evaluate Org code blocks without asking me. Of course, this could represent some big security issue if not careful enough, but I generaly just open my own org files. +Lastly, I know this can be a terrible idea, but I want Emacs to just evaluate +Org code blocks without asking me. Of course, this could represent some big +security issue if not careful enough, but I generaly just open my own org files. #+NAME: org-confirm-babel #+BEGIN_SRC emacs-lisp (setq org-confirm-babel-evaluate nil) @@ -2144,13 +2524,18 @@ Lastly, I know this can be a terrible idea, but I want Emacs to just evaluate Or :PROPERTIES: :CUSTOM_ID: Beautify-Org-mode-0506af2f :END: -As I will always say, orgmode is an amazing piece of software that deserves particular care and love. That is why I want to give it a unique look and feel compared to the rest of my Emacs configuration, in order to make it feel much more comfortable. You will find below how my org buffers look like when I open one of them. +As I will always say, orgmode is an amazing piece of software that deserves +particular care and love. That is why I want to give it a unique look and feel +compared to the rest of my Emacs configuration, in order to make it feel much +more comfortable. You will find below how my org buffers look like when I open +one of them. #+begin_export html

Screenshot of an org-mode buffer

#+end_export -And here you can find the source code of this buffer you just saw a screenshot of: +And here you can find the source code of this buffer you just saw a screenshot +of: #+BEGIN_SRC org :exports code ,#+TITLE: My Document ,#+AUTHOR: Lucien Cartier-Tilet @@ -2190,7 +2575,10 @@ And here you can find the source code of this buffer you just saw a screenshot o ,******** Header 8 #+END_SRC -In order to make org-mode even sexier, let’s enable ~variable-pitch-mode~ for org-mode so we can get some proportional font. I’ll also remove ~auto-fill-mode~ which seems to stick to Orgmode like hell and I don’t know why. A hook to org-appear’s minor mode will also be added. +In order to make org-mode even sexier, let’s enable ~variable-pitch-mode~ for +org-mode so we can get some proportional font. I’ll also remove ~auto-fill-mode~ +which seems to stick to Orgmode like hell and I don’t know why. A hook to +org-appear’s minor mode will also be added. #+NAME: beautiful-org-hooks #+BEGIN_SRC emacs-lisp (add-hook 'org-mode-hook 'visual-line-mode) @@ -2202,7 +2590,8 @@ In order to make org-mode even sexier, let’s enable ~variable-pitch-mode~ for You can then see the modified faces for org-mode [[#User-Configuration-Visual-configuration-Better-faces-Org-mode-07754177][here]]. -Some other tweaks will make Org-mode more beautiful. This includes a new folding icon, some indentation that is not added whitespace. +Some other tweaks will make Org-mode more beautiful. This includes a new folding +icon, some indentation that is not added whitespace. #+NAME: beautiful-org-options #+BEGIN_SRC emacs-lisp (setq org-startup-indented t @@ -2217,7 +2606,8 @@ Some other tweaks will make Org-mode more beautiful. This includes a new folding org-ellipsis "  ") #+END_SRC -Let’s limit the width of images inlined in org buffers to 550px. It roughly corresponds to the width of a paragraph on which ~org-fill-paragraph~ is called. +Let’s limit the width of images inlined in org buffers to 550px. It roughly +corresponds to the width of a paragraph on which ~org-fill-paragraph~ is called. #+NAME: beautiful-org-images #+BEGIN_SRC emacs-lisp (setq org-image-actual-width 550) @@ -2244,7 +2634,8 @@ I also have an issue where small dots precede my org headers. Let’s fix that: :PROPERTIES: :CUSTOM_ID: User_Configuration-Org-mode-Org_variables-Org_behavior-0319db38 :END: -Something really neat I learned about is the ability of org headers to inherit properties from parent headers. Let’s enable that! +Something really neat I learned about is the ability of org headers to inherit +properties from parent headers. Let’s enable that! #+NAME: org-use-property-inheritance #+BEGIN_SRC emacs-lisp (setq org-use-property-inheritance t) @@ -2256,7 +2647,9 @@ Sometimes, I also want to have alphabetical lists in org-mode: (setq org-list-allow-alphabetical t) #+END_SRC -LSP can work in source blocks, but some work is needed (shamelessly stolen [[https://tecosaur.github.io/emacs-config/config.html#lsp-support-src][from here]], though modified a tiny bit). Here are the languages I want to activate LSP for in this environment: +LSP can work in source blocks, but some work is needed (shamelessly stolen [[https://tecosaur.github.io/emacs-config/config.html#lsp-support-src][from +here]], though modified a tiny bit). Here are the languages I want to activate LSP +for in this environment: #+NAME: org-lsp-languages-src-blocks-table | c | | c++ | @@ -2310,19 +2703,30 @@ And here is the code to activate that: (eval `(lsp-org-babel-enable ,lang))) #+END_SRC -Here is one behavior that I really want to see modified: the ability to use ~M-RET~ without slicing the text the marker is on. +Here is one behavior that I really want to see modified: the ability to use +~M-RET~ without slicing the text the marker is on. #+NAME: org-M-RET-may-split-line #+BEGIN_SRC emacs-lisp (setq org-M-RET-may-split-line nil) #+END_SRC -Since Org 9.3, Org no longer attempts to restore the window configuration in the frame to which the user returns after editing a source block with ~org-edit-src-code~. This means with the original value of ~org-src-window-setup~ (~reorganize-frame~), the current frame will be split in two between the original org window and the source window, and once we quit the source window only the org window will remain. This is not a desired behavior for me, so I chose to set this variable to ~split-window-right~ in order to keep my windows organization and have a similar behavior to the old one. +Since Org 9.3, Org no longer attempts to restore the window configuration in the +frame to which the user returns after editing a source block with +~org-edit-src-code~. This means with the original value of +~org-src-window-setup~ (~reorganize-frame~), the current frame will be split in +two between the original org window and the source window, and once we quit the +source window only the org window will remain. This is not a desired behavior +for me, so I chose to set this variable to ~split-window-right~ in order to keep +my windows organization and have a similar behavior to the old one. #+NAME: org-src-window-setup #+BEGIN_SRC emacs-lisp (setq org-src-window-setup 'split-window-below) #+END_SRC -However, it is not rare that I want to change that for an horizontal split, which can be achieved with the value ~split-window-below~. Thus, I have made this function that allows me to switch between the (default) vertical split and the horizontal split. +However, it is not rare that I want to change that for an horizontal split, +which can be achieved with the value ~split-window-below~. Thus, I have made +this function that allows me to switch between the (default) vertical split and +the horizontal split. #+NAME: org-src-window-toggle #+BEGIN_SRC emacs-lisp (defun phundrak/toggle-org-src-window-split () @@ -2341,18 +2745,23 @@ However, it is not rare that I want to change that for an horizontal split, whic "horizontally"))) #+END_SRC -When creating a link to an Org flie, I want to create an ID only if the link is created interactively, and only if there is no custom ID already created. +When creating a link to an Org flie, I want to create an ID only if the link is +created interactively, and only if there is no custom ID already created. #+NAME: org-id-link-to-org #+BEGIN_SRC emacs-lisp (setq org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id) #+END_SRC -The tag ~:noexport:~ is fine and all, but it doesn’t allow for hidden org structures, that is headers that are visible in the org buffer but once the file is exported to another format the header disappears but its content stays. ~ox-extra~ has such a feature through ~ignore-headlines~. +The tag ~:noexport:~ is fine and all, but it doesn’t allow for hidden org +structures, that is headers that are visible in the org buffer but once the file +is exported to another format the header disappears but its content stays. +~ox-extra~ has such a feature through ~ignore-headlines~. #+BEGIN_SRC emacs-lisp (require 'ox-extra) (ox-extras-activate '(ignore-headlines)) #+END_SRC -This gives us access to the ~:ignore:~ tag which allows the behavior above mentioned. To give you an idea, the org buffer +This gives us access to the ~:ignore:~ tag which allows the behavior above +mentioned. To give you an idea, the org buffer #+BEGIN_SRC org ,* Headline 1 Blah @@ -2384,7 +2793,9 @@ Will be exported as if it were the buffer :CUSTOM_ID: User_Configuration-Org-mode-Org_capture-f58979cf :header-args:org: :mkdirp yes :END: -Org-capture is an amazing feature of Org-mode which allows me to quickly save links, resources, reminders, and notes in neatly organized org files. Here they are described: +Org-capture is an amazing feature of Org-mode which allows me to quickly save +links, resources, reminders, and notes in neatly organized org files. Here they +are described: #+NAME: org-capture-target-files #+BEGIN_SRC emacs-lisp (defvar org-conlanging-file "~/org/conlanging.org") @@ -2397,7 +2808,15 @@ Org-capture is an amazing feature of Org-mode which allows me to quickly save li (defvar org-wordbuilding-file "~/org/worldbuilding.org") #+END_SRC -With Spacemacs, an Org capture can be invoked with the shortcut ~SPC a o c~. It will then ask which template I wish to use. In the table below are described the shortcuts that are available after ~SPC a o c~ is invoked. The /name/ will be the one displayed in Org capture’s interface, the /title/ is the headline where to save the capture (if it does not differ from the capture’s name, the cell will be blank). The /insertion mode/ tells Emacs how to add the capture to the /file/, using which /template/. A line with no insertion mode, file, or template is just a category. All of the following insert entries to their org files, that is a new org node with a headline and some content. +With Spacemacs, an Org capture can be invoked with the shortcut ~SPC a o c~. It +will then ask which template I wish to use. In the table below are described the +shortcuts that are available after ~SPC a o c~ is invoked. The /name/ will be +the one displayed in Org capture’s interface, the /title/ is the headline where +to save the capture (if it does not differ from the capture’s name, the cell +will be blank). The /insertion mode/ tells Emacs how to add the capture to the +/file/, using which /template/. A line with no insertion mode, file, or template +is just a category. All of the following insert entries to their org files, that +is a new org node with a headline and some content. #+NAME: org-capture-shortcuts-table | Shortcut | Name | Title | Insertion mode | file | template | |----------+---------------+-----------+----------------+-------------------------+--------------------------| @@ -2430,7 +2849,9 @@ With Spacemacs, an Org capture can be invoked with the shortcut ~SPC a o c~. It | th | Health | | file+headline | org-private-agenda-file | health.orgcaptmpl | | ti | Informatique | | file+headline | org-private-agenda-file | informatique.orgcaptmpl | -The following code snipped is not tangled into my configuration file, but instead creates the equivalent to the table above into EmacsLisp code found in the next code snippet. +The following code snipped is not tangled into my configuration file, but +instead creates the equivalent to the table above into EmacsLisp code found in +the next code snippet. #+NAME: org-capture-shortcut-gen #+header: :exports code :cache yes :results replace #+BEGIN_SRC emacs-lisp :var table=org-capture-shortcuts-table @@ -2536,9 +2957,17 @@ Below you can find the equivalent code as described above. <>) #+END_SRC -You may notice a capture entry for my journal, and this is due to the fact I do not use ~org-journal~ anymore: it was too overpowered for me, and I prefer to keep it simple with a single file. And as you can see, and unlike a lot of other Emacs configurations, the content of the template is not set in the variable, but in external files which can be modified freely as actual Org buffers instead of trying to get a proper one with loads of ~\n~ characters and such. All these templates are declared below. +You may notice a capture entry for my journal, and this is due to the fact I do +not use ~org-journal~ anymore: it was too overpowered for me, and I prefer to +keep it simple with a single file. And as you can see, and unlike a lot of other +Emacs configurations, the content of the template is not set in the variable, +but in external files which can be modified freely as actual Org buffers instead +of trying to get a proper one with loads of ~\n~ characters and such. All these +templates are declared below. -In the next sub-sections will be described my org capture templates. These are not tangled into my Emacs configuration files, but into separate ~.orgcaptmpl~ files stored into =~/org/capture/=. +In the next sub-sections will be described my org capture templates. These are +not tangled into my Emacs configuration files, but into separate ~.orgcaptmpl~ +files stored into =~/org/capture/=. ***** Emails :PROPERTIES: @@ -2564,13 +2993,18 @@ This is my template for a new Email: Sent from a Free and Open-Source Linux operating system with GNU/Emacs #+END_SRC -I use it in case my computer is not yet connected to the internet and I need to already write the email so I can send it later. All I will need to to afterwards will be to copy and paste my capture in a new message buffer and send it once I am back online. This is exported to =~/org/capture/email.orgcaptmpl=. +I use it in case my computer is not yet connected to the internet and I need to +already write the email so I can send it later. All I will need to to afterwards +will be to copy and paste my capture in a new message buffer and send it once I +am back online. This is exported to =~/org/capture/email.orgcaptmpl=. ***** Journal :PROPERTIES: :CUSTOM_ID: User_Configuration-Org-mode-Org_capture-Journal-9916f9bf :END: -This template is quite simple: it creates a new entry with the current timestamp as its title, a brief title of my choosing, and then I can write whatever I wish to write. This is exported to =~/org/capture/journal.orgcaptmpl=. +This template is quite simple: it creates a new entry with the current timestamp +as its title, a brief title of my choosing, and then I can write whatever I wish +to write. This is exported to =~/org/capture/journal.orgcaptmpl=. #+BEGIN_SRC org :tangle ~/org/capture/journal.orgcaptmpl ,* %U %^{Title} %? @@ -2580,7 +3014,11 @@ This template is quite simple: it creates a new entry with the current timestamp :PROPERTIES: :CUSTOM_ID: User_Configuration-Org-mode-Org_capture-Notes-4b4c10aa :END: -This template is used for taking note about various subjects that can go from conlanging to development. I wrote it so I can know from where this capture was made and when, and it even supports text that was highlighted in Emacs that will be inserted in a quote block. This is exported to =~/org/capture/notes.orgcaptmpl=. +This template is used for taking note about various subjects that can go from +conlanging to development. I wrote it so I can know from where this capture was +made and when, and it even supports text that was highlighted in Emacs that will +be inserted in a quote block. This is exported to +=~/org/capture/notes.orgcaptmpl=. #+BEGIN_SRC org :tangle ~/org/capture/notes.orgcaptmpl ,* %^{Title} :PROPERTIES: @@ -2606,7 +3044,10 @@ This template is used for taking note about various subjects that can go from co :PROPERTIES: :CUSTOM_ID: User_Configuration-Org-mode-Org_capture-Protocol-ec45ec49 :END: -This capture is used when received through org-protocol, with the Org-protocol Extension for Firefox. It allows me to save in a quote block what I’ve highlighted, as well as the link of the webpage on which my saved content was highlighted. This file is exported to =~/org/capture/protocol.orgcaptmpl=. +This capture is used when received through org-protocol, with the Org-protocol +Extension for Firefox. It allows me to save in a quote block what I’ve +highlighted, as well as the link of the webpage on which my saved content was +highlighted. This file is exported to =~/org/capture/protocol.orgcaptmpl=. #+BEGIN_SRC org :tangle ~/org/capture/protocol.orgcaptmpl ,* TODO [#C] %^{Title} :PROPERTIES: @@ -2621,7 +3062,8 @@ This capture is used when received through org-protocol, with the Org-protocol E %? #+END_SRC -This next capture template is used only when a link is sent to Emacs and no content was highlighted. +This next capture template is used only when a link is sent to Emacs and no +content was highlighted. #+BEGIN_SRC org :tangle ~/org/capture/protocol-link.orgcaptmpl ,* TODO [#C] Link: %^{Title} :PROPERTIES: @@ -2636,7 +3078,13 @@ This next capture template is used only when a link is sent to Emacs and no cont :PROPERTIES: :CUSTOM_ID: User_Configuration-Org-mode-Org_capture-Resources-b23bfbd0 :END: -This is the default template for resources, which generally are located on the Internet. By default, I give them the lowest priority, because although this is something for me to remember later, it is not by default important. You can see in the properties I record when the capture happened, and what the link is. The title of the capture is a summary of what this is, while the body of the capture is a more detailed explanation of what I capture, why, and how it could be useful to me. +This is the default template for resources, which generally are located on the +Internet. By default, I give them the lowest priority, because although this is +something for me to remember later, it is not by default important. You can see +in the properties I record when the capture happened, and what the link is. The +title of the capture is a summary of what this is, while the body of the capture +is a more detailed explanation of what I capture, why, and how it could be +useful to me. #+BEGIN_SRC org :tangle ~/org/capture/resource.orgcaptmpl ,* TODO [#C] %^{Title} :PROPERTIES: @@ -2654,7 +3102,9 @@ This is the default template for resources, which generally are located on the I :PROPERTIES: :CUSTOM_ID: User_Configuration-Org-mode-Org_capture-Tasks-Computers_and_stuff-a4eef8e3 :END: -One type of task I often capture is related to my servers or thing about computers in general. With this, I can capture a task for which I will either set a schedule or a deadline. +One type of task I often capture is related to my servers or thing about +computers in general. With this, I can capture a task for which I will either +set a schedule or a deadline. #+BEGIN_SRC org :tangle ~/org/capture/informatique.orgcaptmpl ,* TODO %^{Title} %^{Scheduled or Deadline?||SCHEDULED||DEADLINE}: %^t @@ -2668,7 +3118,8 @@ One type of task I often capture is related to my servers or thing about compute :PROPERTIES: :CUSTOM_ID: User_Configuration-Org-mode-Org_capture-Tasks-Health-74f8f338 :END: -This capture is rarely used (I’m lucky to have a good health), but it can be useful. +This capture is rarely used (I’m lucky to have a good health), but it can be +useful. #+BEGIN_SRC org :tangle ~/org/capture/health.orgcaptmpl ,* %^{Title} SCHEDULED: %^t @@ -2680,7 +3131,8 @@ This capture is rarely used (I’m lucky to have a good health), but it can be u :PROPERTIES: :CUSTOM_ID: User_Configuration-Org-mode-Org_capture-Tasks-Birthdays-ec3b27be :END: -This capture is used to store new birthdays I have to remember. They are set to be repeated yearly. +This capture is used to store new birthdays I have to remember. They are set to +be repeated yearly. #+BEGIN_SRC org :tangle ~/org/capture/birthday.orgcaptmpl ,* %^{Name} SCHEDULED: %^t @@ -2737,7 +3189,10 @@ We begin with a couple of custom functions that I use in my org-mode files. :PROPERTIES: :CUSTOM_ID: User_Configuration-Org-mode-Custom_org-mode_functions-Custom_and_unique_headings_ID-44d2beaf :END: -The first ones are dedicated to provide org-mode headings a fixed and unique ID that won’t change over time. This code was taken from [[https://writequit.org/articles/emacs-org-mode-generate-ids.html][https://writequit.org/articles/emacs-org-mode-generate-ids.html]]. The first function’s job is to create these unique IDs +The first ones are dedicated to provide org-mode headings a fixed and unique ID +that won’t change over time. This code was taken from +[[https://writequit.org/articles/emacs-org-mode-generate-ids.html][https://writequit.org/articles/emacs-org-mode-generate-ids.html]]. The first +function’s job is to create these unique IDs #+NAME: org-better-id-new #+BEGIN_SRC emacs-lisp (defun eos/org-id-new (&optional prefix) @@ -2778,7 +3233,9 @@ The first ones are dedicated to provide org-mode headings a fixed and unique ID (concat prefix (car (split-string unique "-"))))) #+END_SRC -Now, let’s see the function that will be used to get the custom id of a heading at point. If the function does not detect any custom ID, then one should be created and inserted. +Now, let’s see the function that will be used to get the custom id of a heading +at point. If the function does not detect any custom ID, then one should be +created and inserted. #+NAME: org-better-id-get #+BEGIN_SRC emacs-lisp (defun eos/org-custom-id-get (&optional pom create prefix) @@ -2813,7 +3270,9 @@ Now, let’s see the function that will be used to get the custom id of a headin id))))) #+END_SRC -Finally, this is the function that gets called on file saves. If the function detects ~auto-id:t~ among the org options in the ~#+OPTIONS:~ header, then the above function is called. +Finally, this is the function that gets called on file saves. If the function +detects ~auto-id:t~ among the org options in the ~#+OPTIONS:~ header, then the +above function is called. #+NAME: org-better-id-add-ids #+BEGIN_SRC emacs-lisp (defun eos/org-add-ids-to-headlines-in-file () @@ -2830,7 +3289,8 @@ Finally, this is the function that gets called on file saves. If the function de (org-map-entries (lambda () (eos/org-custom-id-get (point) 'create)))))) #+END_SRC -Let’s add a hook to the above function so it is called automatically on save, and only in read-write functions. +Let’s add a hook to the above function so it is called automatically on save, +and only in read-write functions. #+NAME: org-better-id-hooks #+BEGIN_SRC emacs-lisp (add-hook 'org-mode-hook @@ -2846,7 +3306,11 @@ Let’s add a hook to the above function so it is called automatically on save, :PROPERTIES: :CUSTOM_ID: User_Configuration-Org-mode-Org_files_exports-1e194169 :END: -I want to disable by default behavior of ~^~ and ~_~ for only one character, making it compulsory to use instead ~^{}~ and ~_{}~ respectively. This is due to my frequent usage of the underscore in my org files as a regular character and not a markup one, especially when describing phonetics evolution. So, let’s disable it: +I want to disable by default behavior of ~^~ and ~_~ for only one character, +making it compulsory to use instead ~^{}~ and ~_{}~ respectively. This is due to +my frequent usage of the underscore in my org files as a regular character and +not a markup one, especially when describing phonetics evolution. So, let’s +disable it: #+NAME: org-use-sub-superscripts #+BEGIN_SRC emacs-lisp (setq org-use-sub-superscripts (quote {})) @@ -2856,19 +3320,25 @@ I want to disable by default behavior of ~^~ and ~_~ for only one character, mak :PROPERTIES: :CUSTOM_ID: User-Configuration-Emacs-builtins-Org-mode-File-export-LaTeX-92bbd6f3 :END: -When it comes to exports, I want the LaTeX and PDF exports to be done with XeLaTeX only. This implies the modification of the following variable: +When it comes to exports, I want the LaTeX and PDF exports to be done with +XeLaTeX only. This implies the modification of the following variable: #+NAME: org-latex-compiler #+BEGIN_SRC emacs-lisp (setq org-latex-compiler "xelatex") #+END_SRC -I also want to get by default ~minted~ for LaTeX listings so I can have syntax highlights: +I also want to get by default ~minted~ for LaTeX listings so I can have syntax +highlights: #+NAME: org-latex-listings #+BEGIN_SRC emacs-lisp (setq org-latex-listings 'minted) #+END_SRC -The default packages break my LaTeX exports: for some reasons, images are not loaded and exported in PDFs, so I needed to redifine the default packages excluding the one that broke my exports. I also added two default packages, ~minted~ and ~xeCJK~ for syntax highlighting and Japanese (and additionally Chinese and Korean) support. +The default packages break my LaTeX exports: for some reasons, images are not +loaded and exported in PDFs, so I needed to redifine the default packages +excluding the one that broke my exports. I also added two default packages, +~minted~ and ~xeCJK~ for syntax highlighting and Japanese (and additionally +Chinese and Korean) support. #+NAME: org-latex-default-packages #+BEGIN_SRC emacs-lisp (setq org-latex-default-packages-alist '(("" "graphicx" t) @@ -2892,7 +3362,9 @@ By the way, reference links in LaTeX should be written in this format: (setq org-export-latex-hyperref-format "\\ref{%s}") #+END_SRC -When it comes to the export itself, the latex file needs to be processed several times through XeLaTeX in order to get some references right. Don’t forget to also run bibtex! +When it comes to the export itself, the latex file needs to be processed several +times through XeLaTeX in order to get some references right. Don’t forget to +also run bibtex! #+NAME: org-latex-pdf-process #+BEGIN_SRC emacs-lisp (setq org-latex-pdf-process @@ -2912,7 +3384,8 @@ For Reveal.JS exports, I need to set where to find the framework by default: (setq org-re-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js") #+END_SRC -On HTML exports, Org-mode tries to include a validation link for the exported HTML. Let’s disable that since I never use it. +On HTML exports, Org-mode tries to include a validation link for the exported +HTML. Let’s disable that since I never use it. #+NAME: org-html-validation #+BEGIN_SRC emacs-lisp (setq org-html-validation-link nil) @@ -2922,7 +3395,9 @@ On HTML exports, Org-mode tries to include a validation link for the exported HT :PROPERTIES: :CUSTOM_ID: User_Configuration-Org-mode-Custom_LaTeX_formats-8e8dca1c :END: -I currently have two custom formats for my Org-mode exports: one for general use (initialy for my conlanging files, hence its ~conlang~ name), and one for beamer exports. +I currently have two custom formats for my Org-mode exports: one for general use +(initialy for my conlanging files, hence its ~conlang~ name), and one for beamer +exports. Below is the declaration of the ~conlang~ LaTeX class: #+NAME: org-latex-class-conlang @@ -2965,7 +3440,9 @@ Both these classes have to be added to ~org-latex-classes~ like so: :PROPERTIES: :CUSTOM_ID: User_Configuration-Org-mode-Org_projects-5be088cd :END: -Another great features of Org-mode is the Org projects that allow the user to easily publish a bunch of org files to a remote location. Here is the current declaration of my projects, which will be detailed later: +Another great features of Org-mode is the Org projects that allow the user to +easily publish a bunch of org files to a remote location. Here is the current +declaration of my projects, which will be detailed later: #+NAME: org-publish-projects #+BEGIN_SRC emacs-lisp :noweb yes <> @@ -2985,9 +3462,15 @@ Another great features of Org-mode is the Org projects that allow the user to ea :PROPERTIES: :CUSTOM_ID: User_Configuration-Org-mode-Org_projects-Configuration_website-79bd0468 :END: -This is my configuration for exporting my dotfiles to my website in a web format only. No PDFs or anything, just HTML. Please note that I do not use that often anymore, I much prefer the automatic script that I have which deploys through my Drone instance my website on git pushes. +This is my configuration for exporting my dotfiles to my website in a web format +only. No PDFs or anything, just HTML. Please note that I do not use that often +anymore, I much prefer the automatic script that I have which deploys through my +Drone instance my website on git pushes. -And before we get into the actual configuration, I would like to introduce a couple of variables. This is a bit more verbose than if I declared everything manually, but now I can change all three values at the same time without a hasle. +And before we get into the actual configuration, I would like to introduce a +couple of variables. This is a bit more verbose than if I declared everything +manually, but now I can change all three values at the same time without a +hasle. #+NAME: org-proj-config-setup #+BEGIN_SRC emacs-lisp (defvar phundrak//projects-config-target @@ -3004,7 +3487,11 @@ And before we get into the actual configuration, I would like to introduce a cou "Defines whether subdirectories should be parsed for config.phundrak.com") #+END_SRC -Now, here is my configuration. In this snippet, my org files located in my source directory get exported in the HTML format and published to my target directory on my remote server through RSYNC via TRAMP. A sitemap is automatically generated, which comes in handy with the online sitemap that is available through the navigation bar. +Now, here is my configuration. In this snippet, my org files located in my +source directory get exported in the HTML format and published to my target +directory on my remote server through RSYNC via TRAMP. A sitemap is +automatically generated, which comes in handy with the online sitemap that is +available through the navigation bar. #+NAME: org-proj-config-html #+BEGIN_SRC emacs-lisp ("config-website-org" @@ -3019,7 +3506,8 @@ Now, here is my configuration. In this snippet, my org files located in my sourc :auto-preamble t) #+END_SRC -We also have the component for all the static files needed to run the website (mostly images tbh). +We also have the component for all the static files needed to run the website +(mostly images tbh). #+NAME: org-proj-config-static #+BEGIN_SRC emacs-lisp ("config-website-static" @@ -3043,7 +3531,8 @@ The project is then defined like so: :PROPERTIES: :CUSTOM_ID: User_Configuration-Org-mode-Org_projects-Linguistics_website-34b8d4e7 :END: -My linguistics website is made out of three projects. As for the previous project, let’s declare the common values for these. +My linguistics website is made out of three projects. As for the previous +project, let’s declare the common values for these. #+NAME: org-proj-lang-setup #+BEGIN_SRC emacs-lisp (defvar phundrak//projects-conlanging-target @@ -3091,7 +3580,8 @@ We also have the component for the LaTeX and PDF part of the website: :auto-preamble t) #+END_SRC -And lastly, we have the component for all the static files needed to run the website: +And lastly, we have the component for all the static files needed to run the +website: #+NAME: org-proj-lang-static #+BEGIN_SRC emacs-lisp ("langue-phundrak-com-static" @@ -3116,8 +3606,8 @@ The project is then defined like so: :PROPERTIES: :CUSTOM_ID: User_Configuration-Org-mode-Org_variables-User_information-6c7d5e3f :END: -Some variables about myself need to be set so Org-mode knows what -information to include in exported files. +Some variables about myself need to be set so Org-mode knows what information to +include in exported files. #+NAME: org-user-information #+BEGIN_SRC emacs-lisp (setq user-full-name "Lucien Cartier-Tilet" @@ -3134,7 +3624,9 @@ information to include in exported files. :PROPERTIES: :CUSTOM_ID: User_Configuration-Editing_and_modes-Default_modes-50d4e086 :END: -Some buffers sometimes won’t have a default mode at all, such as the ~*scratch*~ buffer. In any vanilla configuration, they will then default to ~text-mode~. I personally prefer ~org-mode~ to be my default mode, so let’s set it so! +Some buffers sometimes won’t have a default mode at all, such as the ~*scratch*~ +buffer. In any vanilla configuration, they will then default to ~text-mode~. I +personally prefer ~org-mode~ to be my default mode, so let’s set it so! #+BEGIN_SRC emacs-lisp (setq edit-server-default-major-mode 'org-mode) #+END_SRC @@ -3143,7 +3635,8 @@ Some buffers sometimes won’t have a default mode at all, such as the ~*scratch :PROPERTIES: :CUSTOM_ID: User_Configuration-Editing_and_modes-Evil-3cedaaee :END: -As a user of Evil, I’m sometimes pissed when I accidentally press ~C-u~ and it gets me to the top of the document. So, let’s disable it: +As a user of Evil, I’m sometimes pissed when I accidentally press ~C-u~ and it +gets me to the top of the document. So, let’s disable it: #+BEGIN_SRC emacs-lisp (setq evil-want-C-u-scroll nil) #+END_SRC @@ -3152,7 +3645,9 @@ As a user of Evil, I’m sometimes pissed when I accidentally press ~C-u~ and it :PROPERTIES: :CUSTOM_ID: User_Configuration-File_extensions-f76fe752 :END: -Sometimes, Emacs doesn’t recognize or misrecognizes some extensions, resulting in a wrong mode set for said file. Let’s fix that by associating the extension with the desired mode: +Sometimes, Emacs doesn’t recognize or misrecognizes some extensions, resulting +in a wrong mode set for said file. Let’s fix that by associating the extension +with the desired mode: #+BEGIN_SRC emacs-lisp (dolist (e '(("xml" . web-mode) ("xinp" . web-mode) @@ -3172,7 +3667,8 @@ Sometimes, Emacs doesn’t recognize or misrecognizes some extensions, resulting auto-mode-alist)) #+END_SRC -We also have a couple of extensions which should all be in ~conf-unix-mode~, let’s indicate that to Emacs: +We also have a couple of extensions which should all be in ~conf-unix-mode~, +let’s indicate that to Emacs: #+BEGIN_SRC emacs-lisp (dolist (e '("service" "timer" "target" "mount" "automount" "slice" "socket" "path" "netdev" "network" @@ -3185,18 +3681,24 @@ We also have a couple of extensions which should all be in ~conf-unix-mode~, let :PROPERTIES: :CUSTOM_ID: User_Configuration-Miscellaneous-Hooks-86da2da0 :END: -I also have some hooks I use for enabling some major and minor modes. The first one here allows the execution of the deletion of trailing space each time I save a file. +I also have some hooks I use for enabling some major and minor modes. The first +one here allows the execution of the deletion of trailing space each time I save +a file. #+BEGIN_SRC emacs-lisp (add-hook 'before-save-hook 'delete-trailing-whitespace) #+END_SRC -I also want to always be in ~visual-line-mode~ so Emacs soft-wraps lines that are too long for the buffer they are displayed in. This will also be enabled for Elfeed. +I also want to always be in ~visual-line-mode~ so Emacs soft-wraps lines that +are too long for the buffer they are displayed in. This will also be enabled for +Elfeed. #+BEGIN_SRC emacs-lisp (add-hook 'prog-mode-hook 'visual-line-mode) (add-hook 'elfeed-read-mode-hook 'visual-line-mode) #+END_SRC -I also want for some non-programming modes to enable a hard-limit in terms of how many characters can fit on one line. The modes that benefit are ~message-mode~, ~org-mode~, ~text-mode~ and ~markdown-mode~. +I also want for some non-programming modes to enable a hard-limit in terms of +how many characters can fit on one line. The modes that benefit are +~message-mode~, ~org-mode~, ~text-mode~ and ~markdown-mode~. #+BEGIN_SRC emacs-lisp (mapc (lambda (x) (add-hook x 'visual-line-mode)) @@ -3209,7 +3711,8 @@ I also want for some non-programming modes to enable a hard-limit in terms of ho :PROPERTIES: :CUSTOM_ID: User_Configuration-Miscellaneous-Twittering_mode-b97d9327 :END: -For ~twittering-mode~, a Twitter major mode for Emacs, I want to encrypt my data using a master password, which I do thanks to this option: +For ~twittering-mode~, a Twitter major mode for Emacs, I want to encrypt my data +using a master password, which I do thanks to this option: #+BEGIN_SRC emacs-lisp (setq twittering-use-master-password t) #+END_SRC @@ -3218,7 +3721,9 @@ For ~twittering-mode~, a Twitter major mode for Emacs, I want to encrypt my data :PROPERTIES: :CUSTOM_ID: User_Configuration-Editing_and_modes-Wrapping_regions-2250281e :END: -I really like the ~M-(~ keybinding for wrapping a selected region between parenthesis. However, parenthesis are not everything (even in Lisp dialects), and other wrappers could be nice. And they are! Here is how they are declared: +I really like the ~M-(~ keybinding for wrapping a selected region between +parenthesis. However, parenthesis are not everything (even in Lisp dialects), +and other wrappers could be nice. And they are! Here is how they are declared: #+BEGIN_SRC emacs-lisp (global-set-key (kbd "M-[") 'insert-pair) (global-set-key (kbd "M-{") 'insert-pair) @@ -3234,20 +3739,31 @@ For the record, this is from [[http://www.howardism.org/][Howard Abram]]’s [[h :PROPERTIES: :CUSTOM_ID: User_Configuration-Shortcuts-aef3f7a7 :END: -As you will see, I defined a LOT of custom keybindings. All of them are Spacemacs keybindings, defined in a way they can be used seamlessly with Evil. They almost all begin with ~o~, which is a prefix reserved for user-defined keybindings so they won’t conflict with any package. Let’s declare it like so. +As you will see, I defined a LOT of custom keybindings. All of them are +Spacemacs keybindings, defined in a way they can be used seamlessly with Evil. +They almost all begin with ~o~, which is a prefix reserved for user-defined +keybindings so they won’t conflict with any package. Let’s declare it like so. #+BEGIN_SRC emacs-lisp (spacemacs/declare-prefix "o" "custom") #+END_SRC -Now, all keybindings that will be defined can be invoked in Normal-mode with the ~SPC~ key followed by the sequence assigned to each keybinding. +Now, all keybindings that will be defined can be invoked in Normal-mode with the +~SPC~ key followed by the sequence assigned to each keybinding. -Before some more specialized categories, I have two commands which don’t fit into any other category that I sometime use. The first one is a fix for the Bépo keybindings which left out a keybind: ~winum-select-window-by-number~ is still bound to ~SPC ²~, which is not a key that is available on the bépo layout (instead, we use the dead key ~^~ followed by ~2~, or any digits). So instead, let’s use the key that is physically in the same place: ~$~. +Before some more specialized categories, I have two commands which don’t fit +into any other category that I sometime use. The first one is a fix for the Bépo +keybindings which left out a keybind: ~winum-select-window-by-number~ is still +bound to ~SPC ²~, which is not a key that is available on the bépo layout +(instead, we use the dead key ~^~ followed by ~2~, or any digits). So instead, +let’s use the key that is physically in the same place: ~$~. #+BEGIN_SRC emacs-lisp (spacemacs/declare-prefix "$" "select window by number") (spacemacs/set-leader-keys "$" 'winum-select-window-by-number) #+END_SRC -The following, I use it rarely, it can launch an external command from Emacs to launch, for instance, my web browser or any other software not related to Emacs. It offers a similar interface to [[https://wiki.archlinux.org/index.php/Dmenu][dmenu]] through helm. +The following, I use it rarely, it can launch an external command from Emacs to +launch, for instance, my web browser or any other software not related to Emacs. +It offers a similar interface to [[https://wiki.archlinux.org/index.php/Dmenu][dmenu]] through helm. #+BEGIN_SRC emacs-lisp (spacemacs/declare-prefix "or" "external command") (spacemacs/set-leader-keys "or" 'helm-run-external-command) @@ -3267,7 +3783,12 @@ As this is a new category, let’s declare its prefix: (spacemacs/declare-prefix "oa" "applications") #+END_SRC -Now, let’s also declare the keybindings in this category. ~oac~ will invoke Emacs’ calculator, while ~oac~ invokes the calendar, ~oae~ invokes the Eww web browser, ~oaw~ invokes ~woman~ (actually ~helm-man-woman~), and ~oaW~ invokes the weather forecast. Lastly, the apostrophe in ~oa'~ will invoke Eshell directly, without any popup window as with ~,'~ while ~oan~ will open a new eshell buffer if another one already exists. +Now, let’s also declare the keybindings in this category. ~oac~ will invoke +Emacs’ calculator, while ~oac~ invokes the calendar, ~oae~ invokes the Eww web +browser, ~oaw~ invokes ~woman~ (actually ~helm-man-woman~), and ~oaW~ invokes +the weather forecast. Lastly, the apostrophe in ~oa'~ will invoke Eshell +directly, without any popup window as with ~,'~ while ~oan~ will open a new +eshell buffer if another one already exists. #+BEGIN_SRC emacs-lisp (spacemacs/set-leader-keys "oa'" 'eshell @@ -3283,13 +3804,22 @@ Now, let’s also declare the keybindings in this category. ~oac~ will invoke Em :PROPERTIES: :CUSTOM_ID: User_Configuration-Keybindings-Applications-Org_tree_slide-29545c5e :END: -Finally, here we have the keybindings for ~org-tree-slide~, a presentation mode with orgmode. Since I want the keys to be directly accessible without any prefix from Spacemacs, I’ll have to declare them the vanilla way. First we have keybindings that will launch the presentation: +Finally, here we have the keybindings for ~org-tree-slide~, a presentation mode +with orgmode. Since I want the keys to be directly accessible without any prefix +from Spacemacs, I’ll have to declare them the vanilla way. First we have +keybindings that will launch the presentation: #+BEGIN_SRC emacs-lisp (define-key org-mode-map (kbd "") 'org-tree-slide-mode) (define-key org-mode-map (kbd "s-") 'org-tree-slide-skip-done-toggle) #+END_SRC -Next, we have some additional keybindings that will only be active when in ~org-tree-slide-mode~. The first one will allow us to exit this mode, while the second one will toggle the display of headers marked as ~DONE~. Next, we have ~F9~ and ~F10~ which are bound to movement in the slide, while ~F11~ changes the way the content is displayed. We also set ~org-tree-slide-skip-outline-level~ to set the maximum depth we will display as an individual heading during the presentation. +Next, we have some additional keybindings that will only be active when in +~org-tree-slide-mode~. The first one will allow us to exit this mode, while the +second one will toggle the display of headers marked as ~DONE~. Next, we have +~F9~ and ~F10~ which are bound to movement in the slide, while ~F11~ changes the +way the content is displayed. We also set ~org-tree-slide-skip-outline-level~ to +set the maximum depth we will display as an individual heading during the +presentation. #+BEGIN_SRC emacs-lisp (when (require 'org-tree-slide nil t) (global-set-key (kbd "") 'org-tree-slide-mode) @@ -3309,7 +3839,8 @@ Next, we have some additional keybindings that will only be active when in ~org- :PROPERTIES: :CUSTOM_ID: User_Configuration-Shortcuts-Comments-508db33d :END: -Some keybindings are also related to comment editing, in particular using outorg. Let’s first declare the dedicated prefix: +Some keybindings are also related to comment editing, in particular using +outorg. Let’s first declare the dedicated prefix: #+BEGIN_SRC emacs-lisp (spacemacs/declare-prefix "oc" "comments") #+END_SRC @@ -3322,24 +3853,32 @@ Now, let’s declare the following keybindings: "oco" 'outline-minor-mode) #+END_SRC -~oco~ enables the outline minor mode, which then allows for the edition of comments in org buffers with ~oce~ and saving them to the original source file with ~occ~. +~oco~ enables the outline minor mode, which then allows for the edition of +comments in org buffers with ~oce~ and saving them to the original source file +with ~occ~. *** Dired :PROPERTIES: :CUSTOM_ID: User-Configuration-Keybindings-Dired-2a45af8d :END: -A couple of keybindings will be added to Dired. The first one is the opening parenthesis which will enable or disable ~dired-hide-details-mode~. On the other hand, a closing parenthesis will show git information in the current Dired buffer. +A couple of keybindings will be added to Dired. The first one is the opening +parenthesis which will enable or disable ~dired-hide-details-mode~. On the other +hand, a closing parenthesis will show git information in the current Dired +buffer. #+BEGIN_SRC emacs-lisp (define-key dired-mode-map (kbd "(") 'dired-hide-details-mode) (define-key dired-mode-map (kbd ")") 'dired-git-info-mode) #+END_SRC -Something I use from time to time is ~S-F1~ for opening dired in my ~$HOME~ directory. For that, I simply did the following: +Something I use from time to time is ~S-F1~ for opening dired in my ~$HOME~ +directory. For that, I simply did the following: #+BEGIN_SRC emacs-lisp (global-set-key (kbd "") (lambda () (interactive) (dired "~/"))) #+END_SRC -A couple of other useful utilities, sach as opening all marked files, sorting files, opening them externally and renaming them, are also bound to a simple key press: +A couple of other useful utilities, sach as opening all marked files, sorting +files, opening them externally and renaming them, are also bound to a simple key +press: #+BEGIN_SRC emacs-lisp (define-key dired-mode-map (kbd "f") 'phundrak/open-marked-files) (define-key dired-mode-map (kbd "F") 'xah/open-in-external-app) @@ -3355,25 +3894,33 @@ A couple of other useful utilities, sach as opening all marked files, sorting fi (spacemacs/set-leader-keys "of" 'phundrak/find-org-files) #+END_SRC -I also have a shortcut for ~helm-locate~ in case I need to find a file that is not in these directories. One advantage of this over ~helm-find~ is that it doesn’t matter from where I call it, it will find any file on my system that matches the query, whereas ~helm-find~ will only search in the current directory and its subdirectories. This time, the declaration is much simpler: +I also have a shortcut for ~helm-locate~ in case I need to find a file that is +not in these directories. One advantage of this over ~helm-find~ is that it +doesn’t matter from where I call it, it will find any file on my system that +matches the query, whereas ~helm-find~ will only search in the current directory +and its subdirectories. This time, the declaration is much simpler: #+BEGIN_SRC emacs-lisp (spacemacs/declare-prefix "oF" "locate file") (spacemacs/set-leader-keys "oF" 'helm-locate) #+END_SRC -And that’s it! This should list all my org files under these directories and give me fuzzy finding for these files. I just need to partially type the name of the file I want to open and it should open without any issue. +And that’s it! This should list all my org files under these directories and +give me fuzzy finding for these files. I just need to partially type the name of +the file I want to open and it should open without any issue. *** Games :PROPERTIES: :CUSTOM_ID: User-Configuration-Keybindings-Games-c9e6ac80 :END: -Just to make it easier to launch it, I’ll declare a shortcut for launching tetris (which is built into Emacs). +Just to make it easier to launch it, I’ll declare a shortcut for launching +tetris (which is built into Emacs). #+BEGIN_SRC emacs-lisp (spacemacs/declare-prefix "oat" "tetris") (spacemacs/set-leader-keys "oat" 'tetris) #+END_SRC -Apparently, no evil keybindings are set for Tetris. Let’s declare them (adapted to the bépo layout): +Apparently, no evil keybindings are set for Tetris. Let’s declare them (adapted +to the bépo layout): #+BEGIN_SRC emacs-lisp (require 'tetris) (define-key tetris-mode-map (kbd "c") 'tetris-move-left) @@ -3386,7 +3933,9 @@ Apparently, no evil keybindings are set for Tetris. Let’s declare them (adapte :PROPERTIES: :CUSTOM_ID: User_Configuration-Shortcuts-Multiple_cursors-83db7c9c :END: -I don’t really like Spacemacs’ layer for MultipleCursors, so I prefer to simply install the package and create shortcuts for it myself. Let’s first declare category: +I don’t really like Spacemacs’ layer for MultipleCursors, so I prefer to simply +install the package and create shortcuts for it myself. Let’s first declare +category: #+BEGIN_SRC emacs-lisp (spacemacs/declare-prefix "om" "multiple-cursors") #+END_SRC @@ -3426,14 +3975,19 @@ Now, I have a couple of shortcuts I use regularly: (spacemacs/declare-prefix-for-mode 'org-mode "mots" "toggle src split") #+END_SRC -~os~ allows me to insert an org structure template defined in ~org-structure-template-alist~ (see [[#User_Configuration-Org-mode-Org_variables-Org_behavior-0319db38][Org behavior]]), while ~ott~ displays the outline of the current org file. +~os~ allows me to insert an org structure template defined in +~org-structure-template-alist~ (see [[#User_Configuration-Org-mode-Org_variables-Org_behavior-0319db38][Org behavior]]), while ~ott~ displays the +outline of the current org file. ~oT~ is the prefix for tree-related operations: #+BEGIN_SRC emacs-lisp (spacemacs/declare-prefix-for-mode 'org-mode "moT" "tables") #+END_SRC -These shortcuts allow to manipulate the width of the column the cursor is currently in, by either shrinking it, expanding it, or toggling its state between shrunk or expanded. A prefix for all of these commands has been also added in order to make the purpose of the shortcuts clearer. +These shortcuts allow to manipulate the width of the column the cursor is +currently in, by either shrinking it, expanding it, or toggling its state +between shrunk or expanded. A prefix for all of these commands has been also +added in order to make the purpose of the shortcuts clearer. #+BEGIN_SRC emacs-lisp (spacemacs/set-leader-keys-for-major-mode 'org-mode "oTt" 'org-table-toggle-column-width @@ -3444,7 +3998,8 @@ These shortcuts allow to manipulate the width of the column the cursor is curren (spacemacs/declare-prefix-for-mode 'org-mode "moTs" "shrink") #+END_SRC -Finaly, I set the following shortcut in order to easily remove ~RESULTS~ blocks from org source code blocks: +Finaly, I set the following shortcut in order to easily remove ~RESULTS~ blocks +from org source code blocks: #+BEGIN_SRC emacs-lisp (spacemacs/set-leader-keys-for-major-mode 'org-mode "or" 'org-babel-remove-result-one-or-many) @@ -3460,12 +4015,19 @@ This category allows to toggle some modes and options. (spacemacs/declare-prefix "ot" "toggle") #+END_SRC -As you can see, I have here four shortcuts for toggling various elements in Emacs: -- ~otb~ :: toggles ~fancy-battery-mode~. This comes in very handy when I am on a laptop that is not pluged in or which is charging. -- ~otd~ :: toggles ~elcord-mode~. This mode is used to create an Emacs rich integration in Discord. -- ~otf~ :: toggles the activation of FlyCheck, Emacs’ spell checker. It is by default disabled, and I can turn it on with this shortcut only when needed. -- ~ots~ :: toggles ~prettify-symbols-mode~. This allows Emacs to replace some symbols by some others, like for example by replacing ~lambda~ in Emacs Lisp buffers with an actual λ. -- ~otS~ :: toggles whether or not Eshell should shorten the current path in its prompt +As you can see, I have here four shortcuts for toggling various elements in +Emacs: +- ~otb~ :: toggles ~fancy-battery-mode~. This comes in very handy when I am on a + laptop that is not pluged in or which is charging. +- ~otd~ :: toggles ~elcord-mode~. This mode is used to create an Emacs rich + integration in Discord. +- ~otf~ :: toggles the activation of FlyCheck, Emacs’ spell checker. It is by + default disabled, and I can turn it on with this shortcut only when needed. +- ~ots~ :: toggles ~prettify-symbols-mode~. This allows Emacs to replace some + symbols by some others, like for example by replacing ~lambda~ in Emacs Lisp + buffers with an actual λ. +- ~otS~ :: toggles whether or not Eshell should shorten the current path in its + prompt #+BEGIN_SRC emacs-lisp (spacemacs/set-leader-keys "otb" 'fancy-battery-mode @@ -3475,7 +4037,10 @@ As you can see, I have here four shortcuts for toggling various elements in Emac "otS" 'phundrak/prompt-toggle-abbreviation) #+END_SRC -We also have some input methods-related shortcuts in a sub-category: ~oti~. The first shortcuts below are used to either toggle between no input method or the last one used (~otit~), or choose an input method among the various available ones from Emacs (~otis~). +We also have some input methods-related shortcuts in a sub-category: ~oti~. The +first shortcuts below are used to either toggle between no input method or the +last one used (~otit~), or choose an input method among the various available +ones from Emacs (~otis~). #+BEGIN_SRC emacs-lisp (spacemacs/declare-prefix "oti" "input methods") (spacemacs/set-leader-keys @@ -3483,7 +4048,9 @@ We also have some input methods-related shortcuts in a sub-category: ~oti~. The "otis" 'set-input-method) #+END_SRC -The shortcuts below though allow me to directly switch to one of these three known input methods I sometimes or often use, namely Japanese, Tibetan and IPA (by typing in X-SAMPA). +The shortcuts below though allow me to directly switch to one of these three +known input methods I sometimes or often use, namely Japanese, Tibetan and IPA +(by typing in X-SAMPA). #+BEGIN_SRC emacs-lisp (spacemacs/declare-prefix "otij" "Japanese") (spacemacs/declare-prefix "otix" "IPA (X-SAMPA)") @@ -3498,7 +4065,9 @@ The shortcuts below though allow me to directly switch to one of these three kno :PROPERTIES: :CUSTOM_ID: User_Configuration-Mu4e-f3df8e9e :END: -Mu4e is a frontend for mu, an email analyzer which sits on top of a Maildir which gets updated with the ~mbsync~ command from ~isync~. It has a lot of neat features, but I guess my favorite ones are: +Mu4e is a frontend for mu, an email analyzer which sits on top of a Maildir +which gets updated with the ~mbsync~ command from ~isync~. It has a lot of neat +features, but I guess my favorite ones are: 1. the search query feature 2. rendering an HTML email in the browser @@ -3506,7 +4075,9 @@ Mu4e is a frontend for mu, an email analyzer which sits on top of a Maildir whic :PROPERTIES: :CUSTOM_ID: User-Configuration-Mu4e-Setup-1d23809e :END: -Due to mu sitting on top of a maildir, I need to tell mu4e where said maildir is, and point it the trash, archive, and sent folders as well as the refresh command and how frequently I want my emails to be refreshed. +Due to mu sitting on top of a maildir, I need to tell mu4e where said maildir +is, and point it the trash, archive, and sent folders as well as the refresh +command and how frequently I want my emails to be refreshed. #+BEGIN_SRC emacs-lisp (setq mu4e-maildir "~/.mail" mu4e-trash-folder "/Trash" @@ -3517,7 +4088,12 @@ Due to mu sitting on top of a maildir, I need to tell mu4e where said maildir is mu4e-update-interval 60) #+END_SRC -This source block is an example of the search queries in mu4e, and part of the reason why I very much like mu4e: these bookmarks are actually defined by search queries, but act as if they were just yet another type of custom inbox you get with modern Email client (and often you don’t even get them). All these bookmarks can be accessed through a shortcut on the main mu4e buffer, prefixed by ~b~. So, for instance, my unread messages are accessed through ~bU~. +This source block is an example of the search queries in mu4e, and part of the +reason why I very much like mu4e: these bookmarks are actually defined by search +queries, but act as if they were just yet another type of custom inbox you get +with modern Email client (and often you don’t even get them). All these +bookmarks can be accessed through a shortcut on the main mu4e buffer, prefixed +by ~b~. So, for instance, my unread messages are accessed through ~bU~. #+BEGIN_SRC emacs-lisp (setq mu4e-bookmarks `((,(s-join " " @@ -3556,7 +4132,10 @@ This source block is an example of the search queries in mu4e, and part of the r ("mime:image/* AND NOT flag:trashed" "Messages with images" ?p))) #+END_SRC -On new email arrival, Emacs can send the system a notification which will be handled as any other notification received by the system and will display the number of unread emails to the user; in my case, notifications are handled by AwesomeWM. +On new email arrival, Emacs can send the system a notification which will be +handled as any other notification received by the system and will display the +number of unread emails to the user; in my case, notifications are handled by +AwesomeWM. #+BEGIN_SRC emacs-lisp (setq mu4e-enable-notifications t mu4e-alert-email-notification-types '(count)) @@ -3565,7 +4144,9 @@ On new email arrival, Emacs can send the system a notification which will be han (add-hook 'mu4e-view-mode-hook 'visual-line-mode) #+END_SRC -This is the setup I have for my SMTP mail server: I point Emacs’ SMTP services to my private mail server on its SMTP port, which should be used with a STARTTLS stream. And I tell Emacs this is the default way to send an email. +This is the setup I have for my SMTP mail server: I point Emacs’ SMTP services +to my private mail server on its SMTP port, which should be used with a STARTTLS +stream. And I tell Emacs this is the default way to send an email. #+BEGIN_SRC emacs-lisp (setq smtpmail-smtp-server "mail.phundrak.com" smtpmail-smtp-service 587 @@ -3573,7 +4154,9 @@ This is the setup I have for my SMTP mail server: I point Emacs’ SMTP services message-send-mail-function 'smtpmail-send-it) #+END_SRC -I wish my emails to be signed by default using PGP/MIME. ~mu4e~ uses ~message~ for composing new emails, so I simply need to add the function that will add the signature to emails to the hook called when creating a new email. +I wish my emails to be signed by default using PGP/MIME. ~mu4e~ uses ~message~ +for composing new emails, so I simply need to add the function that will add the +signature to emails to the hook called when creating a new email. #+BEGIN_SRC emacs-lisp (add-hook 'mu4e-compose-mode-hook 'mml-secure-message-sign-pgpmime) #+END_SRC @@ -3582,7 +4165,9 @@ I wish my emails to be signed by default using PGP/MIME. ~mu4e~ uses ~message~ f :PROPERTIES: :CUSTOM_ID: User-Configuration-Mu4e-Visual-Configuration-34f56f7e :END: -The following also allows me to automatically include my signature in my Emails, to view images in my Emacs buffers and to show me the address of my contacts and not just their names. +The following also allows me to automatically include my signature in my Emails, +to view images in my Emacs buffers and to show me the address of my contacts and +not just their names. #+BEGIN_SRC emacs-lisp (setq mu4e-compose-signature-auto-include t mu4e-view-show-images t @@ -3590,12 +4175,17 @@ The following also allows me to automatically include my signature in my Emails, mu4e-view-show-addresses t) #+END_SRC -Now this hook is added so I can get a maximal width for the text of my emails, I really don’t like it when lines are kilometers long. I would like instead to hook ~visual-line-mode~ and ~auto-fill-mode~, but for some reasons Emacs throws an error when I add them, So I go with ~visual-fill-column-mode~ instead. +Now this hook is added so I can get a maximal width for the text of my emails, I +really don’t like it when lines are kilometers long. I would like instead to +hook ~visual-line-mode~ and ~auto-fill-mode~, but for some reasons Emacs throws +an error when I add them, So I go with ~visual-fill-column-mode~ instead. #+BEGIN_SRC emacs-lisp (add-hook 'mu4e-view-mode-hook 'visual-fill-column-mode) #+END_SRC -Icons are nice and all, but my current font does not display some of the default icons set by mu4e. Due to this, I will define back these icons to the original characters defined by mu4e: +Icons are nice and all, but my current font does not display some of the default +icons set by mu4e. Due to this, I will define back these icons to the original +characters defined by mu4e: #+BEGIN_SRC emacs-lisp (setq mu4e-headers-draft-mark '("D" . "D") mu4e-headers-flagged-mark '("F" . "F") @@ -3610,18 +4200,22 @@ Icons are nice and all, but my current font does not display some of the default mu4e-headers-unread-mark '("u" . "u")) #+END_SRC -# I also set some custom faces you can see [[#User-Configuration-Visual-configuration-Better-faces-Mu4e-7b52d940][here]]. - *** Misc :PROPERTIES: :CUSTOM_ID: User-Configuration-Mu4e-Misc-9c7a4f5b :END: -I am unsure yet if this has any effect on mu4e, but this variable should discourage mu4e from reading rich text emails and instead open them as plain text. However, I do not wish to discourage opening HTML emails since I can open them in the browser. +I am unsure yet if this has any effect on mu4e, but this variable should +discourage mu4e from reading rich text emails and instead open them as plain +text. However, I do not wish to discourage opening HTML emails since I can open +them in the browser. #+BEGIN_SRC emacs-lisp (setq mm-discouraged-alternatives '("text/richtext")) #+END_SRC -I am still unsure about this variable and if it has an effect on mu4e, but I wish to set a default web viewer for my HTML emails: w3m. This is not as effective as sending the email in the browser or rendering it as a PDF file, but it can be effective enough for some emails. +I am still unsure about this variable and if it has an effect on mu4e, but I +wish to set a default web viewer for my HTML emails: w3m. This is not as +effective as sending the email in the browser or rendering it as a PDF file, but +it can be effective enough for some emails. #+BEGIN_SRC emacs-lisp (setq mm-text-html-renderer 'w3m) #+END_SRC @@ -3630,14 +4224,17 @@ I am still unsure about this variable and if it has an effect on mu4e, but I wis :PROPERTIES: :CUSTOM_ID: User_Configuration-Miscellaneous-d230bc2f :END: -I have a lot of variables that need to be set but don’t fall in any other category, so I’ll collect them here. +I have a lot of variables that need to be set but don’t fall in any other +category, so I’ll collect them here. I have this regexp for detecting paragraphs. #+BEGIN_SRC emacs-lisp (setq paragraph-start "\f\\|[ \t]*$\\|[ \t]*[-+*] ") #+END_SRC -And this variable for Elcord so the main icon displayed in Discord is the icon representing the current major-mode. I also don’t want to display the small icon, so let’s get rid of that. +And this variable for Elcord so the main icon displayed in Discord is the icon +representing the current major-mode. I also don’t want to display the small +icon, so let’s get rid of that. #+BEGIN_SRC emacs-lisp (setq elcord-use-major-mode-as-main-icon t elcord-show-small-icon nil) @@ -3647,7 +4244,8 @@ And this variable for Elcord so the main icon displayed in Discord is the icon r :PROPERTIES: :CUSTOM_ID: User_Configuration-Miscellaneous-Pinentry-95004d5a :END: -Pinentry should use the ~loopback~ mode when communicating with GnuPG. Let’s set it so: +Pinentry should use the ~loopback~ mode when communicating with GnuPG. Let’s set +it so: #+BEGIN_SRC emacs-lisp (setq epg-pinentry-mode 'loopback) #+END_SRC @@ -3656,13 +4254,17 @@ Pinentry should use the ~loopback~ mode when communicating with GnuPG. Let’s s :PROPERTIES: :CUSTOM_ID: User_Configuration-Miscellaneous-Wttr.in_cities-dd24f8c5 :END: -Thanks to the wttrin package, I can get the weather forecast in Emacs for a couple of cities. I just need to specify them to Emacs like so: +Thanks to the wttrin package, I can get the weather forecast in Emacs for a +couple of cities. I just need to specify them to Emacs like so: #+BEGIN_SRC emacs-lisp (setq wttrin-default-cities '("Aubervilliers" "Paris" "Lyon" "Nonières" "Saint Agrève")) #+END_SRC -However, the package is currently broken (it was last updated in 2017): wttr.in now returns by default an HTML page instead of an ASCII result. In order to fix it, a ~?A~ must be added at the end of the request in order to get a nice output. Also, let’s use the HTTPS protocol while we’re at it. +However, the package is currently broken (it was last updated in 2017): wttr.in +now returns by default an HTML page instead of an ASCII result. In order to fix +it, a ~?A~ must be added at the end of the request in order to get a nice +output. Also, let’s use the HTTPS protocol while we’re at it. #+BEGIN_SRC emacs-lisp (defun wttrin-fetch-raw-string (query) "Get the weather information based on your QUERY." @@ -3683,7 +4285,8 @@ However, the package is currently broken (it was last updated in 2017): wttr.in :PROPERTIES: :CUSTOM_ID: User_Configuration-Nov-mode-6f10765d :END: -~nov-mode~ is the mode used in the Epub reader. Here I will write a little function that I will call through a hook each time I’m opening a new EPUB file. +~nov-mode~ is the mode used in the Epub reader. Here I will write a little +function that I will call through a hook each time I’m opening a new EPUB file. #+BEGIN_SRC emacs-lisp (defun my-nov-font-setup () (face-remap-add-relative 'variable-pitch :family "Charis SIL" @@ -3691,7 +4294,8 @@ However, the package is currently broken (it was last updated in 2017): wttr.in :height 1.0)) #+END_SRC -Let’s bind this function to the ~nov-mode~ hook. By the way, we’ll also enable the ~visual-line-mode~ here, just in case. +Let’s bind this function to the ~nov-mode~ hook. By the way, we’ll also enable +the ~visual-line-mode~ here, just in case. #+BEGIN_SRC emacs-lisp (mapc (lambda (mode) (add-hook 'nov-mode-hook mode)) @@ -3711,19 +4315,24 @@ Let’s also set the maximum length of the lines in ~nov-mode~: :PROPERTIES: :CUSTOM_ID: User_Configuration-LSP-4f8aa691 :END: -When it comes to the LSP layer, there are some options which are not enabled by default that I want to use, especially some modes I want to take advantage of. This is why I enable first the ~lsp-treemacs-sync-mode~ so treemacs is LSP aware: +When it comes to the LSP layer, there are some options which are not enabled by +default that I want to use, especially some modes I want to take advantage of. +This is why I enable first the ~lsp-treemacs-sync-mode~ so treemacs is LSP +aware: #+BEGIN_SRC emacs-lisp (lsp-treemacs-sync-mode 1) #+END_SRC -I also enable some layers related to ~dap~, the Debug Adapter Protocol, which works really nicely with LSP. Let’s enable Dap’s modes: +I also enable some layers related to ~dap~, the Debug Adapter Protocol, which +works really nicely with LSP. Let’s enable Dap’s modes: #+BEGIN_SRC emacs-lisp (dap-mode 1) (dap-ui-mode 1) (dap-tooltip-mode 1) #+END_SRC -Finally, I also want the documentation tooltip to show up when the cursor is above a documented piece of code or symbol. Let’s enable that too: +Finally, I also want the documentation tooltip to show up when the cursor is +above a documented piece of code or symbol. Let’s enable that too: #+BEGIN_SRC emacs-lisp (tooltip-mode 1) #+END_SRC @@ -3732,7 +4341,8 @@ Finally, I also want the documentation tooltip to show up when the cursor is abo :PROPERTIES: :CUSTOM_ID: User_Configuration-ASM_configuration-f6dc7674 :END: -The first thing I will set with my ASM configuration is where the reference PDF is located. +The first thing I will set with my ASM configuration is where the reference PDF +is located. #+BEGIN_SRC emacs-lisp (setq x86-lookup-pdf "~/Documents/code/asm/Intelx86/325383-sdm-vol-2abcd.pdf") #+END_SRC @@ -3746,7 +4356,8 @@ I will also modify what the comment character is, from a ~;~ to a ~#~: :PROPERTIES: :CUSTOM_ID: User_Configuration-C-C++-76c3f997 :END: -As the C/C++ syntax is checked by flycheck, let’s make sure we are using the latest standard available, that is C++17 and C17, from Clang. +As the C/C++ syntax is checked by flycheck, let’s make sure we are using the +latest standard available, that is C++17 and C17, from Clang. #+BEGIN_SRC emacs-lisp (add-hook 'c-mode-hook (lambda () @@ -3760,7 +4371,9 @@ As the C/C++ syntax is checked by flycheck, let’s make sure we are using the l :PROPERTIES: :CUSTOM_ID: User_Configuration-Dart_configuration-ecf24ebf :END: -For Dart, I mainly declared some custom shortcuts bound to ~dart-mode~ related to flutter, so nothing too exciting here. Some prefix are declared in order to avoid the shortcuts in helm to show up as just ~custom~. +For Dart, I mainly declared some custom shortcuts bound to ~dart-mode~ related +to flutter, so nothing too exciting here. Some prefix are declared in order to +avoid the shortcuts in helm to show up as just ~custom~. #+begin_src emacs-lisp (spacemacs/declare-prefix-for-mode 'dart-mode "mo" "user-defined") (spacemacs/declare-prefix-for-mode 'dart-mode "mof" "flutter") @@ -3781,13 +4394,16 @@ Now, for the shortcuts themselves: :PROPERTIES: :CUSTOM_ID: User_Configuration-Emacs_Lisp-59230f3c :END: -Here will be stored my configuration directly related to Emacs Lisp, including some functions or default modes. +Here will be stored my configuration directly related to Emacs Lisp, including +some functions or default modes. **** Enable ~eldoc-mode~ by default :PROPERTIES: :CUSTOM_ID: User_Configuration-Emacs_Lisp-Enable_~eldoc-mode~_by_default-f131abde :END: -By default, if some Elisp code is opened, I want to enable ~eldoc-mode~ so I can easily get some documentation on the symbols in the source code. This is done via the use of hooks. +By default, if some Elisp code is opened, I want to enable ~eldoc-mode~ so I can +easily get some documentation on the symbols in the source code. This is done +via the use of hooks. #+BEGIN_SRC emacs-lisp (add-hook 'prog-mode-hook 'eldoc-mode) #+END_SRC @@ -3796,7 +4412,9 @@ By default, if some Elisp code is opened, I want to enable ~eldoc-mode~ so I can :PROPERTIES: :CUSTOM_ID: User_Configuration-Emacs_Lisp-~phundrak-write-to-buffer~-2f192dd3 :END: -I was very surprised when I discovered no such function exists in Elisp. This function basically writes a string into a buffer, and optionally switches the user to the buffer. Here is the code for that function: +I was very surprised when I discovered no such function exists in Elisp. This +function basically writes a string into a buffer, and optionally switches the +user to the buffer. Here is the code for that function: #+BEGIN_SRC elisp :results silent (defun write-to-buffer ($input-string $outputbuf &optional $switchbuf) "Writes `$input-string' to the specified `output-buffer'. If @@ -3826,28 +4444,37 @@ Emacs throws me an error about the python interpreter, let’s silence it: :PROPERTIES: :CUSTOM_ID: User_Configuration-Rust-ba633575 :END: -I need to point to racer where the source code of Rust is located so I can get some documentation. This is installed with the ~rust-src~ component you can get through ~rustup~. To install it, simply run +I need to point to racer where the source code of Rust is located so I can get +some documentation. This is installed with the ~rust-src~ component you can get +through ~rustup~. To install it, simply run #+BEGIN_SRC shell :tangle no :exports code $ rustup component add rust-src #+END_SRC -Now, the source code for Rust should be included in your installation. I personally prefer to develop with Rust stable, so let’s indicate to Emacs to search for documentation in the stable sources: +Now, the source code for Rust should be included in your installation. I +personally prefer to develop with Rust stable, so let’s indicate to Emacs to +search for documentation in the stable sources: #+BEGIN_SRC emacs-lisp (setq racer-rust-src-path "~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src") #+END_SRC -Rust’s default ~cargo check~ command is already very good, however I also enjoy getting some more hints while developping, and ~clippy~ does a very good job at it. To get clippy, I need to run the following to install it: +Rust’s default ~cargo check~ command is already very good, however I also enjoy +getting some more hints while developping, and ~clippy~ does a very good job at +it. To get clippy, I need to run the following to install it: #+BEGIN_SRC shell $ rustup compontent add clippy #+END_SRC -And this will get it installed with all of my Rust toolchain, and it will be updated with it. Now, let’s indicate LSP that I want to use that instead of ~check~: +And this will get it installed with all of my Rust toolchain, and it will be +updated with it. Now, let’s indicate LSP that I want to use that instead of +~check~: #+BEGIN_SRC emacs-lisp (setq lsp-rust-analyzer-cargo-watch-command "clippy") #+END_SRC -Finally, I wish to enable ~electric-pair-mode~ and ~indent-guide-mode~ for Rust files, so let’s enable that through the use of a hook: +Finally, I wish to enable ~electric-pair-mode~ and ~indent-guide-mode~ for Rust +files, so let’s enable that through the use of a hook: #+BEGIN_SRC emacs-lisp (add-hook 'rust-mode-hook '(lambda () @@ -3860,7 +4487,8 @@ Finally, I wish to enable ~electric-pair-mode~ and ~indent-guide-mode~ for Rust :PROPERTIES: :CUSTOM_ID: User_Configuration-Scheme-e35aa50a :END: -The Scheme configuration will be very short, I just need to tell Emacs the name of the interpreter since it is not the default one: +The Scheme configuration will be very short, I just need to tell Emacs the name +of the interpreter since it is not the default one: #+BEGIN_SRC emacs-lisp (setq geiser-chicken-binary "chicken-csi") #+END_SRC @@ -3869,7 +4497,15 @@ The Scheme configuration will be very short, I just need to tell Emacs the name :PROPERTIES: :CUSTOM_ID: User_Configuration-Projectile-06e580f0 :END: -Projectile is an awesome utility which helps managing projects within Emacs. It will automatically detect version controlled directories, and will by default assume this is a project I can be working on. However, there are some directories that are version controlled that I do not want to see in my list of projects, namely all the cached AUR packages from my AUR helper, ~paru~. They are all stored in the same parent directory, so let’s ignore that. I will also make Emacs ignore all ~node_modules~ directories it could encounter. And for some reason, =~/.config/emacs= is always in my projects list (I now use XDG-compliant directories), so let’s also ignore that. +Projectile is an awesome utility which helps managing projects within Emacs. It +will automatically detect version controlled directories, and will by default +assume this is a project I can be working on. However, there are some +directories that are version controlled that I do not want to see in my list of +projects, namely all the cached AUR packages from my AUR helper, ~paru~. They +are all stored in the same parent directory, so let’s ignore that. I will also +make Emacs ignore all ~node_modules~ directories it could encounter. And for +some reason, =~/.config/emacs= is always in my projects list (I now use +XDG-compliant directories), so let’s also ignore that. #+BEGIN_SRC emacs-lisp (setq projectile-ignored-projects '("~/.cache/paru" "~/.config/emacs" "/tmp")) (add-to-list 'projectile-globally-ignored-directories "node_modules") @@ -3879,7 +4515,11 @@ Projectile is an awesome utility which helps managing projects within Emacs. It :PROPERTIES: :CUSTOM_ID: User_Configuration-Security-21d88555 :END: -This paragraph is about making Emacs and GPG as a whole (since Emacs is /always/ open on my computer) more secure. The first thing I want to make is a function that will close any buffer that contains an open ~.gpg~ file –I certainly do not want anyone to be able to read such files on my computer if I leave it even for a couple of minutes. +This paragraph is about making Emacs and GPG as a whole (since Emacs is /always/ +open on my computer) more secure. The first thing I want to make is a function +that will close any buffer that contains an open ~.gpg~ file –I certainly do not +want anyone to be able to read such files on my computer if I leave it even for +a couple of minutes. #+BEGIN_SRC emacs-lisp (defun phundrak/kill-gpg-buffers () "Kill GPG buffers." @@ -3899,9 +4539,19 @@ This paragraph is about making Emacs and GPG as a whole (since Emacs is /always/ (message "%s .gpg buffers have been autosaved and killed" buffers-killed)))) #+END_SRC -Notice the ~(shell-command "gpgconf --kill gpg-agent")~ command there: it kills ~gpg-agent~ which will always respawn each time GPG2 is invoked. That way, I know anyone trying to open a GPG file will have to insert my password when trying to do so instead of just hoping I entered it not long ago and they won’t have to. +Notice the ~(shell-command "gpgconf --kill gpg-agent")~ command there: it kills +~gpg-agent~ which will always respawn each time GPG2 is invoked. That way, I +know anyone trying to open a GPG file will have to insert my password when +trying to do so instead of just hoping I entered it not long ago and they won’t +have to. -But surely, if I only define this function and hope to call it each time I leav my computer, surely at one point I will forget to execute it before leaving. I can’t trust myself to always call it manually. Which is why I’ll ask Emacs itself to call it after it detects a minute of idling. It may become from times to times a bit of a pain, but at least I’m now sure I won’t ever have to worry about someone reading my GPG files open in Emacs while I’m out for a quick break. +But surely, if I only define this function and hope to call it each time I leav +my computer, surely at one point I will forget to execute it before leaving. I +can’t trust myself to always call it manually. Which is why I’ll ask Emacs +itself to call it after it detects a minute of idling. It may become from times +to times a bit of a pain, but at least I’m now sure I won’t ever have to worry +about someone reading my GPG files open in Emacs while I’m out for a quick +break. #+BEGIN_SRC emacs-lisp (run-with-idle-timer 60 t 'phundrak/kill-gpg-buffers) #+END_SRC @@ -3911,15 +4561,21 @@ But surely, if I only define this function and hope to call it each time I leav :CUSTOM_ID: User_Configuration-Snippets-67a32065 :HEADER-ARGS:snippet: :padline no :mkdirp yes :END: -Yasnippet’s snippets tool is extremely powerful and allows me to write very quickly code. For now, we have snippets for two modes. The files you’ll see below are exported to ~$HOME/.config/emacs/private/snippets/~ and to their respective mode directory. For instance, my ~caption~ snippet for org-mode will be exported to ~$HOME/.config/emacs/private/snippets/org-mode/caption~. +Yasnippet’s snippets tool is extremely powerful and allows me to write very +quickly code. For now, we have snippets for two modes. The files you’ll see +below are exported to ~$HOME/.config/emacs/private/snippets/~ and to their +respective mode directory. For instance, my ~caption~ snippet for org-mode will +be exported to ~$HOME/.config/emacs/private/snippets/org-mode/caption~. -Be aware that on top of these custom snippets, I also use the package [[file:awesome.org::#Autostart-f2cf42fe][yasnippet-snippets]] which provide plenty of already made snippets. +Be aware that on top of these custom snippets, I also use the package +[[file:awesome.org::#Autostart-f2cf42fe][yasnippet-snippets]] which provide plenty of already made snippets. *** Rust snippets :PROPERTIES: :CUSTOM_ID: User_Configuration-Snippets-Rust_snippets-b106fad4 :END: -I have so far two snippets, the first one is actually just a convenience to make it easier to type a ~println!~ macro than the default snippet. +I have so far two snippets, the first one is actually just a convenience to make +it easier to type a ~println!~ macro than the default snippet. #+BEGIN_SRC snippet :tangle ~/.config/emacs/private/snippets/rust-mode/println # -*- mode: snippet -*- # name: println @@ -3928,7 +4584,10 @@ I have so far two snippets, the first one is actually just a convenience to make println!("${1:{}}", $2); #+END_SRC -The second one is more interesting: it is used to create a ~new~ method for a struct, and it will try to create a function that will assign each argument passed to the method to members of the struct. It relies on the custom function [[#Custom-functions-yas-rust-new-assignments-4ad16bde][I wrote here]]. +The second one is more interesting: it is used to create a ~new~ method for a +struct, and it will try to create a function that will assign each argument +passed to the method to members of the struct. It relies on the custom function +[[#Custom-functions-yas-rust-new-assignments-4ad16bde][I wrote here]]. #+BEGIN_SRC snippet :tangle ~/.config/emacs/private/snippets/rust-mode/new # -*- mode: snippet -*- # name: new @@ -3946,7 +4605,9 @@ The second one is more interesting: it is used to create a ~new~ method for a st :PROPERTIES: :CUSTOM_ID: User_Configuration-Snippets-org-mode_snippets-Org_headers-ed14fbac :END: -The first two snippets are used to add HTML or LaTeX attributes to elements in org-mode. The third also has a similar usage, inserting a ~#+CAPTION~ header before an element, as well as the fourth which inserts a ~#+NAME~ header. +The first two snippets are used to add HTML or LaTeX attributes to elements in +org-mode. The third also has a similar usage, inserting a ~#+CAPTION~ header +before an element, as well as the fourth which inserts a ~#+NAME~ header. #+BEGIN_SRC snippet :tangle ~/.config/emacs/private/snippets/org-mode/attr_html # -*- mode: snippet -*- # name: ATTR HTML @@ -3979,7 +4640,12 @@ The first two snippets are used to add HTML or LaTeX attributes to elements in o ,#+NAME: $0 #+END_SRC -Now, the following is a bit more complex: it is meant to be used as a new org buffer is created. It will insert an org header for the title, which will default to the buffer’s name capitalized minus the dashes or underscores replaced with spaces, it will insert a default author and email based on the user’s parameters, and the date at the moment of the creation of these headers. The user can also add some tags if they wish to. +Now, the following is a bit more complex: it is meant to be used as a new org +buffer is created. It will insert an org header for the title, which will +default to the buffer’s name capitalized minus the dashes or underscores +replaced with spaces, it will insert a default author and email based on the +user’s parameters, and the date at the moment of the creation of these headers. +The user can also add some tags if they wish to. #+BEGIN_SRC snippet :tangle ~/.config/emacs/private/snippets/org-mode/header # -*- mode: snippet -*- # name: header @@ -3998,7 +4664,10 @@ Now, the following is a bit more complex: it is meant to be used as a new org bu :PROPERTIES: :CUSTOM_ID: User_Configuration-Snippets-org-mode_snippets-Org_blocks-e4dfc448 :END: -Now, Let’s write some snippets for org blocks. The first one is for a comment block, then two snippets for an unnamed and a named Elisp source block, and two others for an unnamed and a named Python source block. There are also two block for generic unnamed source blocks and generic named source blocks. +Now, Let’s write some snippets for org blocks. The first one is for a comment +block, then two snippets for an unnamed and a named Elisp source block, and two +others for an unnamed and a named Python source block. There are also two block +for generic unnamed source blocks and generic named source blocks. #+BEGIN_SRC snippet :tangle ~/.config/emacs/private/snippets/org-mode/comment_block # -*- mode: snippet -*- # name: comment block @@ -4076,7 +4745,9 @@ Now, Let’s write some snippets for org blocks. The first one is for a comment :PROPERTIES: :CUSTOM_ID: User_Configuration-Snippets-Org_misc-82223a44 :END: -Finally, there are a couple of miscellaneous org snippets that insert macros I often use in my conlanging documents. The first one inserts a phonetics macro, while the second one inserts a macro used for my Proto-Ñyqy language. +Finally, there are a couple of miscellaneous org snippets that insert macros I +often use in my conlanging documents. The first one inserts a phonetics macro, +while the second one inserts a macro used for my Proto-Ñyqy language. #+BEGIN_SRC snippet :tangle ~/.config/emacs/private/snippets/org-mode/phon # -*- mode: snippet -*- # name: phon @@ -4101,7 +4772,10 @@ Finally, there are a couple of miscellaneous org snippets that insert macros I o :PROPERTIES: :CUSTOM_ID: User_Configuration-Tramp_configuration-Docker-31573fdf :END: -It is completely possible with Tramp to connect ot a docker container and modify files inside of it. It is not supported natively, but we can add it quite easily. Be aware, I am not the author of this code, you can find its original source [[https://www.emacswiki.org/emacs/TrampAndDocker][here]]. First, let’s add the Docker protocol to Tramp: +It is completely possible with Tramp to connect ot a docker container and modify +files inside of it. It is not supported natively, but we can add it quite +easily. Be aware, I am not the author of this code, you can find its original +source [[https://www.emacswiki.org/emacs/TrampAndDocker][here]]. First, let’s add the Docker protocol to Tramp: #+BEGIN_SRC emacs-lisp (push (cons @@ -4113,7 +4787,8 @@ It is completely possible with Tramp to connect ot a docker container and modify tramp-methods) #+END_SRC -Now that the method has been added, let’s add some autocompletion for when we want to connect to a Docker container: +Now that the method has been added, let’s add some autocompletion for when we +want to connect to a Docker container: #+BEGIN_SRC emacs-lisp (defadvice tramp-completion-handle-file-name-all-completions (around dotemacs-completion-docker activate) @@ -4128,19 +4803,24 @@ Now that the method has been added, let’s add some autocompletion for when we ad-do-it)) #+END_SRC -And that’s it! it is now possible to connect to a docker container with something like ~/docker:conlangdict_server/~ as the path given in ~find-file~. +And that’s it! it is now possible to connect to a docker container with +something like ~/docker:conlangdict_server/~ as the path given in ~find-file~. *** Yadm :PROPERTIES: :CUSTOM_ID: User_Configuration-Yadm-4344fec3 :END: -~yadm~ is the utility I use for managing my dotfiles, and it is a wrapper In order to manage my dotfiles, I use the following shortcut to launch Magit Status for ~yadm~: +~yadm~ is the utility I use for managing my dotfiles, and it is a wrapper In +order to manage my dotfiles, I use the following shortcut to launch Magit Status +for ~yadm~: #+BEGIN_SRC emacs-lisp (spacemacs/declare-prefix "oy" "yadm status") (spacemacs/set-leader-keys "oy" (lambda () (interactive) (magit-status "/yadm::"))) #+END_SRC -around ~git~. Logically, it means Magit could theoretically manage my yadm repo. And it is indeed possible, according to [[https://github.com/TheLocehiliosan/yadm/blob/master/yadm.md][this page]] using TRAMP. I just need to add the following code snippet: +~yadm~ wraps around ~git~. Logically, it means Magit could theoretically manage +my yadm repo. And it is indeed possible, according to [[https://github.com/TheLocehiliosan/yadm/blob/master/yadm.md][this page]] using TRAMP. I +just need to add the following code snippet: #+BEGIN_SRC emacs-lisp (add-to-list 'tramp-methods '("yadm" @@ -4218,7 +4898,10 @@ I want to see by default how much battery my computer has, so let’s enable it: "\n")) #+END_SRC -Sometimes, some visual properties just don’t fit right for me and I need to edit them. This is the case for example for org-mode for which I want to have a mix of fixed and variable pitches. Below you can see the code that does that for me, I’ll get into more detail below this code block. +Sometimes, some visual properties just don’t fit right for me and I need to edit +them. This is the case for example for org-mode for which I want to have a mix +of fixed and variable pitches. Below you can see the code that does that for me, +I’ll get into more detail below this code block. #+BEGIN_SRC emacs-lisp :noweb yes (let ( <> @@ -4235,7 +4918,8 @@ Sometimes, some visual properties just don’t fit right for me and I need to ed :PROPERTIES: :CUSTOM_ID: User-Configuration-Visual-configuration-Better-faces-Diff-6ac98986 :END: -Apparently, diff and Magit faces do not follow the nord theme’s color scheme, so let’s redefine their background and sometimes their foreground. +Apparently, diff and Magit faces do not follow the nord theme’s color scheme, so +let’s redefine their background and sometimes their foreground. #+tblname: diff-faces | / | | | | Name | background | foreground | @@ -4248,7 +4932,8 @@ Apparently, diff and Magit faces do not follow the nord theme’s color scheme, :PROPERTIES: :CUSTOM_ID: User-Configuration-Visual-configuration-Better-faces-Mu4e-7b52d940 :END: -The nord theme is great and all, but for some reason some faces in mu4e aren’t displayed properly, such as the ~mu4e-highlight-face~. Let’s fix that! +The nord theme is great and all, but for some reason some faces in mu4e aren’t +displayed properly, such as the ~mu4e-highlight-face~. Let’s fix that! #+tblname: mu4e-faces | / | | | | Name | background | foreground | @@ -4259,7 +4944,9 @@ The nord theme is great and all, but for some reason some faces in mu4e aren’t :PROPERTIES: :CUSTOM_ID: User-Configuration-Visual-configuration-Better-faces-Org-mode-07754177 :END: -Fonts will play an important part in this, but so will colors and font size. The following code is largely based on the one found [[https://zzamboni.org/post/beautifying-org-mode-in-emacs/][on this blog post]] and [[https://lepisma.xyz/2017/10/28/ricing-org-mode/][this one]]. First here are some common properties that will be reused in faces below: +Fonts will play an important part in this, but so will colors and font size. The +following code is largely based on the one found [[https://zzamboni.org/post/beautifying-org-mode-in-emacs/][on this blog post]] and [[https://lepisma.xyz/2017/10/28/ricing-org-mode/][this one]]. +First here are some common properties that will be reused in faces below: #+tblname: org-common-faces | / | | < | | | | Name | inherit | font | height | weight | @@ -4316,7 +5003,10 @@ The package ~info-colors~ adds colors to Emacs’ info mode. Let’s enable it: :PROPERTIES: :CUSTOM_ID: User_Configuration-Miscellaneous-Prettified_symbols-da50f4a6 :END: -Just because it is pleasing to the eye, some symbols in source code get prettified into simpler symbols. Here is the list of symbols that are to be prettified. You can see in the corresponding comment what symbol will be displayed. +Just because it is pleasing to the eye, some symbols in source code get +prettified into simpler symbols. Here is the list of symbols that are to be +prettified. You can see in the corresponding comment what symbol will be +displayed. #+BEGIN_SRC emacs-lisp (setq prettify-symbols-alist '(("lambda" . 955) ; λ ("mapc" . 8614) ; ↦ diff --git a/org/config/fish.org b/org/config/fish.org index c8a9c6d..f95be47 100644 --- a/org/config/fish.org +++ b/org/config/fish.org @@ -11,9 +11,12 @@ :PROPERTIES: :CUSTOM_ID: Presentation-340195eb :END: -The file present in =~/.config/fish/config.fish= is the configuration file for the [[https://fishshell.com/][fish shell]]. It contains custom functions, environment variables and abbreviations. +The file present in =~/.config/fish/config.fish= is the configuration file for +the [[https://fishshell.com/][fish shell]]. It contains custom functions, environment variables and +abbreviations. -Just in case, we might need sometimes to declare the fish function =fish_title= as =true=, so let’s do so. +Just in case, we might need sometimes to declare the fish function =fish_title= +as =true=, so let’s do so. #+BEGIN_SRC fish function fish_title true @@ -24,7 +27,8 @@ Just in case, we might need sometimes to declare the fish function =fish_title= :PROPERTIES: :CUSTOM_ID: Fish_from_within_Emacs-360c0a74 :END: -I sometimes call fish from within emacs, with =M-x ansi-term=. In this case, the variable =TERM= needs to have the value =eterm-color=. +I sometimes call fish from within emacs, with =M-x ansi-term=. In this case, the +variable =TERM= needs to have the value =eterm-color=. #+BEGIN_SRC fish if test -n "$EMACS" set -x TERM eterm-color @@ -35,7 +39,10 @@ I sometimes call fish from within emacs, with =M-x ansi-term=. In this case, the :PROPERTIES: :CUSTOM_ID: Tramp_remote_access-72aedec2 :END: -When accessing from a remote machine our computer from Emacs, tramp needs a precise shell appearance: a simple =$= followed by a space after which to put the commands it needs to execute, and nothing else. Due to this, let’s deactivate and redefine some of the functions defining the appearance of fish. +When accessing from a remote machine our computer from Emacs, tramp needs a +precise shell appearance: a simple =$= followed by a space after which to put +the commands it needs to execute, and nothing else. Due to this, let’s +deactivate and redefine some of the functions defining the appearance of fish. #+BEGIN_SRC fish if test "$TERM" = "dumb" function fish_prompt @@ -51,7 +58,10 @@ When accessing from a remote machine our computer from Emacs, tramp needs a prec :PROPERTIES: :CUSTOM_ID: Regular_fish_shell_appearance-c3e532e1 :END: -Now, there is only one function I modify when it comes to the appearance of fish when I’m the one using it: the ~fish_greeting~ function. I use it to give me an overview of my computer’s status, including its hostname, uptime, disks usage, ram usage, swap usage, and networking. +Now, there is only one function I modify when it comes to the appearance of fish +when I’m the one using it: the ~fish_greeting~ function. I use it to give me an +overview of my computer’s status, including its hostname, uptime, disks usage, +ram usage, swap usage, and networking. #+BEGIN_SRC fish set RED '\033[0;31m' set GREEN '\033[0;32m' @@ -120,7 +130,9 @@ Now, there is only one function I modify when it comes to the appearance of fish end #+END_SRC -The theme I use for fish is [[https://github.com/oh-my-fish/theme-bobthefish][bobthefish]], which by default puts a really long timestamp to the right of the prompt. I want something shorter, so here is the variable to set, using the format specified in ~date(1)~. +The theme I use for fish is [[https://github.com/oh-my-fish/theme-bobthefish][bobthefish]], which by default puts a really long +timestamp to the right of the prompt. I want something shorter, so here is the +variable to set, using the format specified in ~date(1)~. #+BEGIN_SRC fish set -g theme_date_format "+%g-%m-%d %H:%M:%S" #+END_SRC @@ -139,12 +151,14 @@ Finally, let’s set our prompt’s theme to the Nord theme. :PROPERTIES: :CUSTOM_ID: Global_variables-1c84df8b :END: -In order to keep some other code clean, I set the ~$BROWSER~ variable so I don’t have to call my web browser directly but rather with this variable. +In order to keep some other code clean, I set the ~$BROWSER~ variable so I don’t +have to call my web browser directly but rather with this variable. #+BEGIN_SRC fish set -gx BROWSER firefox #+END_SRC -Sometimes, software will rely on =SUDO_ASKPASS= to get a GUI from which it can get the sudo password. So, let’s declare it. +Sometimes, software will rely on =SUDO_ASKPASS= to get a GUI from which it can +get the sudo password. So, let’s declare it. #+BEGIN_SRC fish set -gx SUDO_ASKPASS ~/.local/bin/askpass #+END_SRC @@ -153,7 +167,9 @@ Sometimes, software will rely on =SUDO_ASKPASS= to get a GUI from which it can g :PROPERTIES: :CUSTOM_ID: Global_variables-Development-76b3ff13 :END: -Now, let’s declare our editor of choice, EmacsClient; not Emacs itself since it will most often be just quick edits, nothing too heavy, if it is called from the ~EDITOR~ variable (from Git, for example), or from the ~VISUAL~ variable. +Now, let’s declare our editor of choice, EmacsClient; not Emacs itself since it +will most often be just quick edits, nothing too heavy, if it is called from the +~EDITOR~ variable (from Git, for example), or from the ~VISUAL~ variable. #+BEGIN_SRC fish set -gx EDITOR emacsclient -c set -gx VISUAL emacsclient -c @@ -174,13 +190,16 @@ Still related to Dart and Flutter development, set -gx CHROME_EXECUTABLE /usr/bin/chromium #+END_SRC -Next, we have two variables from Deno, the Node.js destroyer. Its base directory will be set in my XDG config directory, and its binaries will be located in my local binaries directory (see below). +Next, we have two variables from Deno, the Node.js destroyer. Its base directory +will be set in my XDG config directory, and its binaries will be located in my +local binaries directory (see below). #+BEGIN_SRC fish set -gx DENO_DIR $HOME/.config/deno set -gx DENO_INSTALL_ROOT $HOME/.local/bin/deno #+END_SRC -Finally, some development packages require the =PKG_CONFIG_PATH= to be set, so let’s do so. +Finally, some development packages require the =PKG_CONFIG_PATH= to be set, so +let’s do so. #+BEGIN_SRC fish set -gx PKG_CONFIG_PATH /usr/local/lib/pkgconfig/ $PKG_CONFIG_PATH #+END_SRC @@ -189,7 +208,11 @@ Finally, some development packages require the =PKG_CONFIG_PATH= to be set, so l :PROPERTIES: :CUSTOM_ID: Global_variables-$PATH-e1320303 :END: -A variable available with the fish shell is ~fish_user_paths~ which lists custom paths to binaries specified by the user. Using this variable ensures they are included in the ~$PATH~ variable only once without the need to set it directly. For instance, my ~PATH~ variable needs Rust’s Cargo’s binaries, Go’s binaries, my own executables, and some more. +A variable available with the fish shell is ~fish_user_paths~ which lists custom +paths to binaries specified by the user. Using this variable ensures they are +included in the ~$PATH~ variable only once without the need to set it directly. +For instance, my ~PATH~ variable needs Rust’s Cargo’s binaries, Go’s binaries, +my own executables, and some more. #+NAME: extra-paths | additional path | what it leads to | @@ -247,7 +270,16 @@ the terminal window will come back. :PROPERTIES: :CUSTOM_ID: Abbreviations-System_monitoring-bd909755 :END: -Here I have some abbreviations which are quite useful when performing some system monitoring. With =df=, we can get an overview of our filesystem usage, while with =diskspace= we get some more precise information. =meminfo= is a call to =free= with sane defaults, and similar to =meminfo=, we also have =gpumeminfo= so we can get a quick look at the memory-related logs of our X session. I also declared =cpuinfo= an alias of =lscpu= in order to keep consistent with =meminfo=. =pscpu= gives us information on what the CPU is running right now, and =pscpu10= limits that to the top 10 threads. Similarly, =psmem= gives us information on the memory usage of the current threads, and =psmem10= only the ten most important threads in terms of memory usage. +Here I have some abbreviations which are quite useful when performing some +system monitoring. With =df=, we can get an overview of our filesystem usage, +while with =diskspace= we get some more precise information. =meminfo= is a call +to =free= with sane defaults, and similar to =meminfo=, we also have +=gpumeminfo= so we can get a quick look at the memory-related logs of our X +session. I also declared =cpuinfo= an alias of =lscpu= in order to keep +consistent with =meminfo=. =pscpu= gives us information on what the CPU is +running right now, and =pscpu10= limits that to the top 10 threads. Similarly, +=psmem= gives us information on the memory usage of the current threads, and +=psmem10= only the ten most important threads in terms of memory usage. #+NAME: mgmt-abbr | abbreviation | command | |--------------+--------------------------------------------| @@ -270,13 +302,17 @@ Here I have some abbreviations which are quite useful when performing some syste :PROPERTIES: :CUSTOM_ID: Abbreviations-System_management_(packages_and_services)-7249fbb7 :END: -I added some of these abbreviations due to how often I have to write the whole thing. +I added some of these abbreviations due to how often I have to write the whole +thing. *** Package management :PROPERTIES: :CUSTOM_ID: Abbreviations-System_management_(packages_and_services)-Package_management-efbcdf0f :END: -The first command is =remove= which removes a package from my system, as well as its dependencies no longer needed. =p=. =pacman='s or =paru='s. This is why I simply type =purge=. And if I want to simply seach among the =pacman= repos, I can type =search=. Otherwise, if I want to include AUR results, I’ll use =paru=. +The first command is =remove= which removes a package from my system, as well as +its dependencies no longer needed. =p=. =pacman='s or =paru='s. This is why I +simply type =purge=. And if I want to simply seach among the =pacman= repos, I +can type =search=. Otherwise, if I want to include AUR results, I’ll use =paru=. #+NAME: pm-abbr | abbreviation | command | @@ -292,7 +328,9 @@ The first command is =remove= which removes a package from my system, as well as :PROPERTIES: :CUSTOM_ID: Abbreviations-System_management_(packages_and_services)-Service_management-8c5ae482 :END: -I don’t have the muscle memory of =systemctl=. So instead, I simply type =c= when I want to do something user service related. And if I want to manipulate system services, I can instead type a simple capital =S=. +I don’t have the muscle memory of =systemctl=. So instead, I simply type =c= +when I want to do something user service related. And if I want to manipulate +system services, I can instead type a simple capital =S=. #+NAME: service-abbr | abbreviation | command | |--------------+------------------| @@ -307,13 +345,15 @@ I don’t have the muscle memory of =systemctl=. So instead, I simply type =c= w :PROPERTIES: :CUSTOM_ID: Abbreviations-Development-d6050ca4 :END: -A good amount of these commands are development related, especially when it comes to compilation or Docker. +A good amount of these commands are development related, especially when it +comes to compilation or Docker. *** CMake :PROPERTIES: :CUSTOM_ID: Abbreviations-Development-CMake-f2951675 :END: -I have the following abbreviations so I can quickly run CMake and create a configuration for debug or release profiles. +I have the following abbreviations so I can quickly run CMake and create a +configuration for debug or release profiles. #+NAME: abbr-cmake | abbreviation | command | |--------------+----------------------------------| @@ -329,7 +369,8 @@ Here is the corresponding fish configuration: :PROPERTIES: :CUSTOM_ID: Abbreviations-Development-Docker-2d0a1288 :END: -And of course, when it comes to Docker Compose, I don't have time to write the full command, so I use these instead. +And of course, when it comes to Docker Compose, I don't have time to write the +full command, so I use these instead. #+NAME: abbr-docker | abbreviation | command | |--------------+------------------------------| @@ -353,7 +394,13 @@ Here is the corresponding fish configuration: :PROPERTIES: :CUSTOM_ID: Abbreviations-Development-Text_editors-5a23df47 :END: -I greatly prefer to use Emacsclient as my main text editor; Emacs has basically all I need. So, it's only normal I have an abbreviation to launch a new instance of it. If launched in the terminal, I’ll usually want Emacs to be displayed in CLI mode and not in GUI mode, otherwise I would invoke it with my WM’s shortcut. I also wish to completely stop using other text editors, such as ~vi~, ~vim~, ~nano~ and ~ed~, so let's all add their command as an abbreviation for Emacs. In case we want to launch Emacs in GUI mode anyways, ~egui~ is available too. +I greatly prefer to use Emacsclient as my main text editor; Emacs has basically +all I need. So, it's only normal I have an abbreviation to launch a new instance +of it. If launched in the terminal, I’ll usually want Emacs to be displayed in +CLI mode and not in GUI mode, otherwise I would invoke it with my WM’s shortcut. +I also wish to completely stop using other text editors, such as ~vi~, ~vim~, +~nano~ and ~ed~, so let's all add their command as an abbreviation for Emacs. In +case we want to launch Emacs in GUI mode anyways, ~egui~ is available too. #+NAME: abbr-text-ed | abbreviation | command | @@ -374,7 +421,8 @@ Here is the corresponding fish configuration: :PROPERTIES: :CUSTOM_ID: Abbreviations-Development-Compilation-dd066050 :END: -By default, I set ~clang~, ~clang++~, ~gcc~ and ~g++~ to the latest standard and with the ~-Wall~ flag activated. +By default, I set ~clang~, ~clang++~, ~gcc~ and ~g++~ to the latest standard and +with the ~-Wall~ flag activated. #+NAME: abbr-comp | abbreviation | command | |--------------+----------------------| @@ -392,7 +440,9 @@ Here is the corresponding fish configuration: :PROPERTIES: :CUSTOM_ID: Abbreviations-Development-Git-5e5055c1 :END: -And let's face it: we all at one point just wanted to commit our code without thinking about the message, to just get over with it. Don't worry, I got you covered. +And let's face it: we all at one point just wanted to commit our code without +thinking about the message, to just get over with it. Don't worry, I got you +covered. #+NAME: abbr-git | abbreviation | command | |--------------+-----------------------------------------------------| @@ -407,7 +457,11 @@ Here is the corresponding fish configuration: :PROPERTIES: :CUSTOM_ID: Abbreviations-LaTeX-76865eb9 :END: -Yes, although I use org-mode, I still have some use for LaTeX, especially when it comes to PDF exports of my org files. Hence why I use the LaTeX package manager. It is recommended to use ~tllocalmgr~ instead of ~tlmgr~, but I can never remember the command, and the latter is faster to type, so time for an abbreviation. Same goes for ~texhash~ which must be run as sudo. +Yes, although I use org-mode, I still have some use for LaTeX, especially when +it comes to PDF exports of my org files. Hence why I use the LaTeX package +manager. It is recommended to use ~tllocalmgr~ instead of ~tlmgr~, but I can +never remember the command, and the latter is faster to type, so time for an +abbreviation. Same goes for ~texhash~ which must be run as sudo. #+NAME: latex-abbr | abbreviation | command | |--------------+--------------| @@ -423,7 +477,14 @@ Here is the corresponding fish configuration: :PROPERTIES: :CUSTOM_ID: Abbreviations-Some_security_measures-489cb521 :END: -Some commands can be quite dangerous when not used properly, which is why I added default flags and options so I can get warnings before things get ugly. The =-i= and =-I= add prompts in case we might not want to do what we asked the shell to do. Notice =lns= which creates symlinks, =rmd= which removes directories, =rmf= which forces deletion, and =rmdf= which forces the delition of a directory. Notice also the =--preserve-root= which will prevent me from accidentally removing the root folder. I added the same option to =chgrp=, =chmod=, and =chown=. +Some commands can be quite dangerous when not used properly, which is why I +added default flags and options so I can get warnings before things get ugly. +The =-i= and =-I= add prompts in case we might not want to do what we asked the +shell to do. Notice =lns= which creates symlinks, =rmd= which removes +directories, =rmf= which forces deletion, and =rmdf= which forces the delition +of a directory. Notice also the =--preserve-root= which will prevent me from +accidentally removing the root folder. I added the same option to =chgrp=, +=chmod=, and =chown=. #+NAME: sec-abbr | abbreviation | command | |--------------+--------------------------| @@ -448,7 +509,12 @@ Here is the corresponding fish configuration: :PROPERTIES: :CUSTOM_ID: Abbreviations-Typos-370bbb27 :END: -Let's admit it, we all make typos from time to time in the shell, and some are recurrent enough we make abbreviations or aliases of the correct command. Well, I have some of my abbreviations which were make exactly because of this. Sometimes for some reasons, my brain makes me write ~clean~ instead of ~clear~. So, let's just replace the former by the latter. I'm also very bad at typing ~exit~. And sometimes I suck at typing ~htop~. +Let's admit it, we all make typos from time to time in the shell, and some are +recurrent enough we make abbreviations or aliases of the correct command. Well, +I have some of my abbreviations which were make exactly because of this. +Sometimes for some reasons, my brain makes me write ~clean~ instead of ~clear~. +So, let's just replace the former by the latter. I'm also very bad at typing +~exit~. And sometimes I suck at typing ~htop~. #+NAME: typo-abbr | abbreviation | command | |--------------+---------| @@ -466,33 +532,42 @@ Here is the corresponding fish configuration: :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-c2631eb6 :END: -Finally, some miscellaneous abbreviations that don't really fit into any of the above categories. +Finally, some miscellaneous abbreviations that don't really fit into any of the +above categories. *** Media :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-Media-e4b85d56 :END: -Here you will find various commands related to media in general. the first one is a command to play some chillhop from the [[https://www.youtube.com/user/Chillhopdotcom][Chillhop YouTube channel]]'s livestream. +Here you will find various commands related to media in general. the first one +is a command to play some chillhop from the [[https://www.youtube.com/user/Chillhopdotcom][Chillhop YouTube channel]]'s +livestream. #+BEGIN_SRC fish abbr chill 'mpv --force-window=no --no-video "https://www.youtube.com/user/Chillhopdotcom/live" &' #+END_SRC -When it comes to mpv, I do not want to force it to open a graphical window if for example I want to listen to an audio file. I also do not want any border on that window. So, I declared this abbreviation. +When it comes to mpv, I do not want to force it to open a graphical window if +for example I want to listen to an audio file. I also do not want any border on +that window. So, I declared this abbreviation. #+BEGIN_SRC fish abbr mpv 'devour mpv --no-border --force-window=no' #+END_SRC -When I want to download a song from YouTube, I'll just use the command ~flac videoIdentifier~ to get it through ~youtube-dl~. +When I want to download a song from YouTube, I'll just use the command ~flac +videoIdentifier~ to get it through ~youtube-dl~. #+BEGIN_SRC fish abbr flac 'youtube-dl -x --audio-format flac --audio-quality 0 -o "~/Music/%(uploader)s/%(title)s.%(ext)s"' #+END_SRC -Some sane default options for ~sxiv~, a simple X image Viewer. This includes playing GIFs and not displaying the filename below. Sxiv will also open in fullscreen and will fit the displayed image to the frame. +Some sane default options for ~sxiv~, a simple X image Viewer. This includes +playing GIFs and not displaying the filename below. Sxiv will also open in +fullscreen and will fit the displayed image to the frame. #+BEGIN_SRC fish - abbr sxiv 'devour sxiv -abfs f' + abbr sxiv 'sxiv -abfs f' #+END_SRC -Finally, let's declare the following abbreviation that will launch an mpv instance displaying my webcam: +Finally, let's declare the following abbreviation that will launch an mpv +instance displaying my webcam: #+BEGIN_SRC fish abbr webcam 'devour mpv --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0' #+END_SRC @@ -501,7 +576,9 @@ Finally, let's declare the following abbreviation that will launch an mpv instan :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-Sudo-aef0214a :END: -First, I make it so that ~sudo~ comes with the ~-A~ switch in order to call my custom graphical script for getting my password (see [[file:bin.org::#Askpass-d0d7a8c0][askpass]]). I also made it so ~please~ is an equivalent to ~sudo -A~ as a joke. +First, I make it so that ~sudo~ comes with the ~-A~ switch in order to call my +custom graphical script for getting my password (see [[file:bin.org::#Askpass-d0d7a8c0][askpass]]). I also made it so +~please~ is an equivalent to ~sudo -A~ as a joke. #+BEGIN_SRC fish abbr please 'sudo -A' #+END_SRC @@ -510,7 +587,8 @@ First, I make it so that ~sudo~ comes with the ~-A~ switch in order to call my c :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-History-a2124b23 :END: -I also find it more intuitive and faster to just write ~hist~ instead of ~history~, so let's declare that. +I find it more intuitive and faster to just write ~hist~ instead of ~history~, +so let's declare that. #+BEGIN_SRC fish abbr hist history #+END_SRC @@ -519,7 +597,11 @@ I also find it more intuitive and faster to just write ~hist~ instead of ~histor :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-Compression-4fd4ffef :END: -It seems it's just like many other people, but I cannot for the life of me remember the syntax of ~tar~. So, I made the following abbreviations, and one day hopefully, after seeing the abbreviations' expansion over and over I'll remember the command like I did for the abbreviation of ~remove~ (see [[#Abbreviations-System_management_(packages_and_services)-Package_management-efbcdf0f][Package management]]). +It seems it's just like many other people, but I cannot for the life of me +remember the syntax of ~tar~. So, I made the following abbreviations, and one +day hopefully, after seeing the abbreviations' expansion over and over I'll +remember the command like I did for the abbreviation of ~remove~ (see [[#Abbreviations-System_management_(packages_and_services)-Package_management-efbcdf0f][Package +management]]). #+NAME: tar-abbr | abbreviation | command | |--------------+-----------| @@ -548,7 +630,8 @@ It seems it's just like many other people, but I cannot for the life of me remem :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-Network_Management-0b7fc91d :END: -First, we have just =nmcli= with sane default options, that is a pretty output with colors. +First, we have just =nmcli= with sane default options, that is a pretty output +with colors. #+BEGIN_SRC fish abbr nmcli 'nmcli -p -c auto' #+END_SRC @@ -557,7 +640,11 @@ First, we have just =nmcli= with sane default options, that is a pretty output w :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-NordVPN-09438638 :END: -Next, we have some NordVPN-related shortcuts. The first one is a simple abbreviation to =nordvpn=. The second one is a shortcut to connect to a server, and to disconnect from the current server. I also have a couple of shortcuts to quickly connect to some preselected countries, mainly France, Germany, Japan and the US. +Next, we have some NordVPN-related shortcuts. The first one is a simple +abbreviation to =nordvpn=. The second one is a shortcut to connect to a server, +and to disconnect from the current server. I also have a couple of shortcuts to +quickly connect to some preselected countries, mainly France, Germany, Japan and +the US. #+NAME: nordvpn-abbr | abbreviation | command | |--------------+-------------------------| diff --git a/org/config/index.org b/org/config/index.org index 7391337..d7e697f 100644 --- a/org/config/index.org +++ b/org/config/index.org @@ -9,9 +9,12 @@ :PROPERTIES: :CUSTOM_ID: Presentation-981f2f04 :END: -This is my collection of dotfiles for my daily GNU/Linux environment, tweaked to my liking. If you wish to get the same setup as mine, follow the instructions below. +This is my collection of dotfiles for my daily GNU/Linux environment, tweaked to +my liking. If you wish to get the same setup as mine, follow the instructions +below. -For starters, here is the link to all the pages on my website that you might find interesting. I’ll describe them in more details below. +For starters, here is the link to all the pages on my website that you might +find interesting. I’ll describe them in more details below. - [[file:installation.org][Arch Linux bootstrap script]] - [[file:awesome.org][AwesomeWM configuration]] - [[file:bin.org][Custom scripts]] @@ -26,11 +29,21 @@ For starters, here is the link to all the pages on my website that you might fin - [[file:rustfmt.org][Rustfmt configuration]] - [[file:tmux.org][Tmux configuration]] -As you can see, I personally use [[https://fishshell.com/][fish]] as my shell of choice, and [[https://www.gnu.org/software/emacs/][Emacs]] 28.0 (using the ~native-comp~ branch) using [[http://spacemacs.org][Spacemacs]] (still with Emacs keybinding in Insert mode but with Evil in Normal mode) as my main text editor. +As you can see, I personally use [[https://fishshell.com/][fish]] as my shell of choice, and [[https://www.gnu.org/software/emacs/][Emacs]] 28.0 +(using the ~native-comp~ branch) using [[http://spacemacs.org][Spacemacs]] (still with Emacs keybinding in +Insert mode but with Evil in Normal mode) as my main text editor. -When it comes to my graphical UI, I do not have any desktop environment. Instead, I have a tiling window manager, [[https://awesomewm.org/][Awesome]]. I used to use [[https://github.com/Airblader/i3][i3-gaps]], an [[https://i3wm.org/][i3]] fork by [[https://github.com/Airblader/i3][Airblader]], with which I used [[https://polybar.github.io/][Polybar]] as well as [[https://github.com/dylanaraps/pywal][pywal]] to define my system’s color scheme. But now, as said above, I prefer to use Awesome. It has a built-in status bar which I use, and I settled on the dark [[https://www.nordtheme.com/][Nord theme]] for pretty much everything I use. +When it comes to my graphical UI, I do not have any desktop environment. +Instead, I have a tiling window manager, [[https://awesomewm.org/][Awesome]]. I used to use [[https://github.com/Airblader/i3][i3-gaps]], an [[https://i3wm.org/][i3]] +fork by [[https://github.com/Airblader/i3][Airblader]], with which I used [[https://polybar.github.io/][Polybar]] as well as [[https://github.com/dylanaraps/pywal][pywal]] to define my +system’s color scheme. But now, as said above, I prefer to use Awesome. It has a +built-in status bar which I use, and I settled on the dark [[https://www.nordtheme.com/][Nord theme]] for pretty +much everything I use. -Finally, you can find my configuration for my ErgodoxEZ keyboard [[https://configure.ergodox-ez.com/ergodox-ez/layouts/5WrVw/latest/0][here]]. It is optimized for usage with the Bépo layout set as a software layout. It has also a layer set to emulate a Qwerty layout when using the Bépo software layout due to some games that do not offer to remap keys (I’m looking at you, Among Us). +Finally, you can find my configuration for my ErgodoxEZ keyboard [[https://configure.ergodox-ez.com/ergodox-ez/layouts/5WrVw/latest/0][here]]. It is +optimized for usage with the Bépo layout set as a software layout. It has also a +layer set to emulate a Qwerty layout when using the Bépo software layout due to +some games that do not offer to remap keys (I’m looking at you, Among Us). * Features :PROPERTIES: @@ -38,9 +51,15 @@ Finally, you can find my configuration for my ErgodoxEZ keyboard [[https://confi :END: - Emacs configuration perfectly tailored for my own use - Beautiful and comfy i3 and polybar configuration -- And enough information below to get basically the same distro install as I have on my main computer and my travel laptop. +- And enough information below to get basically the same distro install as I + have on my main computer and my travel laptop. -Most of the org files you will find in this repos are the actual source code of much of my config files. For instance, the bootstrap found in [[file:installation.org][installation.org]] exports almost all of its code snippets to [[file:.config/yadm/bootstrap][.config/yadm/bootstrap]] thanks to =M-x org-babel-tangle= from within Emacs. Below I will also present and comment some of my short config files which do not deserve to have a full org file dedicated to them. +Most of the org files you will find in this repos are the actual source code of +much of my config files. For instance, the bootstrap found in [[file:installation.org][installation.org]] +exports almost all of its code snippets to [[file:.config/yadm/bootstrap][.config/yadm/bootstrap]] thanks to =M-x +org-babel-tangle= from within Emacs. Below I will also present and comment some +of my short config files which do not deserve to have a full org file dedicated +to them. ** Tiling Window Managers :PROPERTIES: @@ -50,19 +69,25 @@ Most of the org files you will find in this repos are the actual source code of :PROPERTIES: :CUSTOM_ID: Features-Tiling_Window_Managers-AwesomeWM-2eac61a9 :END: -AwesomeWM is the TWM I use the most on my computer between itself and i3. My configuration for it is documented in detail in its corresponding document, which you can find [[file:awesome.org][here]]. +AwesomeWM is the TWM I use the most on my computer between itself and i3. My +configuration for it is documented in detail in its corresponding document, +which you can find [[file:awesome.org][here]]. *** i3 configuration (Deprecated) :PROPERTIES: :CUSTOM_ID: Features-Tiling_Window_Managers-i3_configuration-9c92e43c :END: -The i3 configuration is detailed in its corresponding README which you can find [[file:i3.org][here]]. Be aware I do not use i3 anymore, and I will not update it until I may someday use it again. This was deprecated on August 22nd, 2020. +The i3 configuration is detailed in its corresponding README which you can find +[[file:i3.org][here]]. Be aware I do not use i3 anymore, and I will not update it until I may +someday use it again. This was deprecated on August 22nd, 2020. **** Polybar config (Deprecated) :PROPERTIES: :CUSTOM_ID: Features-Polybar_config_(Deprecated)-c8f95774 :END: -My annotated polybar config can be found [[file:polybar.org][here]], if you wish to use it. Be aware I do not use polybar anymore, and I will not update it until I may someday use it again. This was deprecated on August 22nd, 2020. +My annotated polybar config can be found [[file:polybar.org][here]], if you wish to use it. Be aware I +do not use polybar anymore, and I will not update it until I may someday use it +again. This was deprecated on August 22nd, 2020. ** Theme and graphical tweaks :PROPERTIES: @@ -81,7 +106,9 @@ My annotated polybar config can be found [[file:polybar.org][here]], if you wish :HEADER-ARGS: :mkdirp yes :tangle ~/.gtkrc-2.0 :CUSTOM_ID: Features-Graphical_tweaks-GTK_Settings-GTK2-General_configuration-eb1f1f3c :END: -This file is tangled at ~$HOME/.gtkrc-2.0~. This is an equivalent for the GTK3 configuration file you will see below, and it shares most of its settings. First, let’s select the Nordic theme for GTK2. Let’s also set the icon theme. +This file is tangled at ~$HOME/.gtkrc-2.0~. This is an equivalent for the GTK3 +configuration file you will see below, and it shares most of its settings. +First, let’s select the Nordic theme for GTK2. Let’s also set the icon theme. #+BEGIN_SRC conf-unix # -*- mode: unix-config -*- gtk-theme-name="Nordic" @@ -111,12 +138,14 @@ This changes the shortcuts in menu, let’s also make the menus snappier. [Filechooser Settings] #+END_SRC -The first option alows me to open the file chooser in the current working directory: +The first option alows me to open the file chooser in the current working +directory: #+BEGIN_SRC conf-unix StartupMode=cwd #+END_SRC -Next, setting the location mode to ~path-bar~ will show the path as buttons that can be clicked rather than the full path. +Next, setting the location mode to ~path-bar~ will show the path as buttons that +can be clicked rather than the full path. #+BEGIN_SRC conf-unix LocationMode=path-bar #+END_SRC @@ -131,7 +160,8 @@ And we'll also see the size of the visible files. ShowSizeColumn=true #+END_SRC -Now, let’s choose the geometry of our file picker. These two first lines set where the file picker appears: +Now, let’s choose the geometry of our file picker. These two first lines set +where the file picker appears: #+BEGIN_SRC conf-unix GeometryX=566 GeometryY=202 @@ -143,7 +173,8 @@ And these two describe the size of the window: GeometryHeight=400 #+END_SRC -With these two lines, we set how our files are sorted: by name, and in the ascending order. +With these two lines, we set how our files are sorted: by name, and in the +ascending order. #+BEGIN_SRC conf-unix SortColumn=name SortOrder=ascending @@ -154,7 +185,8 @@ Our default view mode is a list of files: ViewMode=list-view #+END_SRC -And finally, setting our icon view scale to ~-1~ sets the icon view to the max size. +And finally, setting our icon view scale to ~-1~ sets the icon view to the max +size. #+BEGIN_SRC conf-unix IconViewScale=-1 #+END_SRC @@ -164,12 +196,15 @@ And finally, setting our icon view scale to ~-1~ sets the icon view to the max s :HEADER-ARGS: :mkdirp yes :tangle ~/.config/gtk-3.0/settings.ini :CUSTOM_ID: Features-Graphical_tweaks-GTK_Settings-GTK3-3d6cba86 :END: -The following file helps me choosing the aspect of various GTK+ 3 software, including their theme and icons. First, let’s declare the header: +The following file helps me choosing the aspect of various GTK+ 3 software, +including their theme and icons. First, let’s declare the header: #+BEGIN_SRC conf-unix [Settings] #+END_SRC -Now, let’s hint to GTK that I prefer dark themes. This can have an influence also on some websites that can detect this preference and therefore set their own theme to dark by themselves. +Now, let’s hint to GTK that I prefer dark themes. This can have an influence +also on some websites that can detect this preference and therefore set their +own theme to dark by themselves. #+BEGIN_SRC conf-unix gtk-application-prefer-dark-theme = true #+END_SRC @@ -198,7 +233,8 @@ Now, the general theme for GTK3 is Nordic. # gtk-xft-rgba=rgb #+END_SRC -Since window decorations are handled by my WMs, I will leave this variable empty. +Since window decorations are handled by my WMs, I will leave this variable +empty. #+BEGIN_SRC conf-unix gtk-decoration-layout= #+END_SRC @@ -207,14 +243,18 @@ Since window decorations are handled by my WMs, I will leave this variable empty :PROPERTIES: :CUSTOM_ID: Features-Graphical_tweaks-Picom-b5b9a4dd :END: -Picom is a standalone compositor for Xorg, and the successor to Compton, itself successor to xcompmgr-dana, itself a fork of xcompmgr. You can find my Picom configuration [[file:picom.org][here]]. +Picom is a standalone compositor for Xorg, and the successor to Compton, itself +successor to xcompmgr-dana, itself a fork of xcompmgr. You can find my Picom +configuration [[file:picom.org][here]]. *** Xresources :PROPERTIES: :HEADER-ARGS: :mkdirp yes :tangle ~/.Xresources :exports code :CUSTOM_ID: Features-Graphical_tweaks-Xresources-8b622de1 :END: -My Xresources file is very short. Indeed, it only contains two lines which are dedicated to my =st= terminal to set its font and shell. The font is set as follows. +My Xresources file is very short. Indeed, it only contains two lines which are +dedicated to my =st= terminal to set its font and shell. The font is set as +follows. #+BEGIN_SRC conf st.font: Fantasque Sans Mono:size=10:antialias=true #+END_SRC @@ -224,7 +264,8 @@ I can also set the transparency of st (my terminal emulator) like so: st.alpha: 0.66 #+END_SRC -Next is the declaration of my color theme. It is based on the [[https://www.nordtheme.com/][Nord]] theme, from their [[https://github.com/arcticicestudio/nord-xresources/][Git repository]]. +Next is the declaration of my color theme. It is based on the [[https://www.nordtheme.com/][Nord]] theme, from +their [[https://github.com/arcticicestudio/nord-xresources/][Git repository]]. #+BEGIN_SRC conf #define nord0 #2E3440 #define nord1 #3B4252 @@ -275,18 +316,23 @@ Next is the declaration of my color theme. It is based on the [[https://www.nord :PROPERTIES: :CUSTOM_ID: Features-Text_and_source_code_editing-Emacs_configuration-ef937102 :END: -Emacs is my main text editor, which I use for almost everything. Because, you know… +Emacs is my main text editor, which I use for almost everything. Because, you +know… #+begin_quote Emacs is a great operating system, it just lacks a good text editor. #+end_quote -You can find my Emacs config, based on Spacemacs, in my [[https://labs.phundrak.com/phundrak/dotfiles/src/branch/master/.spacemacs][.spacemacs]] file, and my user configuration in my [[file:emacs.org][emacs.org]] file. +You can find my Emacs config, based on Spacemacs, in my [[https://labs.phundrak.com/phundrak/dotfiles/src/branch/master/.spacemacs][.spacemacs]] file, and my +user configuration in my [[file:emacs.org][emacs.org]] file. *** Nano (deprecated) :PROPERTIES: :CUSTOM_ID: Features-Text_and_source_code_editing-Nano-a9d4839f :END: -Although it is a very simple piece of software, nano does offer some customization. Mine can be found in my [[file:~/org/config-website/nano.org][nano.org]] file. Be aware I do not use nano anymore, and I will not update it until I may someday use it again. This was deprecated on August 28th, 2020. +Although it is a very simple piece of software, nano does offer some +customization. Mine can be found in my [[file:~/org/config-website/nano.org][nano.org]] file. Be aware I do not use nano +anymore, and I will not update it until I may someday use it again. This was +deprecated on August 28th, 2020. *** Rustfmt :PROPERTIES: @@ -298,7 +344,12 @@ You can find my Rustfmt configuration [[file:rustfmt.org][here]]. :PROPERTIES: :CUSTOM_ID: Features-Custom_scripts_in_=PATH=-043e8c8e :END: -I have written some scripts that help me daily accomplish some simple tasks, like mounting and unmounting a drive or Android device, an emoji picker, a utility to set up my Wacom tablet, and so on. You can find them stored in my [[file:bin.org][bin.org]] file along with their detailed explanation in the README placed in the same folder —which is actually their source code once the org-mode file gets tangled. +I have written some scripts that help me daily accomplish some simple tasks, +like mounting and unmounting a drive or Android device, an emoji picker, a +utility to set up my Wacom tablet, and so on. You can find them stored in my +[[file:bin.org][bin.org]] file along with their detailed explanation in the README placed in the +same folder —which is actually their source code once the org-mode file gets +tangled. ** Terminal configuration :PROPERTIES: @@ -308,13 +359,15 @@ I have written some scripts that help me daily accomplish some simple tasks, lik :PROPERTIES: :CUSTOM_ID: Features-Fish_configuration_with_useful_abbreviations-c71ffba0 :END: -You can also find in my Fish shell configuration in my [[file:~/org/config-website/fish.org][fish.org]] file, which contains my usual abbreviations. +You can also find in my Fish shell configuration in my [[file:~/org/config-website/fish.org][fish.org]] file, which +contains my usual abbreviations. *** Tmux configuration :PROPERTIES: :CUSTOM_ID: Features-Tmux_configuration-ce76e030 :END: -You can find my tmux configuration in [[file:tmux.org][tmux.org]]. It depends on the submodule [[https://github.com/gpakosz/.tmux.git][.tmux]] by [[https://pempek.net/][Gregory Pakosz]]. +You can find my tmux configuration in [[file:tmux.org][tmux.org]]. It depends on the submodule +[[https://github.com/gpakosz/.tmux.git][.tmux]] by [[https://pempek.net/][Gregory Pakosz]]. ** And some minor configuration files :PROPERTIES: @@ -340,12 +393,16 @@ This file gets inserted automatically at the end of my emails. :HEADER-ARGS: :mkdirp yes :tangle ~/.gitignore_global :CUSTOM_ID: Features-And_some_minor_configuration_files-Global_gitignore-42467108 :END: -Sometimes, there are some lines that always reappear in gitignores. So, instead of always adding them, let git now that some elements are to be ignored by default, hence the [[file:.gitignore_global][~/.gitignore_global]] file. First, we don’t want nano’s backup files. +Sometimes, there are some lines that always reappear in gitignores. So, instead +of always adding them, let git now that some elements are to be ignored by +default, hence the [[file:.gitignore_global][~/.gitignore_global]] file. First, we don’t want nano’s backup +files. #+BEGIN_SRC text ~* #+END_SRC -And object files and output binaries generated by =gcc= and the likes aren’t welcome either. +And object files and output binaries generated by =gcc= and the likes aren’t +welcome either. #+BEGIN_SRC text ,*.out ,*.o @@ -355,7 +412,14 @@ And object files and output binaries generated by =gcc= and the likes aren’t w :PROPERTIES: :CUSTOM_ID: Features-And-some-minor-configuration-files-Paru-1f3ef49e :END: -~paru~ is an AUR helper for Arch Linux which aims to be a replacement for ~yay~. A couple of the options you will see below aim at restoring the behavior of ~yay~ in ~paru~. I also activated the sudo loop so I don’t have to enter my password if one package takes too much time to compile and/or compress. I know it can be a security issue if someone ever get access to my computer while paru is running, but if it ever happens it will be already concerning enough they managed to. I also make use of [[file:bin.org::#Emacs-stuff-Dired-2eeca9da][my custom script dired]] so I can use Emacs’ Dired as the file manager for ~paru~. +~paru~ is an AUR helper for Arch Linux which aims to be a replacement for ~yay~. +A couple of the options you will see below aim at restoring the behavior of +~yay~ in ~paru~. I also activated the sudo loop so I don’t have to enter my +password if one package takes too much time to compile and/or compress. I know +it can be a security issue if someone ever get access to my computer while paru +is running, but if it ever happens it will be already concerning enough they +managed to. I also make use of [[file:bin.org::#Emacs-stuff-Dired-2eeca9da][my custom script dired]] so I can use Emacs’ Dired +as the file manager for ~paru~. #+BEGIN_SRC conf-space :tangle ~/.config/paru/paru.conf [options] BottomUp @@ -372,37 +436,21 @@ And object files and output binaries generated by =gcc= and the likes aren’t w FileManager = dired #+END_SRC -* Dependencies -:PROPERTIES: -:CUSTOM_ID: Dependencies-ef5057dd -:END: -Of course, some dependencies are needed for my dotfiles to work well. Here is a non-exhaustive list of software needed by these configuration files: -- [[https://www.gnu.org/software/emacs/][GNU/Emacs]] >= 26.2 - - [[http://spacemacs.org][Spacemacs]] (develop branch) - - My [[https://labs.phundrak.com/phundrak/conlang-layer][conlanging layer]] - - [[https://github.com/venmos/w3m-layer][Venmos]]’ [[https://github.com/venmos/w3m-layer][w3m layer]] -- The [[https://fishshell.com/][Fish shell]], using [[https://github.com/jorgebucaran/fisher][fisher]] -- [[https://lukesmith.xyz/][Luke Smith]]’s [[https://github.com/LukeSmithxyz/st][fork]] of [[https://st.suckless.org/][st]] -- [[https://tools.suckless.org/dmenu/][dmenu]] -- [[https://github.com/enkore/j4-dmenu-desktop][j4-dmenu-desktop]] -- [[https://github.com/davatorium/rofi][Rofi]] -- [[https://github.com/gpoore/minted][minted]] -- [[https://www.rust-lang.org/][Rust]] (stable and nightly) -- [[https://www.latex-project.org/][LaTeX]] and [[http://xetex.sourceforge.net/][XeTeX]] (=texlive= packages on Arch Linux) -- [[https://github.com/tmux/tmux][tmux]], based on [[https://github.com/gpakosz/.tmux][this repo]]’s configuration by [[https://pempek.net/][Grégory Pakosz]]. -- And a bunch of other stuff, see below -And some other stuff scattered around in my dotfiles. - -BTW, I use Arch. - * Installation :PROPERTIES: :CUSTOM_ID: Installation-9ec2ae86 :END: -For an installation walkthrough of my Arch Linux installation, check out my [[file:installation.org][installation.org]] file where I walk you through the first manual steps and through the bootstrap you can execute to automatically take care of a lot of elements. +For an installation walkthrough of my Arch Linux installation, check out my +[[file:installation.org][installation.org]] file where I walk you through the first manual steps and +through the bootstrap you can execute to automatically take care of a lot of +elements. * Licence :PROPERTIES: :CUSTOM_ID: Licence-48911096 :END: -All of my dotfiles (and my dotfiles only) are available under the GNU GPLv3 Licence. Please consult [[file:LICENCE.md]] for more information. In short: you are free to access, edit and redistribute all of my dotfiles under the same licence and as allowed by the licence, and if you fuck up something, it’s your own responsibility. +All of my dotfiles (and my dotfiles only) are available under the GNU GPLv3 +Licence. Please consult [[file:LICENCE.md]] for more information. In short: you are +free to access, edit and redistribute all of my dotfiles under the same licence +and as allowed by the licence, and if you fuck up something, it’s your own +responsibility. diff --git a/org/config/installation.org b/org/config/installation.org index 296b4eb..2c3e431 100644 --- a/org/config/installation.org +++ b/org/config/installation.org @@ -13,17 +13,33 @@ :PROPERTIES: :CUSTOM_ID: Introduction-cd5792cd :END: -Here will be presented what I do to get my system up and running on a fresh Arch Linux install. These installation instructions were written in order to get an Arch Linux distribution up and running with the same configuration as my main computer’s and my travelling laptop’s configuration. +Here will be presented what I do to get my system up and running on a fresh Arch +Linux install. These installation instructions were written in order to get an +Arch Linux distribution up and running with the same configuration as my main +computer’s and my travelling laptop’s configuration. * Install Arch Linux :PROPERTIES: :CUSTOM_ID: Install_Arch_Linux-ac7ad3b2 :END: -I usually install Arch from the [[https://www.archlinux.org/download/][vanilla ISO]], however I began using [[https://github.com/MatMoul/archfi][archfi]] to install easily the distro (I’ve done it so many times, I know how it works now). Usually, my distros will be installed on two partitions: ~/home~ and ~/~ (root). +I usually install Arch from the [[https://www.archlinux.org/download/][vanilla ISO]], however I began using [[https://github.com/MatMoul/archfi][archfi]] to +install easily the distro (I’ve done it so many times, I know how it works now). +Usually, my distros will be installed on two partitions: ~/home~ and ~/~ (root). -If the computer supports EFI bootloaders, the EFI partition will be mounted on ~/boot/efi~. I generally use ~systemd-boot~ as my boot manager, but if you are more comfortable with another one, just install what you want. Be aware that if you format your ~/boot~ partition, you will delete all boot managers that already exist; so, if you are dual-booting, *DO NOT FORMAT IT*. Yes, I made the mistake of wiping the Windows boot manager when I used to dual-boot. +If the computer supports EFI bootloaders, the EFI partition will be mounted on +~/boot/efi~. I generally use ~systemd-boot~ as my boot manager, but if you are +more comfortable with another one, just install what you want. Be aware that if +you format your ~/boot~ partition, you will delete all boot managers that +already exist; so, if you are dual-booting, *DO NOT FORMAT IT*. Yes, I made the +mistake of wiping the Windows boot manager when I used to dual-boot. -In order to use the ~suspend-then-hibernate~ systemd command, it is necessary to have a swap partition at least twice the size of your installed RAM. That is because when this command will be run, the system will try to save the current state of your machine, stored in your RAM, to the swap filesystem. If there is not enough space, the command will fail, and you won’t be able to use this command. For instance, my current computer has 32GB of RAM, hence my SWAP partition is 16GB large. +In order to use the ~suspend-then-hibernate~ systemd command, it is necessary to +have a swap partition at least twice the size of your installed RAM. That is +because when this command will be run, the system will try to save the current +state of your machine, stored in your RAM, to the swap filesystem. If there is +not enough space, the command will fail, and you won’t be able to use this +command. For instance, my current computer has 32GB of RAM, hence my SWAP +partition is 16GB large. ** Get the latest, fastest mirrors :PROPERTIES: @@ -36,13 +52,20 @@ When you boot into the live ISO, execute the following command: --save /etc/pacman.d/mirrorlist --verbose #+END_SRC -This will update the packages from your live ISO, and you will get the best mirrors for your installation. Of course, change the countries accordingly to your location. In my case, I am only interested in French, German, and Belgian mirrors. +This will update the packages from your live ISO, and you will get the best +mirrors for your installation. Of course, change the countries accordingly to +your location. In my case, I am only interested in French, German, and Belgian +mirrors. ** Install the system :PROPERTIES: :CUSTOM_ID: Install_Arch_Linux-Install_the_system-3ff49aa6 :END: -Then you can use a custom script to ease your installation of Arch if you do not wish to do it manually. Personally, I’ve done it several times already, I know how the distro works, I just want to be able to install my distro quickly now. I’ll need to download the script with ~wget~, but apparently it isn’t installed by default on Arch ISOs anymore, so I’ll need to install it. +Then you can use a custom script to ease your installation of Arch if you do not +wish to do it manually. Personally, I’ve done it several times already, I know +how the distro works, I just want to be able to install my distro quickly now. +I’ll need to download the script with ~wget~, but apparently it isn’t installed +by default on Arch ISOs anymore, so I’ll need to install it. #+BEGIN_SRC sh pacman -S wget #+END_SRC @@ -54,16 +77,21 @@ Now, let’s grab the script. You can check it on [[https://github.com/matmoul/a sh archfi #+END_SRC -Then, follow the instructions and install Arch Linux. Take the opportunity to install as many packages as you need, mainly ~paru~ which I use as my package manager (it is just a wrapper for ~pacman~) and AUR helper, and ~pacman-contrib~ which will help us installing some packages later. +Then, follow the instructions and install Arch Linux. Take the opportunity to +install as many packages as you need, mainly ~paru~ which I use as my package +manager (it is just a wrapper for ~pacman~) and AUR helper, and ~pacman-contrib~ +which will help us installing some packages later. -Once your system is installed, reboot and remove your installation media from your computer. +Once your system is installed, reboot and remove your installation media from +your computer. * Execute bootstrap :PROPERTIES: :HEADER-ARGS:fish: :tangle ~/.config/yadm/bootstrap :shebang "#!/usr/bin/fish" :exports code :mkdirp yes :CUSTOM_ID: Execute_bootstrap-e37054ef :END: -The first thing I will do is add the [[https://github.com/archlinuxcn/repo][ArchLinuxCN]] repository so I can get access to ~paru~. +The first thing I will do is add the [[https://github.com/archlinuxcn/repo][ArchLinuxCN]] repository so I can get access +to ~paru~. #+BEGIN_SRC sh printf '[archlinuxcn]\nServer = https://repo.archlinuxcn.org/$arch\n' | sudo tee -a /etc/pacman.conf #+END_SRC @@ -78,7 +106,8 @@ And now that ~paru~ is available, we can install ~yadm~: paru -S yadm #+END_SRC -~yadm~ comes with a very handy feature: its bootstrap script. It can be executed automatically once the dotfiles are cloned with yadm: +~yadm~ comes with a very handy feature: its bootstrap script. It can be executed +automatically once the dotfiles are cloned with yadm: #+BEGIN_SRC sh yadm clone https://labs.phundrak.com/phundrak/dotfiles # or if labs.phundrak.com is down or too slow for you @@ -91,7 +120,8 @@ Let’s take a look at what it does. :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Decrypt_private_yadm_files-68af7157 :END: -Some private files are stored encrypted in the repository of my yadm dotfiles. I will need them later on during the bootstrap execution. +Some private files are stored encrypted in the repository of my yadm dotfiles. I +will need them later on during the bootstrap execution. #+BEGIN_SRC fish if test "$USER" = 'phundrak' yadm decrypt @@ -104,7 +134,11 @@ Some private files are stored encrypted in the repository of my yadm dotfiles. I :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Get_a_correct_keyboard_layout-77d24b30 :END: -I use mainly the [[https://bepo.fr/wiki/Accueil][bépo]] layout, a French keyboard layout inspired by Dvorak layouts, however I sometimes need to switch back to the standard French AZERTY or the American QWERTY layout, so I make it so the Menu key switches for me my layout between these three. This makes it so my xorg configuration of my keyboard looks like this: +I use mainly the [[https://bepo.fr/wiki/Accueil][bépo]] layout, a French keyboard layout inspired by Dvorak +layouts, however I sometimes need to switch back to the standard French AZERTY +or the American QWERTY layout, so I make it so the Menu key switches for me my +layout between these three. This makes it so my xorg configuration of my +keyboard looks like this: #+BEGIN_SRC fish set keyboardconf \ 'Section "InputClass" @@ -130,7 +164,8 @@ So, let’s ask the user if they want to set it as their keyboard configuration. :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Set_our_locale-e74d772a :END: -I use two main locales, the French and US UTF-8 locales, and I like to keep the Japanese locale activated just in case. +I use two main locales, the French and US UTF-8 locales, and I like to keep the +Japanese locale activated just in case. #+BEGIN_SRC fish set mylocales "en_US.UTF-8 UTF-8" "fr_FR.UTF-8 UTF-8" "ja_JP.UTF-8 UTF-8" #+END_SRC @@ -180,7 +215,8 @@ Now we can generate our locale! :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Create_some_folders-bf701387 :END: -Let’s create some folders we might need for mounting our drives, Android devices and CDs. +Let’s create some folders we might need for mounting our drives, Android devices +and CDs. #+BEGIN_SRC fish printf "\n# Create directories for mounting #############################################\n\n" sudo mkdir -p /mnt/{USB,CD,Android} @@ -241,7 +277,8 @@ Let’s set in a custom varible what packages we’ll be needing. xorg-xinit xss-lock xvkbd xwallpaper yaml-language-server-bin zeal #+END_SRC -These are the minimum I would have in my own installation. You can edit it however you want. Let’s install those. +These are the minimum I would have in my own installation. You can edit it +however you want. Let’s install those. #+BEGIN_SRC fish printf "\n# Installing needed packages ##################################################\n\n" sudo pacman -Syu @@ -254,7 +291,9 @@ These are the minimum I would have in my own installation. You can edit it howev :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Tangle_configuration_files_from_Org_files-cc524361 :END: -Before tangling our configuration files, we need to create some directories first so our files can be properly tangled. Here’s the list of directories we need to create: +Before tangling our configuration files, we need to create some directories +first so our files can be properly tangled. Here’s the list of directories we +need to create: #+NAME: dirs-tangled-files | $HOME/.config/awesome | | $HOME/.config/awesome/theme | @@ -297,7 +336,8 @@ Our code to generate such directories looks like this: <> #+END_SRC -The next step is to tangle all the Org files. Here is the list of files that are to be tangled: +The next step is to tangle all the Org files. Here is the list of files that are +to be tangled: #+NAME: tangled-files | filename | |-------------| @@ -373,7 +413,12 @@ emacs -q --batch --eval '(require \'ob-tangle)' \ :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Setting_up_Emacs:_Installing_Spacemacs-0b3d44b2 :END: -Now, the first thing we want to do with Emacs is install its Spacemacs distribution. We’ll clone its =develop= branch into =~/.config/emacs=. We need to do this prior to our dotfiles’ cloning because of some submodules that are cloned within our =~/.config/emacs= directory, and git won’t let us clone Spacemacs in an already existing and non-empty directory. To make sure it isn’t one, let’s delete any potentially existing =~/.config/emacs= directory: +Now, the first thing we want to do with Emacs is install its Spacemacs +distribution. We’ll clone its =develop= branch into =~/.config/emacs=. We need +to do this prior to our dotfiles’ cloning because of some submodules that are +cloned within our =~/.config/emacs= directory, and git won’t let us clone +Spacemacs in an already existing and non-empty directory. To make sure it isn’t +one, let’s delete any potentially existing =~/.config/emacs= directory: #+BEGIN_SRC fish printf "\n# Installing Spacemacs ########################################################\n\n" rm -rf $HOME/.config/emacs $HOME/.emacs* .spacemacs @@ -384,7 +429,8 @@ Now we can clone Spacemacs: git clone --branch develop https://github.com/syl20bnr/spacemacs ~/.config/emacs #+END_SRC -And we can restore what might have been deleted in our =~/.emacs.d/private= directory: +And we can restore what might have been deleted in our =~/.emacs.d/private= +directory: #+BEGIN_SRC fish yadm checkout -- ~/.config/emacs/private/ #+END_SRC @@ -397,12 +443,14 @@ And we can restore what might have been deleted in our =~/.emacs.d/private= dire :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Set_up_dotfiles-Update_our_dotfiles’_remotes-5a0fe6f7 :END: -This line in the bootstrap script will test if the current user is using my username. If yes, it’s probably me. +This line in the bootstrap script will test if the current user is using my +username. If yes, it’s probably me. #+BEGIN_SRC fish if test "$USER" = 'phundrak' #+END_SRC -If it is me installing and using these dotfiles, I want the remotes of my dotfiles to be set to ssh remotes using my ssh keys. +If it is me installing and using these dotfiles, I want the remotes of my +dotfiles to be set to ssh remotes using my ssh keys. #+BEGIN_SRC fish printf "\n# Update yadm’s remotes #######################################################\n\n" yadm remote set-url origin git@labs.phundrak.com:phundrak/dotfiles.git @@ -424,7 +472,8 @@ Finally, let’s close this ~if~ statement. :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Set_up_dotfiles-Update_our_submodules-3e921579 :END: -Now we can download the various dependencies of our dotfiles. To do so, let’s run the following command: +Now we can download the various dependencies of our dotfiles. To do so, let’s +run the following command: #+BEGIN_SRC fish printf "\n# Getting yadm susbmodules ####################################################\n\n" yadm submodule update --init --recursive @@ -434,19 +483,22 @@ Now we can download the various dependencies of our dotfiles. To do so, let’s :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Enable_some_services-3d38d98e :END: -We have installed some packages which require some services to run. Let’s enable them. +We have installed some packages which require some services to run. Let’s enable +them. *** Systemd-timesyncd :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Enable_some_services-Systemd-timesyncd-d887e45b :END: -This service enables time syncing with the NTP protocol, so I can be sure my computer’s time is correct. The service first needs to be enabled: +This service enables time syncing with the NTP protocol, so I can be sure my +computer’s time is correct. The service first needs to be enabled: #+BEGIN_SRC fish printf "\n# Enabling timesync ###########################################################\n\n" sudo systemctl enable --now systemd-timesyncd #+END_SRC -Now, let systemd know I want to use the NTP protocol to keep my computer’s time synced. +Now, let systemd know I want to use the NTP protocol to keep my computer’s time +synced. #+BEGIN_SRC fish sudo timedatectl set-ntp true #+END_SRC @@ -461,7 +513,8 @@ First, let’s activate Docker on startup. sudo systemctl enable --now docker #+END_SRC -Now, if we wish it, we can be added to the =docker= group so we won’t have to type =sudo= each time we call Docker or Docker Compose. +Now, if we wish it, we can be added to the =docker= group so we won’t have to +type =sudo= each time we call Docker or Docker Compose. #+BEGIN_SRC fish read --prompt "echo 'Do you wish to be added to the `docker` group? (Y/n): ' " -l adddockergroup if test $adddockergroup = 'y' || test $adddockergroup = "Y" || test $adddockergroup = '' @@ -473,7 +526,10 @@ Now, if we wish it, we can be added to the =docker= group so we won’t have to :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Enable_some_services-Emacs-c7785c21 :END: -Emacs will run as a user service, which means it won’t be launched until we log in. However, the service won’t be started immediately, I personally prefer to start a standalone instance in which installing and compiling the Emacs packages will happen, and then once that is done I will start the service. +Emacs will run as a user service, which means it won’t be launched until we log +in. However, the service won’t be started immediately, I personally prefer to +start a standalone instance in which installing and compiling the Emacs packages +will happen, and then once that is done I will start the service. #+BEGIN_SRC fish printf "\n# Enabling Emacs as user service ##############################################\n\n" systemctl --user enable emacs @@ -483,7 +539,8 @@ Emacs will run as a user service, which means it won’t be launched until we lo :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Enable_some_services-Mpd-f0f5b9b7 :END: -Mpd will also use as a user service in order to get rid of some lines of code in my configuration. +Mpd will also use as a user service in order to get rid of some lines of code in +my configuration. #+BEGIN_SRC fish printf "\n# Enabling Mpd as a user service ##############################################\n\n" mkdir -p ~/.config/mpd/playlists @@ -494,7 +551,8 @@ Mpd will also use as a user service in order to get rid of some lines of code in :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Enable_some_services-SSH_server-204f5997 :END: -Maybe we want to activate an SSH server on our machine. If so, we can enable it. Let’s ask the question. +Maybe we want to activate an SSH server on our machine. If so, we can enable it. +Let’s ask the question. #+BEGIN_SRC fish whiptail --yesno 'Do you want to activate the ssh server?' 8 50 if test $status -eq 0 @@ -507,7 +565,9 @@ Maybe we want to activate an SSH server on our machine. If so, we can enable it. :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Enable_some_services-Ly-f4b161c0 :END: -Ly is a display manager based on ncurses which I find nice enough for me to use (I generally don’t like using display managers). Let’s enable it, and let’s disable tty2 while we’re at it (Ly uses it to run X). +Ly is a display manager based on ncurses which I find nice enough for me to use +(I generally don’t like using display managers). Let’s enable it, and let’s +disable tty2 while we’re at it (Ly uses it to run X). #+BEGIN_SRC fish sudo systemctl disable getty@tty2 sudo systemctl enable --now ly @@ -517,7 +577,10 @@ Ly is a display manager based on ncurses which I find nice enough for me to use :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Enable_some_services-Acpilight-39152794 :END: -~acpilight~ is our utility managing the brightness of our screen. There is actually no service to enable here, but we must ensure the user is part of the ~video~ group so we can modify the brightness of our screen without using ~sudo~. +~acpilight~ is our utility managing the brightness of our screen. There is +actually no service to enable here, but we must ensure the user is part of the +~video~ group so we can modify the brightness of our screen without using +~sudo~. #+BEGIN_SRC fish sudo usermod -aG video $USER #+END_SRC @@ -526,12 +589,17 @@ Ly is a display manager based on ncurses which I find nice enough for me to use :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Enable_some_services-NordVPN-75c1bd88 :END: -Thanks to the AUR package ~nordvpn-bin~, I no longer have to manually maintain my VPN connections with OpenVPN. However, it requires a service that we should activate: +Thanks to the AUR package ~nordvpn-bin~, I no longer have to manually maintain +my VPN connections with OpenVPN. However, it requires a service that we should +activate: #+BEGIN_SRC fish sudo systemctl enable --now nordvpnd #+END_SRC -Let’s also set its default protocol to UDP. This will allow me to use any port while connected to any WiFi as long as the 443 port is available. Because yes, I do connect to a WiFi that blocks some important ports, such as the IMAP and SMTP ports. Thanks University of Paris 8 for being SO paranoid. +Let’s also set its default protocol to UDP. This will allow me to use any port +while connected to any WiFi as long as the 443 port is available. Because yes, I +do connect to a WiFi that blocks some important ports, such as the IMAP and SMTP +ports. Thanks University of Paris 8 for being SO paranoid. #+BEGIN_SRC fish nordvpn s protocol tcp #+END_SRC @@ -548,7 +616,8 @@ We have some files in [[file:ect/][etc/]] that are to be symlinked to =/etc=. end #+END_SRC -Let’s also symlink the ~plock~ script ([[file:bin.org::#Lock-635fcb38][source here]]) to ~/usr/bin~ so ~xss-lock~ can find it. +Let’s also symlink the ~plock~ script ([[file:bin.org::#Lock-635fcb38][source here]]) to ~/usr/bin~ so ~xss-lock~ +can find it. #+BEGIN_SRC fish sudo ln -s (which plock) /usr/bin/plock #+END_SRC @@ -566,7 +635,8 @@ Now, let’s install some packages from git directly. :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Install_packages_from_git-Reveal.JS-bb4da0bf :END: -I sometimes use Reveal.JS to make presentations, and I set its location in my [[file:.spacemacs][dotspacemacs]] file to be in =~/fromGIT=, so let’s clone it there. +I sometimes use Reveal.JS to make presentations, and I set its location in my +[[file:.spacemacs][dotspacemacs]] file to be in =~/fromGIT=, so let’s clone it there. #+BEGIN_SRC fish printf "\n# Install Reveal.JS ###########################################################\n\n" cd ~/fromGIT @@ -581,13 +651,16 @@ I sometimes use Reveal.JS to make presentations, and I set its location in my [[ :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Install_Rust-Install_the_toolchains-3480764a :END: -When using Rust, I bounce between two toolchains, the ~stable~ toolchain and the ~nightly~ toolchain, although I try to stick with Rust Stable. To install them, I will use ~rustup~ which has already been installed previously. +When using Rust, I bounce between two toolchains, the ~stable~ toolchain and the +~nightly~ toolchain, although I try to stick with Rust Stable. To install them, +I will use ~rustup~ which has already been installed previously. #+BEGIN_SRC fish printf "\n# Install the rust toolchains, nightly is the default one #####################\n\n" rustup default stable #+END_SRC -This will both download the stable toolchain and set it as the default one. Now to install the nightly toolchain, let’s run this: +This will both download the stable toolchain and set it as the default one. Now +to install the nightly toolchain, let’s run this: #+BEGIN_SRC fish rustup toolchain install nightly #+END_SRC @@ -596,7 +669,8 @@ This will both download the stable toolchain and set it as the default one. Now :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Install_Rust-Install_some_utilities-c4a7c785 :END: -We’ll need some utilities when developing Rust from Emacs, namely ~rustfmt~ and ~racer~. Let’s install them with ~cargo~. +We’ll need some utilities when developing Rust from Emacs, namely ~rustfmt~ and +~racer~. Let’s install them with ~cargo~. #+BEGIN_SRC fish printf "\n# Add rust utilities ##########################################################\n\n" cargo install rustfmt racer @@ -631,7 +705,8 @@ Here is the code to do so: :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Install_some_python_packages-a4447a6f :END: -Some packages will be needed from pip in order to get our Emacs setup correctly working. +Some packages will be needed from pip in order to get our Emacs setup correctly +working. #+NAME: python-packages-table | Package | Why | |-----------------------------+-------------------------| @@ -659,7 +734,8 @@ Let’s install them locally for our user. :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Set_up_Chicken_(Scheme_interpreter-compiler)-3c1a3c4a :END: -Chicken needs to be set up before being used. First, we need to install its documentation. +Chicken needs to be set up before being used. First, we need to install its +documentation. #+BEGIN_SRC fish printf "\n# Setting up Chicken ##########################################################\n\n" chicken-install -s apropos chicken-doc @@ -675,7 +751,8 @@ Then, we’ll complete the documentation like so: :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Set_up_our_fish_shell-f0741c22 :END: -The last thing we want to do is to set up our fish shell with some extensions in order to improve the user experience. +The last thing we want to do is to set up our fish shell with some extensions in +order to improve the user experience. *** Install ~fisher~ :PROPERTIES: diff --git a/org/config/picom.org b/org/config/picom.org index 105d2ff..10c0890 100644 --- a/org/config/picom.org +++ b/org/config/picom.org @@ -9,18 +9,25 @@ :PROPERTIES: :CUSTOM_ID: Introduction-a5320326 :END: -Picom is the successor to Compton, a standalone compositor for Xorg. It provides compositing for WM that do not provide any, such as i3. I am currently using [[https://github.com/ibhagwan/picom][ibhagwan’s fork of compton]] which provides the ~dual-kawase~ blur from [[https://github.com/tryone144/compton][tryone’s compton]] and rounded corners from [[https://github.com/sdhand/picom][sdhand’s compton]]. +Picom is the successor to Compton, a standalone compositor for Xorg. It provides +compositing for WM that do not provide any, such as i3. I am currently using +[[https://github.com/ibhagwan/picom][ibhagwan’s fork of compton]] which provides the ~dual-kawase~ blur from [[https://github.com/tryone144/compton][tryone’s +compton]] and rounded corners from [[https://github.com/sdhand/picom][sdhand’s compton]]. * Shadows :PROPERTIES: :CUSTOM_ID: Shadows-f4ffbb27 :END: -The following enables client-side shadows on windows. Note desktop windows (windows with ~_NET_WM_WINDOW_TYPE_DESKTOP~) never get shadow, unless explicitly requested using the wintypes option. I personally deactivated shadows because they don’t work out too well with rounded corners. +The following enables client-side shadows on windows. Note desktop windows +(windows with ~_NET_WM_WINDOW_TYPE_DESKTOP~) never get shadow, unless explicitly +requested using the wintypes option. I personally deactivated shadows because +they don’t work out too well with rounded corners. #+BEGIN_SRC conf shadow = true; #+END_SRC -The blur radius radius for shadows is measured in pixels, and it defaults to 12px. +The blur radius radius for shadows is measured in pixels, and it defaults to +12px. #+BEGIN_SRC conf shadow-radius = 17; #+END_SRC @@ -40,7 +47,10 @@ The left and top offsets for shadows are expressed in pixels. shadow-offset-y = -12; #+END_SRC -It is possible to set the color of the shadow with the string contained in ~shadow-color~ with a hexadecimal value. I haven’t included these values in my config, but this value will override any value in ~shadow-red~, ~shadow-green~, or ~shadow-blue~. +It is possible to set the color of the shadow with the string contained in +~shadow-color~ with a hexadecimal value. I haven’t included these values in my +config, but this value will override any value in ~shadow-red~, ~shadow-green~, +or ~shadow-blue~. #+BEGIN_SRC conf shadow-color = "#000000" #+END_SRC @@ -58,20 +68,19 @@ shadow. ]; #+END_SRC -It is also possible to specify an X geometry that describes the region in -which shadows should not be painted in, such as a dock window region. For -example, +It is also possible to specify an X geometry that describes the region in which +shadows should not be painted in, such as a dock window region. For example, #+BEGIN_SRC conf :tangle no # shadow-exclude-reg = "x10+0+0" #+END_SRC -would make the 10 pixels at the bottom of the screen not have any shadow -painted on. +would make the 10 pixels at the bottom of the screen not have any shadow painted +on. | Default value | ~""~ | #+BEGIN_SRC conf :tangle no shadow-exclude-reg = "" #+END_SRC -Finally, it is also possible to crop the shadow of a window fully on a +Finally, it is also possible to crop the shadow of a window fully on a particular Xinerama screen to the screen. - Default value :: ~false~ #+BEGIN_SRC conf @@ -85,19 +94,26 @@ particular Xinerama screen to the screen. :END: Options in this subheader *will not* be exported to my configuration file. -Thanks to this value, Picom can avoid drawing shadows on dock or panel windows. This option is deprecated, and users should use the ~wintypes~ option in their config file instead. +Thanks to this value, Picom can avoid drawing shadows on dock or panel windows. +This option is deprecated, and users should use the ~wintypes~ option in their +config file instead. | Default value | ~false~ | #+BEGIN_SRC conf no-dock-shadow = false; #+END_SRC -This option allows Picom not to draw on drag-and-drop windows. This option is deprecated, and users should use the ~wintypes~ option in their config file instead. +This option allows Picom not to draw on drag-and-drop windows. This option is +deprecated, and users should use the ~wintypes~ option in their config file +instead. | Default value | ~false~ | #+BEGIN_SRC conf no-dnd-shadow = false; #+END_SRC -~shadow-ignore-shaped~ is also deprecated. It used to indicate Picom not to paint shadows on shaped windows. Note shaped windows here means windows setting their shape through X Shape extension. Those using ARGB background are beyond Picom’s control. Since it is deprecated, you could instead use +~shadow-ignore-shaped~ is also deprecated. It used to indicate Picom not to +paint shadows on shaped windows. Note shaped windows here means windows setting +their shape through X Shape extension. Those using ARGB background are beyond +Picom’s control. Since it is deprecated, you could instead use #+BEGIN_SRC conf :tangle no shadow-exclude = 'bounding_shaped' #+END_SRC @@ -114,12 +130,15 @@ or :PROPERTIES: :CUSTOM_ID: Rounded_corners-33bfcd20 :END: -A great feature added by ibhagwan’s fork of picom is the addition of rounded corners from sdhand’s fork, and the Kawase blur (described [[#Background_blurring-55835066][here]]) from tryone144’s fork. Here we can see the declaration of the corners’ radius: +A great feature added by ibhagwan’s fork of picom is the addition of rounded +corners from sdhand’s fork, and the Kawase blur (described [[#Background_blurring-55835066][here]]) from +tryone144’s fork. Here we can see the declaration of the corners’ radius: #+BEGIN_SRC conf corner-radius = 9.0; #+END_SRC -It is also possible to exclude some windows from getting their corners rounded. I personally excluded any window generated by AwesomeWM. +It is also possible to exclude some windows from getting their corners rounded. +I personally excluded any window generated by AwesomeWM. #+BEGIN_SRC conf rounded-corners-exclude = [ "_NET_WM_WINDOW_TYPE@[0]:a = '_NET_WM_WINDOW_TYPE_DOCK'" @@ -130,7 +149,10 @@ It is also possible to exclude some windows from getting their corners rounded. :PROPERTIES: :CUSTOM_ID: Fading-419d8047 :END: -Picom has the ability to create some fading effects on windows when opening or closing or when the opacity changes. The following parameter toggles this feature on or off. However, its behavior can be changed with ~no-fading-openclose~. +Picom has the ability to create some fading effects on windows when opening or +closing or when the opacity changes. The following parameter toggles this +feature on or off. However, its behavior can be changed with +~no-fading-openclose~. | Default value | ~false~ | #+BEGIN_SRC conf fading = true @@ -152,7 +174,8 @@ This value represents the time between steps in fade steps, in milliseconds. fade-delta = 20; #+END_SRC -It is possible to exclude some windows that should not be faded with a specified list of conditions. +It is possible to exclude some windows that should not be faded with a specified +list of conditions. | Default value | ~[]~ | #+BEGIN_SRC conf fade-exclude = [ "class_g = 'mpv'" ]; @@ -164,7 +187,8 @@ This option allows Picom not to create any fade on windows opening or closing. no-fading-openclose = true; #+END_SRC -Finally, this option is a workaround for Openbox, Fluxbox and others by not fading destroyed ARGB windows with WM frame. +Finally, this option is a workaround for Openbox, Fluxbox and others by not +fading destroyed ARGB windows with WM frame. | Default value | ~false~ | #+BEGIN_SRC conf no-fading-destroyed-argb = false @@ -174,7 +198,9 @@ Finally, this option is a workaround for Openbox, Fluxbox and others by not fadi :PROPERTIES: :CUSTOM_ID: Transparency_and_opacity-6c6b36d2 :END: -Picom is also able to create some opacity or transparency for windows, depending on their state or on some user-defined rules. For instance, the following value describes the opacity of inactive windows. +Picom is also able to create some opacity or transparency for windows, depending +on their state or on some user-defined rules. For instance, the following value +describes the opacity of inactive windows. | Default value | ~1.0~ | | Min value | ~0.1~ | | Max value | ~1.0~ | @@ -182,7 +208,8 @@ Picom is also able to create some opacity or transparency for windows, depending inactive-opacity = 0.6; #+END_SRC -On the other hand, it is possible to declare a default opacity for active windows. +On the other hand, it is possible to declare a default opacity for active +windows. | Default value | ~1.0~ | | Min value | ~0.1~ | | Max value | ~1.0~ | @@ -206,13 +233,15 @@ This however describes the opacity of window titlebars and borders. # menu-opacity = 0.9; #+END_SRC -~inactive-opacity-override~ allows the user to let inactive opacity set by ~-i~ override the ~_NET_WM_OPACITY_ values of windows. +~inactive-opacity-override~ allows the user to let inactive opacity set by ~-i~ +override the ~_NET_WM_OPACITY_ values of windows. | Default value | ~true~ | #+BEGIN_SRC conf inactive-opacity-override = true; #+END_SRC -While it is possible to alter opacity on inactive windows, it is also possible to dim them. +While it is possible to alter opacity on inactive windows, it is also possible +to dim them. | Default value | ~1.0~ | | Min value | ~0.1~ | | Max value | ~1.0~ | @@ -220,7 +249,8 @@ While it is possible to alter opacity on inactive windows, it is also possible t # inactive-dim = 1.0 #+END_SRC -It is also possible to use a fixed inactive dim value, instead of adjusting according to window opacity. +It is also possible to use a fixed inactive dim value, instead of adjusting +according to window opacity. | Default value | ~1.0~ | | Min value | ~0.1~ | | Max value | ~1.0~ | @@ -228,13 +258,17 @@ It is also possible to use a fixed inactive dim value, instead of adjusting acco # inactive-dim-fixed = 1.0 #+END_SRC -It is also possible to specify a list of conditions of windows that should always be considered focused. +It is also possible to specify a list of conditions of windows that should +always be considered focused. | Default value | ~[]~ | #+BEGIN_SRC conf focus-exclude = [ "class_g = 'mpv'" ]; #+END_SRC -The user can also specify a list of opacity rules, in the format ~PERCENT:PATTERN~, like ~50:name *= "Firefox"~ . ~picom-trans~ is recommended over this. Note we don't make any guarantee about possible conflicts with other programs that set ~_NET_WM_WINDOW_OPACITY~ on frame or client windows. +The user can also specify a list of opacity rules, in the format +~PERCENT:PATTERN~, like ~50:name *= "Firefox"~ . ~picom-trans~ is recommended +over this. Note we don't make any guarantee about possible conflicts with other +programs that set ~_NET_WM_WINDOW_OPACITY~ on frame or client windows. | Default value | ~[]~ | #+BEGIN_SRC conf opacity-rule = []; @@ -244,7 +278,8 @@ The user can also specify a list of opacity rules, in the format ~PERCENT:PATTER :PROPERTIES: :CUSTOM_ID: Background_blurring-55835066 :END: -The following are the parameters for background blurring, see the \*BLUR\* section for more information. +The following are the parameters for background blurring, see the \*BLUR\* +section for more information. #+BEGIN_SRC conf blur: { method = "dual_kawase"; @@ -255,29 +290,33 @@ The following are the parameters for background blurring, see the \*BLUR\* secti } #+END_SRC -This value enables or disables the blur for the background of semi-transparent or ARGB windows. It has bad performances though, with driver-dependent behavior. The name of the switch may change without prior notifications. +This value enables or disables the blur for the background of semi-transparent +or ARGB windows. It has bad performances though, with driver-dependent behavior. +The name of the switch may change without prior notifications. | Default value | ~false~ | #+BEGIN_SRC conf blur-background = true; #+END_SRC -Blur background of windows when the window frame is not opaque. If true, this implies the value ~true~ for ~blur-background~. +Blur background of windows when the window frame is not opaque. If true, this +implies the value ~true~ for ~blur-background~. | Default value | ~false~ | #+BEGIN_SRC conf blur-background-frame = true; #+END_SRC -The following determines whether to use fixed blur strength rather than adjusting according to window opacity. +The following determines whether to use fixed blur strength rather than +adjusting according to window opacity. | Default value | ~false~ | #+BEGIN_SRC conf blur-background-fixed = false; #+END_SRC -Specify the blur convolution kernel, with the format ~"5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"~. +Specify the blur convolution kernel, with the format +~"5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"~. | Default value | ~""~ | #+BEGIN_SRC conf # blur-kern = "3x3box"; - blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"; #+END_SRC It is possible to write exclude conditions for background blur. @@ -295,13 +334,15 @@ It is possible to write exclude conditions for background blur. :PROPERTIES: :CUSTOM_ID: General_settings-41398de7 :END: -Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers. +Daemonize process. Fork to background after initialization. Causes issues with +certain (badly-written) drivers. | Default value | ~false~ | #+BEGIN_SRC conf daemon = true; #+END_SRC -Picom has three backends it can use: ~xrender~, ~glx~, and ~xr_glx_hybrid~. GLX backend is typically much faster but depends on a sane driver. +Picom has three backends it can use: ~xrender~, ~glx~, and ~xr_glx_hybrid~. GLX +backend is typically much faster but depends on a sane driver. | Default value | ~xrender~ | #+BEGIN_SRC conf backend = "glx"; @@ -313,60 +354,72 @@ This enables or disables VSync. vsync = true; #+END_SRC -Enable remote control via D-Bus. See the *D-BUS API* section below for more details. +Enable remote control via D-Bus. See the *D-BUS API* section below for more +details. | Default value | ~false~ | #+BEGIN_SRC conf dbus = false; #+END_SRC -Try to detect WM windows (a non-override-redirect window with no child that has ~WM_STATE~) and markz them as active. +Try to detect WM windows (a non-override-redirect window with no child that has +~WM_STATE~) and markz them as active. | Default value | ~false~ | #+BEGIN_SRC conf mark-wmwin-focused = true; #+END_SRC - -Mark override-redirect windows that doesn't have a child window with ~WM_STATE~ focused. +Mark override-redirect windows that doesn't have a child window with ~WM_STATE~ +focused. | Default value | ~false~ | #+BEGIN_SRC conf mark-ovredir-focused = true; #+END_SRC -Try to detect windows with rounded corners and don't consider them shaped windows. The accuracy is not very high, unfortunately. +Try to detect windows with rounded corners and don't consider them shaped +windows. The accuracy is not very high, unfortunately. | Default value | ~false~ | #+BEGIN_SRC conf detect-rounded-corners = true; #+END_SRC -Detect ~_NET_WM_OPACITY~ on client windows, useful for window managers not passing ~_NET_WM_OPACITY~ of client windows to frame windows. +Detect ~_NET_WM_OPACITY~ on client windows, useful for window managers not +passing ~_NET_WM_OPACITY~ of client windows to frame windows. | Default value | ~false~ | #+BEGIN_SRC conf detect-client-opacity = true; #+END_SRC -Specify refresh rate of the screen. If not specified or 0, picom will try detecting this with X RandR extension. +Specify refresh rate of the screen. If not specified or 0, picom will try +detecting this with X RandR extension. | Default value | ~60~ | #+BEGIN_SRC conf refresh-rate = 120; #+END_SRC -Limit picom to repaint at most once every 1 / ~refresh_rate~ second to boost performance. This should not be used with +Limit picom to repaint at most once every 1 / ~refresh_rate~ second to boost +performance. This should not be used with #+BEGIN_SRC text :tangle no vsync drm/opengl/opengl-oml #+END_SRC -as they essentially does sw-opti's job already, unless you wish to specify a lower refresh rate than the actual value. +as they essentially does sw-opti's job already, unless you wish to specify a +lower refresh rate than the actual value. | Default value | ~""~ | #+BEGIN_SRC conf # sw-opti =; #+END_SRC -Use EWMH ~_NET_ACTIVE_WINDOW~ to determine currently focused window, rather than listening to ~FocusIn~/~FocusOut~ event. Might have more accuracy, provided that the WM supports it. +Use EWMH ~_NET_ACTIVE_WINDOW~ to determine currently focused window, rather than +listening to ~FocusIn~/~FocusOut~ event. Might have more accuracy, provided that +the WM supports it. | Default value | ~false~ | #+BEGIN_SRC conf # use-ewmh-active-win = false; #+END_SRC -Unredirect all windows if a full-screen opaque window is detected, to maximize performance for full-screen windows. Known to cause flickering when redirecting/unredirecting windows. paint-on-overlay may make the flickering less obvious. +Unredirect all windows if a full-screen opaque window is detected, to maximize +performance for full-screen windows. Known to cause flickering when +redirecting/unredirecting windows. paint-on-overlay may make the flickering less +obvious. | Default value | ~false~ | #+BEGIN_SRC conf unredir-if-possible = false; @@ -378,67 +431,91 @@ Delay before unredirecting the window, in milliseconds. unredir-if-possible-delay = 0; #+END_SRC -Conditions of windows that shouldn't be considered full-screen for unredirecting screen. +Conditions of windows that shouldn't be considered full-screen for unredirecting +screen. | Default value | ~[]~ | #+BEGIN_SRC conf unredir-if-possible-exclude = []; #+END_SRC -Use ~WM_TRANSIENT_FOR~ to group windows, and consider windows in the same group focused at the same time. +Use ~WM_TRANSIENT_FOR~ to group windows, and consider windows in the same group +focused at the same time. | Default value | ~false~ | #+BEGIN_SRC conf detect-transient = true; #+END_SRC -Use ~WM_CLIENT_LEADER~ to group windows, and consider windows in the same group focused at the same time. ~WM_TRANSIENT_FOR~ has higher priority if detect-transient is enabled, too. +Use ~WM_CLIENT_LEADER~ to group windows, and consider windows in the same group +focused at the same time. ~WM_TRANSIENT_FOR~ has higher priority if +detect-transient is enabled, too. | Default value | ~false~ | #+BEGIN_SRC conf detect-client-leader = true; #+END_SRC -Resize damaged region by a specific number of pixels. A positive value enlarges it while a negative one shrinks it. If the value is positive, those additional pixels will not be actually painted to screen, only used in blur calculation, and such. (Due to technical limitations, with use-damage, those pixels will still be incorrectly painted to screen.) Primarily used to fix the line corruption issues of blur, in which case you should use the blur radius value here (e.g. with a 3x3 kernel, you should use ~--resize-damage 1~, with a 5x5 one you use ~--resize-damage 2~, and so on). May or may not work with ~--glx-no-stencil~. Shrinking doesn't function correctly. +Resize damaged region by a specific number of pixels. A positive value enlarges +it while a negative one shrinks it. If the value is positive, those additional +pixels will not be actually painted to screen, only used in blur calculation, +and such. (Due to technical limitations, with use-damage, those pixels will +still be incorrectly painted to screen.) Primarily used to fix the line +corruption issues of blur, in which case you should use the blur radius value +here (e.g. with a 3x3 kernel, you should use ~--resize-damage 1~, with a 5x5 one +you use ~--resize-damage 2~, and so on). May or may not work with +~--glx-no-stencil~. Shrinking doesn't function correctly. | Default value | ~1~ | #+BEGIN_SRC conf resize-damage = 1; #+END_SRC -Specify a list of conditions of windows that should be painted with inverted color. Resource-hogging, and is not well tested. +Specify a list of conditions of windows that should be painted with inverted +color. Resource-hogging, and is not well tested. | Default value | ~[]~ | #+BEGIN_SRC conf invert-color-include = []; #+END_SRC -Disable the use of damage information. This cause the whole screen to be redrawn everytime, instead of the part of the screen has actually changed. Potentially degrades the performance, but might fix some artifacts. The opposing option is use-damage +Disable the use of damage information. This cause the whole screen to be redrawn +everytime, instead of the part of the screen has actually changed. Potentially +degrades the performance, but might fix some artifacts. The opposing option is +use-damage | Default value | ~false~ | #+BEGIN_SRC conf use-damage = false; #+END_SRC -Use X Sync fence to sync clients' draw calls, to make sure all draw calls are finished before picom starts drawing. Needed on nvidia-drivers with GLX backend for some users. +Use X Sync fence to sync clients' draw calls, to make sure all draw calls are +finished before picom starts drawing. Needed on nvidia-drivers with GLX backend +for some users. | Default value | ~false~ | #+BEGIN_SRC conf xrender-sync-fence = false; #+END_SRC -Force all windows to be painted with blending. Useful if you have a glx-fshader-win that could turn opaque pixels transparent. +Force all windows to be painted with blending. Useful if you have a +glx-fshader-win that could turn opaque pixels transparent. | Default value | ~false~ | #+BEGIN_SRC conf force-win-blend = false; #+END_SRC -Do not use EWMH to detect fullscreen windows. Reverts to checking if a window is fullscreen based only on its size and coordinates. +Do not use EWMH to detect fullscreen windows. Reverts to checking if a window is +fullscreen based only on its size and coordinates. | Default value | ~false~ | #+BEGIN_SRC conf no-ewmh-fullscreen = false; #+END_SRC -Dimming bright windows so their brightness doesn't exceed this set value. Brightness of a window is estimated by averaging all pixels in the window, so this could comes with a performance hit. Setting this to 1.0 disables this behaviour. Requires ~--use-damage~ to be disabled. +Dimming bright windows so their brightness doesn't exceed this set value. +Brightness of a window is estimated by averaging all pixels in the window, so +this could comes with a performance hit. Setting this to 1.0 disables this +behaviour. Requires ~--use-damage~ to be disabled. | Default value | ~1.0~ | #+BEGIN_SRC conf max-brightness = 1.0; #+END_SRC -Make transparent windows clip other windows like non-transparent windows do, instead of blending on top of them. +Make transparent windows clip other windows like non-transparent windows do, +instead of blending on top of them. | Default value | ~false~ | #+BEGIN_SRC conf transparent-clipping = false; @@ -450,13 +527,18 @@ Set the log level. Possible values are: - ~info~ - ~warn~ - ~error~ -in increasing level of importance. Case doesn't matter. If using the "TRACE" log level, it's better to log into a file using ~--log-file~, since it can generate a huge stream of logs. +in increasing level of importance. Case doesn't matter. If using the "TRACE" log +level, it's better to log into a file using ~--log-file~, since it can generate +a huge stream of logs. | Default value | ~"debug"~ | #+BEGIN_SRC conf log-level = "warn"; #+END_SRC -Set the log file. If ~--log-file~ is never specified, logs will be written to stderr. Otherwise, logs will to written to the given file, though some of the early logs might still be written to the stderr. When setting this option from the config file, it is recommended to use an absolute path. +Set the log file. If ~--log-file~ is never specified, logs will be written to +stderr. Otherwise, logs will to written to the given file, though some of the +early logs might still be written to the stderr. When setting this option from +the config file, it is recommended to use an absolute path. | Default value | ~''~ | #+BEGIN_SRC conf # log-file = '/path/to/your/log/file'; @@ -474,7 +556,8 @@ Write process ID to a file. # write-pid-path = '/path/to/your/log/file'; #+END_SRC -Window type settings. ~WINDOW_TYPE~ is one of the 15 window types defined in EWMH standard: +Window type settings. ~WINDOW_TYPE~ is one of the 15 window types defined in +EWMH standard: - ~"unknown"~ - ~"desktop"~ - ~"dock"~ @@ -493,9 +576,16 @@ Window type settings. ~WINDOW_TYPE~ is one of the 15 window types defined in EWM Following per window-type options are available: - fade, shadow :: Controls window-type-specific shadow and fade settings. - opacity :: Controls default opacity of the window type. -- focus :: Controls whether the window of this type is to be always considered focused. (By default, all window types except "normal" and "dialog" has this on.) -- full-shadow :: Controls whether shadow is drawn under the parts of the window that you normally won't be able to see. Useful when the window has parts of it transparent, and you want shadows in those areas. -- redir-ignore :: Controls whether this type of windows should cause screen to become redirected again after been unredirected. If you have unredir-if-possible set, and doesn't want certain window to cause unnecessary screen redirection, you can set this to `true`. +- focus :: Controls whether the window of this type is to be always considered + focused. (By default, all window types except "normal" and "dialog" has this + on.) +- full-shadow :: Controls whether shadow is drawn under the parts of the window + that you normally won't be able to see. Useful when the window has parts of it + transparent, and you want shadows in those areas. +- redir-ignore :: Controls whether this type of windows should cause screen to + become redirected again after been unredirected. If you have + unredir-if-possible set, and doesn't want certain window to cause unnecessary + screen redirection, you can set this to `true`. #+BEGIN_SRC conf wintypes: { @@ -511,19 +601,26 @@ Following per window-type options are available: :PROPERTIES: :CUSTOM_ID: General_settings-GLX_backend-specific_options-43892981 :END: -Avoid using stencil buffer, useful if you don't have a stencil buffer. Might cause incorrect opacity when rendering transparent content (but never practically happened) and may not work with blur-background. Tests show a 15% performance boost. Recommended. +Avoid using stencil buffer, useful if you don't have a stencil buffer. Might +cause incorrect opacity when rendering transparent content (but never +practically happened) and may not work with blur-background. Tests show a 15% +performance boost. Recommended. | Default value | ~false~ | #+BEGIN_SRC conf glx-no-stencil = true; #+END_SRC -Avoid rebinding pixmap on window damage. Probably could improve performance on rapid window content changes, but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.). Recommended if it works. +Avoid rebinding pixmap on window damage. Probably could improve performance on +rapid window content changes, but is known to break things on some drivers +(LLVMpipe, xf86-video-intel, etc.). Recommended if it works. | Default value | ~false~ | #+BEGIN_SRC conf glx-no-rebind-pixmap = false; #+END_SRC -Use specified GLSL fragment shader for rendering window contents. See ~compton-default-fshader-win.glsl~ and ~compton-fake-transparency-fshader-win.glsl~ in the source tree for examples. +Use specified GLSL fragment shader for rendering window contents. See +~compton-default-fshader-win.glsl~ and +~compton-fake-transparency-fshader-win.glsl~ in the source tree for examples. | Default value | ~''~ | #+BEGIN_SRC conf :tangle no glx-fshader-win = ''; diff --git a/org/config/rustfmt.org b/org/config/rustfmt.org index 7eeedab..a057cdf 100644 --- a/org/config/rustfmt.org +++ b/org/config/rustfmt.org @@ -10,7 +10,9 @@ :PROPERTIES: :CUSTOM_ID: Introduction-465e99fe :END: -The ~.rustfmt.toml~ file located in the ~$HOME~ directory is a global configuration file for Rust’s code formatters, such as ~rustfmt~. In this file, you can find how my Rust code is always formatted. +The ~.rustfmt.toml~ file located in the ~$HOME~ directory is a global +configuration file for Rust’s code formatters, such as ~rustfmt~. In this file, +you can find how my Rust code is always formatted. * General settings :PROPERTIES: @@ -41,9 +43,12 @@ Merge multiple imports into a single nested import. :PROPERTIES: :CUSTOM_ID: Structs_and_Enums-6a2a856d :END: -The maximum length of enum variant having discriminant, that gets vertically aligned with others. Variants without discriminants would be ignored for the purpose of alignment. +The maximum length of enum variant having discriminant, that gets vertically +aligned with others. Variants without discriminants would be ignored for the +purpose of alignment. -Note that this is not how much whitespace is inserted, but instead the longest variant name that doesn't get ignored when aligning. +Note that this is not how much whitespace is inserted, but instead the longest +variant name that doesn't get ignored when aligning. #+BEGIN_SRC toml enum_discrim_align_threshold = 20 #+END_SRC diff --git a/org/config/tmux.org b/org/config/tmux.org index 15d1823..6df1de0 100644 --- a/org/config/tmux.org +++ b/org/config/tmux.org @@ -10,7 +10,9 @@ :PROPERTIES: :CUSTOM_ID: Presentation-0b37c6c0 :END: -I don’t really use tmux often, but I certainly do like a nice presentation and useful features, hence this configuration. This config file is inspired by gpakosz’s tmux configuration repo you can find [[https://github.com/gpakosz/.tmux][here]]. +I don’t really use tmux often, but I certainly do like a nice presentation and +useful features, hence this configuration. This config file is inspired by +gpakosz’s tmux configuration repo you can find [[https://github.com/gpakosz/.tmux][here]]. * Windows and pane creation :PROPERTIES: @@ -28,13 +30,15 @@ Whether if a new *pane* should retain the current path. Possible values are: #+BEGIN_SRC conf-unix tmux_conf_new_window_retain_current_path=true #+END_SRC -Whether or not tmux should attempt to reconnect to the current ssh session. This is still experimental. Possible values are: +Whether or not tmux should attempt to reconnect to the current ssh session. This +is still experimental. Possible values are: - ~true~ - ~false~ (default) #+BEGIN_SRC conf-unix tmux_conf_new_pane_reconnect_ssh=true #+END_SRC -Whether tmux should prompt for new session name when creating a new one. Possible values are: +Whether tmux should prompt for new session name when creating a new one. +Possible values are: - ~true~ - ~false~ (default) #+BEGIN_SRC conf-unix @@ -45,7 +49,8 @@ tmux_conf_new_session_prompt=false :PROPERTIES: :CUSTOM_ID: Display-d5ae1908 :END: -Whether to activate RGB 24-bit color support (only available in tmux >= 2.2). Possible values are: +Whether to activate RGB 24-bit color support (only available in tmux >= 2.2). +Possible values are: - ~true~ - ~false~ (default) #+BEGIN_SRC conf-unix @@ -56,7 +61,8 @@ These variables are for chosing the window style. I use the default one. tmux_conf_theme_window_fg='default' tmux_conf_theme_window_bg='default' #+END_SRC -Whether the focused pane should be highlighted (only available in tmux >= 2.1). Possible values are: +Whether the focused pane should be highlighted (only available in tmux >= 2.1). +Possible values are: - ~true~ - ~false~ (default) #+BEGIN_SRC conf-unix @@ -72,7 +78,9 @@ Set the terminal title. Built-in variables are: #+BEGIN_SRC conf-unix tmux_conf_theme_terminal_title='#h ❐ #S ● #I #W' #+END_SRC -These variables set the left/right separators between sections. With the current values, you don’t need to install Powerline, but only fonts patched with Powerline symbols or the standalone PowerlineSymbols.otf font. +These variables set the left/right separators between sections. With the current +values, you don’t need to install Powerline, but only fonts patched with +Powerline symbols or the standalone PowerlineSymbols.otf font. #+BEGIN_SRC conf-unix tmux_conf_theme_left_separator_main='\uE0B0' tmux_conf_theme_left_separator_sub='\uE0B1' @@ -84,7 +92,10 @@ These variables set the left/right separators between sections. With the current :PROPERTIES: :CUSTOM_ID: Display-Colors_and_style-0994a014 :END: -Colors displayed in tmux can be chosen thanks to the following variables. Any color should be formatted as a hexadecimal RGB value preceded by a pound sign =#= (e.g. =#00afff= for light blue) or =default= to let our terminal set it for us. +Colors displayed in tmux can be chosen thanks to the following variables. Any +color should be formatted as a hexadecimal RGB value preceded by a pound sign +=#= (e.g. =#00afff= for light blue) or =default= to let our terminal set it for +us. Choose the style of the pane borders. Possible values are: - ~thin~ (default) @@ -92,7 +103,8 @@ Choose the style of the pane borders. Possible values are: #+BEGIN_SRC conf-unix tmux_conf_theme_pane_border_style=thin #+END_SRC -Declare what the colors of the focused pane should be. The first variable specifies the foreground color, the other the background color. +Declare what the colors of the focused pane should be. The first variable +specifies the foreground color, the other the background color. #+BEGIN_SRC conf-unix tmux_conf_theme_focused_pane_fg='default' tmux_conf_theme_focused_pane_bg='#0087d7' @@ -188,7 +200,8 @@ Sets the window last status style. tmux_conf_theme_window_status_last_bg='default' tmux_conf_theme_window_status_last_attr='none' #+END_SRC -Sets the left and right content of the status bar of tmux. Sections should be separated with =|=, subsections with =,=. The built-in values are: +Sets the left and right content of the status bar of tmux. Sections should be +separated with =|=, subsections with =,=. The built-in values are: - =#{battery_bar}= - =#{battery_hbar}= - =#{battery_percentage}= @@ -268,7 +281,8 @@ Set the battery bar length in terms of amount of symbols. Possible values are: Set the battery bar palette. Possible values are: - =gradient= (default) - =heat= -- =color_full_fg,color_empty_fg,color_bg= with each being an hexadecimal RGB value preceded by a pound symbol =#=. +- =color_full_fg,color_empty_fg,color_bg= with each being an hexadecimal RGB + value preceded by a pound symbol =#=. #+BEGIN_SRC conf-unix tmux_conf_battery_bar_palette='gradient' #tmux_conf_battery_bar_palette='#d70000,#e4e4e4,#000000' @@ -276,14 +290,16 @@ Set the battery bar palette. Possible values are: Set the hbar palette. Possible values are: - =gradient= (default) - =heat= -- =color_full_fg,color_empty_fg,color_bg= with each being an hexadecimal RGB value preceded by a pound symbol =#=. +- =color_full_fg,color_empty_fg,color_bg= with each being an hexadecimal RGB + value preceded by a pound symbol =#=. #+BEGIN_SRC conf-unix tmux_conf_battery_hbar_palette='gradient' #+END_SRC Set the vbar palette. Possible values are: - =gradient= (default) - =heat= -- =color_full_fg,color_empty_fg,color_bg= with each being an hexadecimal RGB value preceded by a pound symbol =#=. +- =color_full_fg,color_empty_fg,color_bg= with each being an hexadecimal RGB + value preceded by a pound symbol =#=. #+BEGIN_SRC conf-unix tmux_conf_battery_vbar_palette='gradient' #+END_SRC @@ -295,7 +311,9 @@ Set symbols used to indicate whether the battery is charging or discharging. # tmux_conf_battery_status_discharging='↓' # U+2193 #tmux_conf_battery_status_charging='🔌 ' # U+1F50C #+END_SRC -Set the clock style. If it is displayed on the right side of the status bar, it might be better to use =%I:%M %p= rather than =%R= in =tmux_conf_theme_status_right=. +Set the clock style. If it is displayed on the right side of the status bar, it +might be better to use =%I:%M %p= rather than =%R= in +=tmux_conf_theme_status_right=. #+BEGIN_SRC conf-unix tmux_conf_theme_clock_colour='#00afff' tmux_conf_theme_clock_style='24' @@ -305,7 +323,8 @@ Set the clock style. If it is displayed on the right side of the status bar, it :PROPERTIES: :CUSTOM_ID: Clipboard-66d0d03a :END: -Whether if in copy mode, copying the selection also copies to the OS clipboard. Possible values are: +Whether if in copy mode, copying the selection also copies to the OS clipboard. +Possible values are: - ~true~ - ~false~ (default) #+BEGIN_SRC conf-unix @@ -316,7 +335,8 @@ Whether if in copy mode, copying the selection also copies to the OS clipboard. :PROPERTIES: :CUSTOM_ID: User_customizations-c913b5d7 :END: -Here we can override or undo some setting from settings from tmux. First, we can increase the history size. +Here we can override or undo some setting from settings from tmux. First, we can +increase the history size. #+BEGIN_SRC conf-unix set -g history-limit 10000 #+END_SRC @@ -324,12 +344,15 @@ We can also start with mouse mode enabled. But I don’t. #+BEGIN_SRC conf-unix #set -g mouse on #+END_SRC -Whether or not Vi mode should be enabled. But really, we should rather export the =VISUAL= or =EDITOR= environment variables, see the tmux manual. Although I don’t, as said in my dotfish, I prefer to use Emacs. +Whether or not Vi mode should be enabled. But really, we should rather export +the =VISUAL= or =EDITOR= environment variables, see the tmux manual. Although I +don’t, as said in my dotfish, I prefer to use Emacs. #+BEGIN_SRC conf-unix #set -g status-keys vi #set -g mode-keys vi #+END_SRC -Replace =C-b= by =C-a= instead of using both prefixes. I personally prefer to just use =C-b=, hence why the lines are commented. +Replace =C-b= by =C-a= instead of using both prefixes. I personally prefer to +just use =C-b=, hence why the lines are commented. #+BEGIN_SRC conf-unix # set -gu prefix2 # unbind C-a