1493 lines
66 KiB
Markdown
1493 lines
66 KiB
Markdown
To improve your CLI skills, focusing on efficiency and mastery of shell commands, here are some tips and techniques:
|
||
|
||
1. **Use Aliases:**
|
||
Create aliases for commonly used commands to save time. For example:
|
||
```sh
|
||
alias cdp='cd ..'
|
||
alias ll='ls -la'
|
||
alias v='vim'
|
||
```
|
||
Add these to your `~/.bashrc` or `~/.zshrc` file.
|
||
|
||
2. **Navigation Shortcuts:**
|
||
- Use `cd -` to quickly switch to the previous directory.
|
||
- Use `cd` with shortcuts like `..` for parent directories or `~` for the home directory.
|
||
- Implement `pushd` and `popd` for managing directory stack:
|
||
```sh
|
||
pushd /path/to/directory
|
||
popd
|
||
```
|
||
|
||
3. **Tab Completion:**
|
||
Leverage tab completion to quickly fill in file and directory names.
|
||
|
||
4. **Search Command History:**
|
||
Use `Ctrl + r` to reverse search through your command history.
|
||
|
||
5. **Bash/Zsh Shortcuts:**
|
||
- `Ctrl + a` moves to the beginning of the line.
|
||
- `Ctrl + e` moves to the end of the line.
|
||
- `Ctrl + w` deletes the word before the cursor.
|
||
- `Ctrl + u` deletes from the cursor to the beginning of the line.
|
||
- `Ctrl + k` deletes from the cursor to the end of the line.
|
||
|
||
6. **Scripting:**
|
||
Write simple scripts for repetitive tasks. For example, to navigate to a commonly used directory and open a file:
|
||
```sh
|
||
#! /bin/bash
|
||
cd ~/repos/the_information_nexus/tech_docs/linux
|
||
vim vim.md
|
||
```
|
||
Save this as `edit_vim_docs.sh` and run it with `./edit_vim_docs.sh`.
|
||
|
||
7. **Combine Commands with && and ;:**
|
||
Combine commands on a single line to streamline workflows:
|
||
```sh
|
||
cd ~/repos/the_information_nexus/projects && vim The-Digital-Pulse-Series.md
|
||
```
|
||
|
||
8. **Use `find` and `grep`:**
|
||
Search for files and content within files efficiently:
|
||
```sh
|
||
find . -name '*.md'
|
||
grep -r 'search_term' .
|
||
```
|
||
|
||
9. **Keyboard Macros:**
|
||
Use `Ctrl + x` followed by `(` and `)` to start and end a keyboard macro in bash, which can be used to repeat a sequence of commands.
|
||
|
||
10. **Automation with `Makefile`:**
|
||
Use Makefiles to define commands you often run, simplifying complex workflows:
|
||
```makefile
|
||
edit_vim_docs:
|
||
cd ~/repos/the_information_nexus/tech_docs/linux && vim vim.md
|
||
```
|
||
|
||
11. **Learning Resources:**
|
||
- **Books:**
|
||
- "The Linux Command Line" by William Shotts
|
||
- "Learning the bash Shell" by Cameron Newham
|
||
- **Online Courses:**
|
||
- Codecademy's Command Line course
|
||
- Udemy's Linux Command Line Basics
|
||
|
||
12. **Experiment with Shell Customization:**
|
||
Customize your shell prompt to include useful information like the current directory, Git branch, etc. For example, using `oh-my-zsh`:
|
||
```sh
|
||
ZSH_THEME="agnoster"
|
||
```
|
||
|
||
Implementing these tips will help you become more efficient and powerful with your command-line skills.
|
||
|
||
---
|
||
|
||
Sure, let's start from the beginning and set up Vim with syntax highlighting support for Markdown, Python, and JavaScript on your Debian 12 system.
|
||
|
||
### Step-by-Step Guide
|
||
|
||
#### Step 1: Install Vim
|
||
|
||
1. **Open your terminal.**
|
||
2. **Update your package list:**
|
||
```sh
|
||
sudo apt update
|
||
```
|
||
3. **Install Vim:**
|
||
```sh
|
||
sudo apt install vim
|
||
```
|
||
|
||
#### Step 2: Install Vim-Plug (Plugin Manager)
|
||
|
||
1. **Install Vim-Plug:**
|
||
```sh
|
||
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||
```
|
||
|
||
#### Step 3: Configure `.vimrc` File
|
||
|
||
1. **Create or open your `.vimrc` file:**
|
||
```sh
|
||
vim ~/.vimrc
|
||
```
|
||
|
||
2. **Add the following configuration to your `.vimrc` file:**
|
||
|
||
```vim
|
||
" Enable syntax highlighting
|
||
syntax on
|
||
|
||
" Set line numbers
|
||
set number
|
||
|
||
" Enable filetype detection and plugins
|
||
filetype plugin on
|
||
filetype indent on
|
||
|
||
" Set basic editing settings
|
||
set tabstop=4
|
||
set shiftwidth=4
|
||
set expandtab
|
||
set autoindent
|
||
set smartindent
|
||
|
||
" Enable mouse support
|
||
set mouse=a
|
||
|
||
" Initialize Vim-Plug
|
||
call plug#begin('~/.vim/plugged')
|
||
|
||
" Markdown plugin for syntax highlighting
|
||
Plug 'plasticboy/vim-markdown'
|
||
|
||
" Python syntax highlighting
|
||
Plug 'vim-python/python-syntax'
|
||
|
||
" JavaScript syntax highlighting
|
||
Plug 'pangloss/vim-javascript'
|
||
|
||
call plug#end()
|
||
|
||
" Disable folding for Markdown files
|
||
let g:vim_markdown_folding_disabled = 1
|
||
```
|
||
|
||
3. **Save and exit the `.vimrc` file:**
|
||
Press `Esc`, then type `:wq` and hit `Enter`.
|
||
|
||
#### Step 4: Install the Plugins
|
||
|
||
1. **Open Vim:**
|
||
```sh
|
||
vim
|
||
```
|
||
|
||
2. **Install the plugins by running the following command in Vim:**
|
||
```vim
|
||
:PlugInstall
|
||
```
|
||
|
||
#### Step 5: Verify Syntax Highlighting
|
||
|
||
1. **Open a Markdown file to check syntax highlighting:**
|
||
```sh
|
||
vim yourfile.md
|
||
```
|
||
|
||
2. **Open a Python file to check syntax highlighting:**
|
||
```sh
|
||
vim yourfile.py
|
||
```
|
||
|
||
3. **Open a JavaScript file to check syntax highlighting:**
|
||
```sh
|
||
vim yourfile.js
|
||
```
|
||
|
||
By following these steps, you should have Vim installed with syntax highlighting support for Markdown, Python, and JavaScript. The configuration ensures that your `.vimrc` is properly set up to use Vim-Plug for managing plugins, and you can enjoy enhanced editing features for these file types.
|
||
|
||
---
|
||
|
||
In Vim, to move to the top of the document, select all text, and then either delete or yank (copy) it, you'll use different sequences of commands depending on what you want to accomplish. Here are the steps for each action:
|
||
|
||
1. **Move to the Top and Select All Text**:
|
||
- You can use `ggVG` to select all text in the document. Here's how it breaks down:
|
||
- `gg` moves the cursor to the first line of the document.
|
||
- `V` starts visual line mode.
|
||
- `G` extends the selection to the last line of the document.
|
||
|
||
2. **Delete the Selected Text**:
|
||
- After selecting the text with `ggVG`, you can press `d` to delete the selected text.
|
||
|
||
3. **Yank (Copy) the Selected Text**:
|
||
- After selecting the text with `ggVG`, you can press `y` to yank the selected text.
|
||
|
||
Here’s how you can remember and execute these commands:
|
||
- To delete all text: `ggVGd`
|
||
- To yank (copy) all text: `ggVGy`
|
||
|
||
These commands make it easy to quickly manipulate large sections of text in Vim.
|
||
|
||
---
|
||
|
||
## Vim Productivity Tips and Tricks
|
||
|
||
### Faster File Navigation and Selection Techniques
|
||
|
||
1. Jumping to specific lines:
|
||
- `:{line-number}` - Jump to a specific line number.
|
||
- `{count}G` - Jump to a specific line number using the `G` command.
|
||
- `{count}%` - Jump to a percentage of the file (e.g., `50%` jumps to the middle of the file).
|
||
|
||
2. Navigating between matching brackets:
|
||
- `%` - Jump to the matching bracket, parenthesis, or brace.
|
||
|
||
3. Selecting text objects:
|
||
- `v{motion}` - Select text based on a motion (e.g., `viw` selects the current word, `vip` selects the current paragraph).
|
||
- `V{motion}` - Select lines based on a motion (e.g., `Vip` selects the current paragraph, including the newline).
|
||
|
||
4. Jumping to specific characters:
|
||
- `f{char}` - Jump to the next occurrence of the specified character in the current line.
|
||
- `F{char}` - Jump to the previous occurrence of the specified character in the current line.
|
||
- `t{char}` - Jump to just before the next occurrence of the specified character in the current line.
|
||
- `T{char}` - Jump to just after the previous occurrence of the specified character in the current line.
|
||
|
||
5. Navigating between changes:
|
||
- `g;` - Jump to the previous change in the changelist.
|
||
- `g,` - Jump to the next change in the changelist.
|
||
|
||
### Advanced Search and Replace Patterns
|
||
|
||
1. Case-sensitive search:
|
||
- `/\C{pattern}` - Perform a case-sensitive search for the specified pattern.
|
||
|
||
2. Search for whole words:
|
||
- `/\<{word}\>` - Search for the specified word as a whole word.
|
||
|
||
3. Search with regular expressions:
|
||
- `/\v{regex}` - Search using regular expressions (e.g., `/\v(\d{3})-(\d{3})-(\d{4})` searches for phone numbers in the format "123-456-7890").
|
||
|
||
4. Replace with special characters:
|
||
- `:%s/{pattern}/{replacement}/g` - Replace all occurrences of the pattern with the replacement text. Use `\r` for newlines, `\t` for tabs, and `\\` for backslashes in the replacement text.
|
||
|
||
5. Replace with captured groups:
|
||
- `:%s/{pattern}/\1/g` - Replace all occurrences of the pattern with the first captured group. Use `\2`, `\3`, etc., for subsequent captured groups.
|
||
|
||
### Efficient Use of Marks and Jumps
|
||
|
||
1. Setting marks:
|
||
- `m{mark}` - Set a mark at the current cursor position (e.g., `ma` sets mark "a").
|
||
|
||
2. Jumping to marks:
|
||
- `'{mark}` - Jump to the line where the specified mark is located.
|
||
- `` `{mark}`` - Jump to the exact position where the specified mark is located.
|
||
|
||
3. Viewing the mark list:
|
||
- `:marks` - Display the list of marks and their locations.
|
||
|
||
4. Jumping between jumps:
|
||
- `<Ctrl-o>` - Jump to the previous location in the jump list.
|
||
- `<Ctrl-i>` - Jump to the next location in the jump list.
|
||
|
||
5. Viewing the jump list:
|
||
- `:jumps` - Display the list of jumps and their locations.
|
||
|
||
### Leveraging Vim's Built-in Help System
|
||
|
||
1. Opening help:
|
||
- `:help {topic}` - Open the help documentation for the specified topic (e.g., `:help navigation`).
|
||
|
||
2. Searching within help:
|
||
- `/{pattern}` - Search for the specified pattern within the help documentation.
|
||
|
||
3. Following help links:
|
||
- `<Ctrl-]>` - Follow a help link (jump to the linked topic).
|
||
- `<Ctrl-t>` - Jump back from a followed help link.
|
||
|
||
4. Opening help in a split window:
|
||
- `:vert help {topic}` - Open the help documentation in a vertical split window.
|
||
|
||
5. Exploring the help system:
|
||
- `:help` - Open the main help index.
|
||
- `:helpgrep {pattern}` - Search for the specified pattern across all help files.
|
||
|
||
Remember, the key to mastering these productivity tips is practice. Incorporate them into your daily Vim workflow, and they'll soon become second nature, enabling you to navigate and edit files with greater speed and efficiency.
|
||
|
||
## Vim Productivity Tips and Tricks
|
||
|
||
### Core Document Editing
|
||
|
||
1. Formatting paragraphs:
|
||
- `gqip` - Format the current paragraph to fit within the specified text width.
|
||
- `:set textwidth={width}` - Set the desired text width for formatting (e.g., `:set textwidth=80`).
|
||
- Example: Easily format long paragraphs in documents, emails, or README files.
|
||
|
||
2. Spell checking:
|
||
- `:set spell` - Enable spell checking.
|
||
- `]s` - Jump to the next misspelled word.
|
||
- `[s` - Jump to the previous misspelled word.
|
||
- `z=` - Suggest corrections for the misspelled word under the cursor.
|
||
- Example: Quickly identify and fix spelling errors in documents or text files.
|
||
|
||
3. Counting words, lines, and characters:
|
||
- `g Ctrl-g` - Display word, line, and character count for the current document.
|
||
- Example: Monitor the length of your writing in real-time, especially useful for meeting word count requirements.
|
||
|
||
### Programming and Code Editing
|
||
|
||
1. Commenting and uncommenting code:
|
||
- `gcc` - Comment out the current line using the language-specific comment syntax.
|
||
- `gc{motion}` - Comment out the lines covered by the specified motion (e.g., `gcip` comments out the current paragraph).
|
||
- Example: Quickly comment or uncomment blocks of code during development and debugging.
|
||
|
||
2. Indenting and unindenting code:
|
||
- `>>{motion}` - Indent the lines covered by the specified motion (e.g., `>}` indents the current code block).
|
||
- `<<{motion}` - Unindent the lines covered by the specified motion.
|
||
- Example: Easily adjust the indentation of code blocks to improve readability and adhere to coding conventions.
|
||
|
||
3. Jumping to function definitions:
|
||
- `[{` - Jump to the previous function definition.
|
||
- `]}` - Jump to the next function definition.
|
||
- Example: Quickly navigate between functions in a source code file, enhancing code comprehension and analysis.
|
||
|
||
### Media Creation and Editing
|
||
|
||
1. Editing multiple lines simultaneously:
|
||
- `Ctrl-v` - Enter visual block mode.
|
||
- Select the desired lines and columns using motion keys.
|
||
- `I{text} Esc` - Insert the specified text at the beginning of each selected line.
|
||
- Example: Efficiently add prefixes or suffixes to multiple lines in structured data files, such as CSV or TSV.
|
||
|
||
2. Sorting lines:
|
||
- `:sort` - Sort the lines in the current selection or entire file.
|
||
- `:sort!` - Sort the lines in reverse order.
|
||
- Example: Quickly sort lists, data entries, or log files for better organization and analysis.
|
||
|
||
3. Aligning text:
|
||
- `:left`, `:center`, or `:right` - Left-align, center-align, or right-align the current selection or line.
|
||
- Example: Format text-based tables, lists, or presentations to improve readability and visual appeal.
|
||
|
||
### Advanced Search and Replace
|
||
|
||
1. Searching for patterns across multiple files:
|
||
- `:vimgrep /{pattern}/g {files}` - Search for the specified pattern in the given files.
|
||
- `:cn` - Jump to the next match.
|
||
- `:cp` - Jump to the previous match.
|
||
- Example: Find occurrences of a specific keyword or code snippet across a project or directory.
|
||
|
||
2. Replacing with confirmation:
|
||
- `:%s/{pattern}/{replacement}/gc` - Replace all occurrences of the pattern with the replacement text, prompting for confirmation before each replacement.
|
||
- Example: Selectively replace text or code, reviewing each change before applying it.
|
||
|
||
3. Saving and reusing search patterns:
|
||
- `/` - Enter search mode and type the desired pattern.
|
||
- `:let @/ = '{pattern}'` - Save the current search pattern to the search register.
|
||
- `n` - Jump to the next occurrence of the saved search pattern.
|
||
- Example: Quickly reuse complex search patterns across multiple editing sessions.
|
||
|
||
### Workflow Integration
|
||
|
||
1. Executing external commands:
|
||
- `:!{command}` - Execute the specified external command in the shell.
|
||
- Example: Run code formatters, linters, or build tools without leaving Vim.
|
||
|
||
2. Filtering text through external commands:
|
||
- `{range}!{command}` - Pass the specified range of lines through an external command and replace the content with the command's output.
|
||
- Example: Format code, minify CSS/JS, or convert data using external tools seamlessly within Vim.
|
||
|
||
3. Managing sessions:
|
||
- `:mksession {file}` - Save the current Vim session to a file.
|
||
- `:source {file}` - Load a previously saved Vim session.
|
||
- Example: Preserve and restore complex workspace setups, including open files, splits, and settings.
|
||
|
||
Remember, these examples are just the tip of the iceberg! Vim's flexibility and extensive feature set allow you to adapt these techniques to your specific needs and workflows. Experiment, combine, and customize these tips to unlock new levels of productivity in your editing process.
|
||
|
||
# Mastering Data Manipulation and Analysis with Vim
|
||
|
||
## Introduction
|
||
As a data analyst or engineer, you often find yourself working with a variety of structured data files, such as XML, YAML, JSON, CSV, SQL, and more. Efficiently navigating, manipulating, and analyzing these files is crucial for your productivity. Vim, coupled with powerful command-line tools like sed and awk, provides a robust and flexible environment for tackling data-related tasks.
|
||
|
||
In this guide, we'll explore advanced techniques, practical examples, and valuable tips to help you master data manipulation and analysis using Vim and its ecosystem of tools.
|
||
|
||
## 1. Navigating and Editing Structured Data Files
|
||
|
||
### 1.1 Syntax Highlighting and Folding
|
||
- Enable syntax highlighting for better readability:
|
||
- `:set syntax=xml`, `:set syntax=json`, etc.
|
||
- Use folding to collapse and expand sections:
|
||
- `zi` - Toggle folding.
|
||
- `zc` - Close the current fold.
|
||
- `zo` - Open the current fold.
|
||
- Example: Collapse and expand XML tags, JSON objects, or YAML blocks for easier navigation.
|
||
|
||
### 1.2 Jumping to Specific Sections
|
||
- Use Vim's built-in search features to quickly navigate to specific sections:
|
||
- `/pattern` - Search forward for a pattern.
|
||
- `?pattern` - Search backward for a pattern.
|
||
- `n` - Jump to the next search match.
|
||
- `N` - Jump to the previous search match.
|
||
- Example: Search for specific XML tags, JSON keys, or CSV headers.
|
||
|
||
### 1.3 Formatting and Indentation
|
||
- Automate indentation and formatting for structured files:
|
||
- `gg=G` - Indent the entire file.
|
||
- `={motion}` - Indent the specified lines or motion.
|
||
- Example: Automatically format JSON files or SQL queries for better readability.
|
||
|
||
## 2. Data Transformation and Manipulation
|
||
|
||
### 2.1 Regular Expressions and Substitution
|
||
- Leverage Vim's powerful regular expressions for complex data transformations:
|
||
- `:%s/{regex}/{replacement}/g` - Replace all occurrences of the regex pattern with the replacement text.
|
||
- Example: Extract specific fields from CSV files, replace XML tags, or reformat JSON data.
|
||
|
||
### 2.2 Filtering and Sorting
|
||
- Use external tools like sed and awk for advanced filtering and sorting:
|
||
- `:%!sed 's/{pattern}/{replacement}/g'` - Filter and replace using sed.
|
||
- `:%!awk '{print $1, $3}'` - Filter and rearrange columns using awk.
|
||
- Example: Extract specific columns from CSV files, filter log entries based on patterns, or sort data based on a key.
|
||
|
||
### 2.3 Batch Processing and Macros
|
||
- Automate repetitive data manipulation tasks using Vim macros:
|
||
- `q{register}` - Start recording a macro in the specified register.
|
||
- `q` - Stop recording the macro.
|
||
- `@{register}` - Play back the recorded macro.
|
||
- Example: Apply a series of transformations to multiple lines or files, such as formatting CSV data or updating JSON fields.
|
||
|
||
## 3. Integrating with Command-Line Tools
|
||
|
||
### 3.1 Executing External Commands
|
||
- Run command-line tools directly from Vim:
|
||
- `:!{command}` - Execute the specified command in the shell.
|
||
- Example: Run data processing scripts, invoke data analysis tools, or trigger data pipelines.
|
||
|
||
### 3.2 Piping and Redirection
|
||
- Pipe Vim buffer content through external commands and redirect the output:
|
||
- `:{range}!{command}` - Pipe the specified range of lines through an external command.
|
||
- `:{range}w !{command}` - Redirect the specified range of lines to an external command.
|
||
- Example: Pipe SQL query results to a formatting tool or redirect JSON data to a validation script.
|
||
|
||
### 3.3 Vim as a Command-Line Tool
|
||
- Use Vim as a powerful command-line tool for data processing:
|
||
- `vim -c '{command}' {file}` - Open a file and execute the specified Vim command.
|
||
- Example: Perform bulk search and replace operations, reformat data files, or apply complex transformations.
|
||
|
||
## 4. Data Visualization and Reporting
|
||
|
||
### 4.1 ASCII Tables and Graphs
|
||
- Create ASCII tables and graphs directly in Vim:
|
||
- Use Vim's drawing capabilities to create tables and borders.
|
||
- Leverage external tools like gnuplot or ASCII charting libraries.
|
||
- Example: Generate quick data summaries, visualize trends, or create simple reports.
|
||
|
||
### 4.2 Markdown and Reporting
|
||
- Use Vim's Markdown support for generating data reports:
|
||
- `:set filetype=markdown` - Set the file type to Markdown.
|
||
- Use Markdown syntax for headers, tables, and formatting.
|
||
- Example: Create structured data reports, documentation, or analysis summaries.
|
||
|
||
## 5. Best Practices and Tips
|
||
|
||
### 5.1 Customizing Vim for Data Work
|
||
- Tailor Vim settings and mappings for data manipulation tasks:
|
||
- Create custom mappings for frequently used commands or tools.
|
||
- Customize syntax highlighting and file type detection.
|
||
- Example: Set up a dedicated Vim configuration for data analysis projects.
|
||
|
||
### 5.2 Vim Plugins for Data Analysis
|
||
- Explore Vim plugins specifically designed for data manipulation and analysis:
|
||
- CSV plugins for enhanced CSV file handling.
|
||
- JSON plugins for formatting and validation.
|
||
- Database plugins for querying and interacting with databases.
|
||
- Example: Streamline your data workflows with specialized plugins.
|
||
|
||
### 5.3 Collaboration and Version Control
|
||
- Integrate Vim with version control systems for collaborative data work:
|
||
- Use Vim's diff mode to compare and merge data files.
|
||
- Leverage plugins for seamless integration with Git, SVN, or other VCS.
|
||
- Example: Track changes, review data modifications, and collaborate with peers.
|
||
|
||
## Conclusion
|
||
By mastering Vim's advanced features and integrating it with powerful command-line tools, you can significantly enhance your productivity and efficiency when working with structured data files and performing data analysis tasks. The combination of Vim's flexibility, regex capabilities, and seamless integration with external tools makes it an indispensable asset in your data manipulation and analysis workflow.
|
||
|
||
Remember to practice these techniques regularly, adapt them to your specific needs, and continuously explore new ways to leverage Vim's capabilities in your data-related tasks. Happy data analysis and manipulation with Vim!
|
||
|
||
# Advanced Data Manipulation and Analysis with Vim
|
||
|
||
## 6. Data Pipelines and Preprocessing
|
||
|
||
### 6.1 Building Data Pipelines with Vim
|
||
- Use Vim as the centerpiece of your data preprocessing pipeline:
|
||
- Combine Vim commands with external tools to create powerful data transformations.
|
||
- Chain multiple Vim commands and external tools using pipes and redirections.
|
||
- Example: Preprocess large datasets, clean and transform data, and prepare it for analysis.
|
||
|
||
### 6.2 Automating Data Preprocessing Tasks
|
||
- Create Vim scripts and functions to automate common preprocessing tasks:
|
||
- Write custom Vim functions to encapsulate complex data transformations.
|
||
- Use Vim's built-in scripting capabilities to create reusable preprocessing scripts.
|
||
- Example: Automate data cleaning, normalization, or feature extraction tasks.
|
||
|
||
### 6.3 Batch Processing and Parallel Execution
|
||
- Leverage Vim's batch processing capabilities for efficient data processing:
|
||
- Use Vim's `argdo` and `bufdo` commands to apply commands across multiple files.
|
||
- Combine Vim with parallel execution tools like GNU Parallel for faster processing.
|
||
- Example: Preprocess multiple data files simultaneously or distribute data processing across multiple cores.
|
||
|
||
## 7. Scripting and Automation
|
||
|
||
### 7.1 Vimscript for Data Manipulation
|
||
- Harness the power of Vimscript to create custom data manipulation functions:
|
||
- Write Vimscript functions to encapsulate complex data transformations.
|
||
- Use Vimscript variables, loops, and conditionals for flexible data processing.
|
||
- Example: Create custom functions to parse and transform specific data formats.
|
||
|
||
### 7.2 Integrating with Shell Scripts
|
||
- Combine Vim with shell scripting for advanced data processing tasks:
|
||
- Call shell scripts from within Vim to perform external data manipulations.
|
||
- Pass data between Vim and shell scripts using pipes and redirections.
|
||
- Example: Integrate Vim with data processing shell scripts or command-line tools.
|
||
|
||
### 7.3 Vim as a Scripting Environment
|
||
- Use Vim as a complete scripting environment for data analysis:
|
||
- Leverage Vim's built-in features and plugins to create data analysis scripts.
|
||
- Combine Vim with other scripting languages like Python or Lua for extended functionality.
|
||
- Example: Create data analysis scripts that combine Vim's text manipulation capabilities with statistical computations.
|
||
|
||
## 8. Integration with Programming Languages
|
||
|
||
### 8.1 Vim and Python for Data Analysis
|
||
- Integrate Vim with Python for powerful data analysis capabilities:
|
||
- Use Vim as a Python development environment with plugins like `vim-python`.
|
||
- Execute Python code directly from Vim and capture the results.
|
||
- Example: Perform data analysis tasks, create visualizations, or interact with data libraries using Python within Vim.
|
||
|
||
### 8.2 Vim and R for Statistical Analysis
|
||
- Combine Vim with R for statistical analysis and data visualization:
|
||
- Use Vim as an R development environment with plugins like `Nvim-R`.
|
||
- Execute R code from Vim and view the results directly in the editor.
|
||
- Example: Perform statistical tests, create plots, or run R scripts seamlessly within Vim.
|
||
|
||
### 8.3 Vim and SQL Databases
|
||
- Interact with SQL databases directly from Vim:
|
||
- Use Vim plugins like `dbext` or `vim-dadbod` to connect to databases.
|
||
- Execute SQL queries, browse result sets, and manipulate data from within Vim.
|
||
- Example: Query databases, explore data schemas, or perform data transformations using SQL within Vim.
|
||
|
||
## 9. Data Exploration and Visualization
|
||
|
||
### 9.1 Interactive Data Exploration
|
||
- Use Vim as an interactive environment for data exploration:
|
||
- Leverage Vim's split windows and buffers to compare and analyze data side by side.
|
||
- Use Vim's search and filter capabilities to quickly find patterns and insights.
|
||
- Example: Explore large datasets, compare data subsets, or investigate anomalies interactively.
|
||
|
||
### 9.2 Data Visualization with Vim
|
||
- Create data visualizations directly within Vim:
|
||
- Use ASCII charting libraries or plugins to render charts and graphs.
|
||
- Integrate Vim with external data visualization tools for more advanced visualizations.
|
||
- Example: Create quick data visualizations, plot trends, or visualize data distributions.
|
||
|
||
### 9.3 Literate Programming and Notebooks
|
||
- Combine Vim with literate programming tools for reproducible data analysis:
|
||
- Use Vim as a notebook environment with plugins like `vim-notebook`.
|
||
- Mix code, documentation, and results in a single Vim buffer for literate programming.
|
||
- Example: Create data analysis notebooks, document your analysis process, and share reproducible results.
|
||
|
||
## 10. Collaboration and Reproducibility
|
||
|
||
### 10.1 Collaborative Data Analysis with Vim
|
||
- Use Vim's collaboration features for team-based data analysis:
|
||
- Leverage Vim's built-in diff and merge tools for comparing and merging data files.
|
||
- Use Vim's version control integration for tracking data changes and collaborating with others.
|
||
- Example: Share data analysis scripts, collaborate on data preprocessing tasks, or review data changes.
|
||
|
||
### 10.2 Reproducible Data Workflows
|
||
- Ensure reproducibility in your data analysis workflows with Vim:
|
||
- Use Vim's project-specific configurations and settings for consistent environments.
|
||
- Document your data analysis steps, dependencies, and configurations within Vim.
|
||
- Example: Create reproducible data analysis projects, share analysis workflows, or enable others to replicate your results.
|
||
|
||
### 10.3 Integration with Reproducibility Tools
|
||
- Combine Vim with reproducibility tools and platforms:
|
||
- Integrate Vim with tools like Docker or Jupyter for reproducible data analysis environments.
|
||
- Use Vim as a front-end for accessing and manipulating data in reproducible workflows.
|
||
- Example: Create reproducible data analysis containers, interact with Jupyter notebooks, or integrate Vim with workflow management systems.
|
||
|
||
## Conclusion
|
||
By leveraging Vim's advanced features, scripting capabilities, and integration with various tools and programming languages, you can create powerful and efficient data manipulation and analysis workflows. Whether you're preprocessing large datasets, performing statistical analysis, or creating visualizations, Vim provides a flexible and extensible environment for all your data-related tasks.
|
||
|
||
Remember to experiment with different techniques, customize Vim to suit your specific needs, and continuously learn from the vibrant Vim community. With practice and exploration, you'll be able to tackle even the most complex data challenges using Vim as your go-to tool.
|
||
|
||
Happy data manipulation and analysis with Vim!
|
||
|
||
Certainly! Let's break down the provided `.vimrc` file and explain each section to help you understand how to build your own Vim configuration. We'll go through the file section by section, providing explanations and best practices along the way.
|
||
|
||
```vim
|
||
" General Settings
|
||
|
||
set number " Show line numbers
|
||
set tabstop=4 " Number of spaces that a <Tab> in the file counts for
|
||
set shiftwidth=4 " Number of spaces to use for each step of (auto)indent
|
||
set expandtab " Use spaces instead of tabs
|
||
set smartindent " Enable smart indent
|
||
set autoindent " Enable auto indenting
|
||
set wrap " Wrap lines
|
||
set linebreak " Break lines at word (requires 'wrap')
|
||
set nocompatible " Turn off compatibility with legacy vi
|
||
filetype plugin indent on " Enable filetype detection for automatic indenting
|
||
set backspace=indent,eol,start " Make backspace key more powerful
|
||
syntax enable " Turn on syntax highlighting
|
||
set showcmd " Show command in bottom bar
|
||
set wildmenu " Visual autocomplete for command menu
|
||
set ignorecase " Ignore case when searching
|
||
set smartcase " Override ignorecase if search pattern contains uppercase characters
|
||
set incsearch " Show search matches as you type
|
||
set hlsearch " Highlight search matches
|
||
```
|
||
|
||
This section contains general settings for Vim. Here's what each setting does:
|
||
- `set number`: Displays line numbers in the editor.
|
||
- `set tabstop=4`: Sets the number of spaces that a tab character counts for.
|
||
- `set shiftwidth=4`: Sets the number of spaces to use for each step of indentation.
|
||
- `set expandtab`: Replaces tabs with spaces.
|
||
- `set smartindent` and `set autoindent`: Enables intelligent and automatic indentation.
|
||
- `set wrap` and `set linebreak`: Wraps long lines and breaks them at word boundaries.
|
||
- `set nocompatible`: Disables compatibility with legacy vi, enabling Vim-specific features.
|
||
- `filetype plugin indent on`: Enables filetype detection for automatic indentation based on file type.
|
||
- `set backspace=indent,eol,start`: Allows the backspace key to delete indentation, line breaks, and beyond the start of the current line.
|
||
- `syntax enable`: Enables syntax highlighting.
|
||
- `set showcmd`: Shows the command being typed in the bottom bar.
|
||
- `set wildmenu`: Enables visual autocomplete for the command menu.
|
||
- `set ignorecase` and `set smartcase`: Configures case-insensitive searching, but overrides it if the search pattern contains uppercase characters.
|
||
- `set incsearch` and `set hlsearch`: Highlights search matches as you type and after the search is completed.
|
||
|
||
```vim
|
||
" Enhanced File Type Support
|
||
|
||
augroup filetype_html_markdown_csv_sql
|
||
autocmd!
|
||
autocmd FileType html,markdown,csv,sql setlocal tabstop=2 shiftwidth=2 expandtab
|
||
augroup END
|
||
```
|
||
|
||
This section defines an `augroup` (autocmd group) for enhanced file type support. It sets specific settings for HTML, Markdown, CSV, and SQL files. The `autocmd!` command clears any existing autocommands in the group to prevent duplicates. The `autocmd FileType` command sets `tabstop`, `shiftwidth`, and `expandtab` to 2 for the specified file types, ensuring consistent indentation.
|
||
|
||
```vim
|
||
" Python-specific settings
|
||
|
||
let python_highlight_all=1
|
||
set fileformat=unix
|
||
au BufNewFile,BufRead *.py \
|
||
\ setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab autoindent fileencoding=utf-8
|
||
```
|
||
|
||
This section contains Python-specific settings. It enables enhanced Python syntax highlighting with `let python_highlight_all=1`. The `set fileformat=unix` command sets the file format to Unix-style line endings. The `au BufNewFile,BufRead *.py` autocommand sets specific settings for Python files, including tab settings, automatic indentation, and file encoding.
|
||
|
||
```vim
|
||
" Enhanced Syntax Highlighting with Plugins (assuming use of a plugin manager)
|
||
|
||
" Plug 'sheerun/vim-polyglot' " Uncomment if you use Vim-Plug
|
||
" Plug 'plasticboy/vim-markdown' " Markdown-specific enhancements
|
||
```
|
||
|
||
This section is commented out but shows an example of how to enhance syntax highlighting using plugins. In this case, it suggests using the `vim-polyglot` plugin for enhanced syntax support and the `vim-markdown` plugin for Markdown-specific enhancements. These lines would be uncommented if you are using a plugin manager like Vim-Plug.
|
||
|
||
```vim
|
||
" Mapping keys for more efficient navigation and editing
|
||
|
||
nnoremap <Space> <Nop>
|
||
nnoremap <C-j> <C-w>j
|
||
nnoremap <C-k> <C-w>k
|
||
nnoremap <C-l> <C-w>l
|
||
nnoremap <C-h> <C-w>h
|
||
```
|
||
|
||
This section defines custom key mappings for more efficient navigation and editing. The `nnoremap` command creates a non-recursive normal mode mapping. In this case, it maps:
|
||
- `<Space>` to `<Nop>`, which disables the default behavior of the spacebar.
|
||
- `<C-j>`, `<C-k>`, `<C-l>`, and `<C-h>` to window navigation commands for moving between split windows.
|
||
|
||
```vim
|
||
" Disable arrow keys in normal mode to encourage hjkl navigation
|
||
|
||
noremap <Up> <Nop>
|
||
noremap <Down> <Nop>
|
||
noremap <Left> <Nop>
|
||
noremap <Right> <Nop>
|
||
```
|
||
|
||
This section disables the arrow keys in normal mode to encourage using the `hjkl` keys for navigation. It maps the arrow keys to `<Nop>`, effectively disabling them.
|
||
|
||
```vim
|
||
" Plugin Management Example with Vim-Plug (Uncomment to use)
|
||
|
||
" call plug#begin('~/.vim/plugged')
|
||
" Plug 'sheerun/vim-polyglot' " Enhanced syntax support
|
||
" Plug 'plasticboy/vim-markdown' " Markdown-specific enhancements
|
||
" call plug#end()
|
||
|
||
" Remember to install plugins with :PlugInstall if you use Vim-Plug
|
||
```
|
||
|
||
This section provides an example of how to manage plugins using the Vim-Plug plugin manager. The lines are commented out, but if you uncomment them and have Vim-Plug installed, you can use the `plug#begin()` and `plug#end()` functions to specify the plugins you want to use. In this case, it includes the `vim-polyglot` and `vim-markdown` plugins. After uncommenting and saving the file, you would need to run `:PlugInstall` in Vim to install the plugins.
|
||
|
||
```vim
|
||
set rtp+=/opt/homebrew/opt/fzf
|
||
```
|
||
|
||
This line adds the `fzf` (fuzzy finder) plugin to Vim's runtime path. It assumes that `fzf` is installed using Homebrew on macOS at the specified location.
|
||
|
||
Remember to customize the `.vimrc` file based on your preferences and needs. You can add or remove settings, plugins, and mappings as desired. It's also a good idea to document your configuration with comments to make it easier to understand and maintain.
|
||
|
||
I hope this breakdown of the `.vimrc` file helps you understand how to build your own Vim configuration! Let me know if you have any further questions.
|
||
|
||
---
|
||
|
||
# Vim Guide
|
||
|
||
## Introduction
|
||
|
||
Vim is a powerful text editor that utilizes a modal editing approach, allowing users to perform complex text manipulations efficiently and with minimal keystrokes. By mastering Vim's modal editing paradigm, users can significantly increase their productivity and streamline their workflow.
|
||
|
||
Key benefits of using Vim include:
|
||
|
||
- Increased efficiency through modal editing and powerful commands
|
||
- High level of customization and extensibility
|
||
- Ubiquity across Unix-based systems and remote development environments
|
||
|
||
This guide will cover the essential concepts and commands that form the foundation of Vim's modal editing.
|
||
|
||
## Essential Vim Modes
|
||
|
||
### Normal Mode
|
||
|
||
Normal mode is the default mode in Vim and is used for navigation and text manipulation. In Normal mode, keys perform different actions based on their assigned functions.
|
||
|
||
### Insert Mode
|
||
|
||
Insert mode is used for entering and editing text. In Insert mode, keys function as they would in a traditional text editor, inserting characters at the cursor position.
|
||
|
||
### Visual Mode
|
||
|
||
Visual mode is used for selecting text and performing operations on the selected text. There are three types of Visual mode: character-wise, line-wise, and block-wise.
|
||
|
||
### Command-line Mode
|
||
|
||
Command-line mode is used for executing commands, searching, and performing ex commands. To enter Command-line mode from Normal mode, press the `:` key.
|
||
|
||
## Key Commands and Motions
|
||
|
||
### Basic Navigation
|
||
|
||
- `h`, `j`, `k`, `l`: Move the cursor left, down, up, and right, respectively.
|
||
- `w`, `b`, `e`: Move the cursor to the beginning of the next word, the beginning of the previous word, or the end of the current word.
|
||
- `0`, `$`: Move the cursor to the beginning or end of the line.
|
||
- `gg`, `G`: Move the cursor to the first or last line of the file.
|
||
|
||
### Text Manipulation
|
||
|
||
- `y`: Yank (copy) the selected text.
|
||
- `d`: Delete the selected text.
|
||
- `p`, `P`: Paste the yanked or deleted text after or before the cursor.
|
||
- `u`: Undo the last change.
|
||
- `<Ctrl-r>`: Redo the last undone change.
|
||
|
||
### Search and Replace
|
||
|
||
- `/pattern`, `?pattern`: Search forward or backward for the specified pattern.
|
||
- `n`, `N`: Move to the next or previous occurrence of the search pattern.
|
||
- `:s/old/new/g`: Replace all occurrences of "old" with "new" in the current line.
|
||
- `:%s/old/new/g`: Replace all occurrences of "old" with "new" in the entire file.
|
||
|
||
### Working with Multiple Files
|
||
|
||
- `:e filename`: Open the specified file in a new buffer.
|
||
- `:bn`, `:bp`: Move to the next or previous buffer.
|
||
- `:ls`: List all open buffers.
|
||
- `:b<n>`: Switch to the buffer with the specified number.
|
||
- `:sp`, `:vsp`: Split the window horizontally or vertically.
|
||
|
||
## Configuring Vim with .vimrc
|
||
|
||
### Essential Settings
|
||
|
||
- `syntax on`: Enable syntax highlighting.
|
||
- `set number`: Display line numbers.
|
||
- `set ignorecase`: Use case-insensitive search by default.
|
||
- `set smartcase`: Override `ignorecase` when the search pattern contains uppercase characters.
|
||
- `set incsearch`: Show search matches as you type.
|
||
- `set hlsearch`: Highlight search matches.
|
||
- `set tabstop=4`: Set the width of a tab character to 4 spaces.
|
||
- `set shiftwidth=4`: Set the number of spaces to use for autoindentation.
|
||
- `set expandtab`: Use spaces instead of tabs for indentation.
|
||
|
||
### Key Mappings
|
||
|
||
- `let mapleader = ","`: Set the leader key to comma (`,`).
|
||
- `nnoremap <leader>w :w<CR>`: Map `<leader>w` to save the current file.
|
||
- `nnoremap <leader>q :q<CR>`: Map `<leader>q` to quit Vim.
|
||
- `nnoremap <leader>h :nohlsearch<CR>`: Map `<leader>h` to clear search highlighting.
|
||
|
||
### Plugin Management
|
||
|
||
Vim has a rich plugin ecosystem that extends its functionality. Popular plugin managers include:
|
||
|
||
- [vim-plug](https://github.com/junegunn/vim-plug)
|
||
- [Vundle](https://github.com/VundleVim/Vundle.vim)
|
||
- [Pathogen](https://github.com/tpope/vim-pathogen)
|
||
|
||
Some recommended plugins for various use cases:
|
||
|
||
- [NERDTree](https://github.com/preservim/nerdtree): File system explorer.
|
||
- [ctrlp.vim](https://github.com/ctrlpvim/ctrlp.vim): Fuzzy file finder.
|
||
- [lightline.vim](https://github.com/itchyny/lightline.vim): Configurable status line.
|
||
- [vim-surround](https://github.com/tpope/vim-surround): Easily manipulate surrounding delimiters.
|
||
|
||
## Vim Cheatsheet
|
||
|
||
| Command | Description |
|
||
|---------|-------------|
|
||
| `h`, `j`, `k`, `l` | Move the cursor left, down, up, right |
|
||
| `w`, `b`, `e` | Move to the start of the next, previous, or end of the current word |
|
||
| `0`, `$` | Move to the start or end of the line |
|
||
| `gg`, `G` | Move to the first or last line of the file |
|
||
| `y`, `d`, `p` | Yank (copy), delete, or paste text |
|
||
| `u`, `<Ctrl-r>` | Undo or redo changes |
|
||
| `/pattern`, `?pattern` | Search forward or backward for a pattern |
|
||
| `:s/old/new/g` | Replace all occurrences of "old" with "new" in the current line |
|
||
| `:e filename` | Open a file in a new buffer |
|
||
| `:bn`, `:bp` | Move to the next or previous buffer |
|
||
|
||
## Appendix A: Tips and Tricks for Efficiency
|
||
|
||
### Combining Motions and Operators
|
||
|
||
Vim's power lies in the ability to combine motions and operators to perform complex editing tasks efficiently. Here are some examples:
|
||
|
||
- `d3w`: Delete the next three words.
|
||
- `y$`: Yank (copy) from the cursor to the end of the line.
|
||
- `cis`: Change inside a sentence (delete the current sentence and enter Insert mode).
|
||
- `>aB`: Indent a block (the current block surrounded by curly braces).
|
||
|
||
Tip: Practice combining different motions and operators to build muscle memory for common editing tasks.
|
||
|
||
### Macros for Automating Repetitive Tasks
|
||
|
||
Macros allow you to record a series of keystrokes and replay them to automate repetitive tasks. Here's how to use macros:
|
||
|
||
1. Press `q` followed by a register (e.g., `a`) to start recording a macro.
|
||
2. Perform the desired keystrokes.
|
||
3. Press `q` again to stop recording.
|
||
4. To execute the macro, press `@` followed by the register (e.g., `@a`).
|
||
5. To repeat the macro multiple times, prefix the `@` command with a count (e.g., `10@a`).
|
||
|
||
Tip: Use macros to automate tasks like formatting, code generation, or bulk replacements.
|
||
|
||
### Splits and Tabs for Working with Multiple Files
|
||
|
||
Vim allows you to split the screen and work with multiple files simultaneously using splits and tabs.
|
||
|
||
Splits:
|
||
- `:sp` or `:split`: Split the window horizontally.
|
||
- `:vsp` or `:vsplit`: Split the window vertically.
|
||
- `<Ctrl-w>w`: Cycle through the split windows.
|
||
- `<Ctrl-w>h/j/k/l`: Move the focus to the left, bottom, top, or right split.
|
||
|
||
Tabs:
|
||
- `:tabnew`: Open a new tab.
|
||
- `:tabn` or `gt`: Move to the next tab.
|
||
- `:tabp` or `gT`: Move to the previous tab.
|
||
- `:tabclose`: Close the current tab.
|
||
|
||
Tip: Use splits and tabs to view and edit related files side by side, making it easier to reference and navigate between them.
|
||
|
||
### Registers for Advanced Copy/Paste Operations
|
||
|
||
Vim provides multiple registers for storing and retrieving text. Some commonly used registers include:
|
||
|
||
- `"a` to `"z`: Named registers for storing text.
|
||
- `"0`: The yank register, which stores the last yanked text.
|
||
- `"+`: The system clipboard register (requires Vim compiled with clipboard support).
|
||
|
||
To use registers:
|
||
|
||
- `"ayw`: Yank the current word into register `a`.
|
||
- `"ap`: Paste the contents of register `a`.
|
||
- `"+p`: Paste the contents of the system clipboard.
|
||
|
||
Tip: Use registers to store and recall frequently used snippets or to perform precise copy/paste operations.
|
||
|
||
## Appendix D: Vim for Specific Workflows
|
||
|
||
### Vim for Software Development
|
||
|
||
Vim offers various features and plugins that make it well-suited for software development tasks:
|
||
|
||
Code Navigation:
|
||
- `<Ctrl-]>`: Jump to the definition of the keyword under the cursor (requires ctags).
|
||
- `<Ctrl-t>`: Jump back from the definition.
|
||
- `gd`: Go to the local declaration of the variable under the cursor.
|
||
|
||
Debugging:
|
||
- Plugins like `vimspector` or `vim-debug` provide debugging capabilities within Vim.
|
||
- Set breakpoints, step through code, and inspect variables without leaving the editor.
|
||
|
||
Integration with Build Tools:
|
||
- Plugins like `vim-dispatch` or `vim-make` allow you to run build commands and view results within Vim.
|
||
- Configure key mappings to quickly compile, run, or test your code.
|
||
|
||
### Vim for Data Manipulation
|
||
|
||
Vim's powerful text manipulation capabilities make it suitable for working with structured data formats like CSV or JSON.
|
||
|
||
CSV Data:
|
||
- Use `:%s/,/\t/g` to convert comma-separated values to tab-separated values for easier manipulation.
|
||
- Leverage Vim's column editing features (e.g., visual block mode) to work with tabular data.
|
||
- Plugins like `csv.vim` provide additional functionality for working with CSV files.
|
||
|
||
JSON Data:
|
||
- Use `:%!jq .` to format and pretty-print JSON data (requires the `jq` command-line tool).
|
||
- Plugins like `vim-jdaddy` or `vim-json` offer improved syntax highlighting and formatting for JSON files.
|
||
|
||
Tip: Combine Vim's text manipulation commands with external tools (e.g., `sort`, `awk`, `sed`) to process and transform data efficiently.
|
||
|
||
---
|
||
|
||
It's great to see the foundation of your Vim guide taking shape! Let’s review and enrich the content with some more context and practical examples, especially focusing on programming and working with structured data. Here's a refined and expanded version based on your feedback and previous content:
|
||
|
||
---
|
||
|
||
# Vim Guide
|
||
|
||
## 1. Introduction to Vim's Philosophy
|
||
|
||
Vim, renowned for its modal editing system, allows users to switch between various modes designed for specific tasks such as inserting text, navigating within files, or executing commands. This modal approach greatly enhances editing efficiency by reducing the number of keystrokes required for tasks and enabling a more intuitive control over text manipulation.
|
||
|
||
## 2. Quick Reference Guide
|
||
|
||
This section provides a quick lookup for the most frequently used Vim commands, categorized for easy reference:
|
||
|
||
- **Navigating**
|
||
- `h, j, k, l`: Move left, down, up, right (the arrow keys of Vim).
|
||
- `gg, G`: Jump to the top or bottom of the document.
|
||
- **Editing**
|
||
- `i, a, o`: Enter insert mode at cursor, after cursor, or on a new line.
|
||
- `d, c, y`: Delete, change, or yank (copy) text.
|
||
- **Searching**
|
||
- `/pattern, ?pattern`: Search forward or backward for a pattern.
|
||
- `n, N`: Repeat search in the same or opposite direction.
|
||
|
||
## 3. Core Guides with Integrated Efficiency Tips
|
||
|
||
### Basic Editing and File Management
|
||
|
||
**Opening, Saving, and Exiting Files**
|
||
- **Commands**: `vim filename`, `:w`, `:wq`, `:q!`
|
||
- **Description**: Open files with `vim filename`. Save with `:w`, exit with `:q!`, or combine both with `:wq`.
|
||
- **Tip**: Use `ZZ` as a quicker alternative to `:wq` when you need to save and exit efficiently.
|
||
|
||
**Navigating Within Files**
|
||
- **Commands**: `h, j, k, l`
|
||
- **Description**: Precisely navigate within lines or across the text.
|
||
- **Tip**: Pair `h, j, k, l` with `Ctrl` (e.g., `Ctrl-f` and `Ctrl-b`) for faster document scrolling.
|
||
|
||
### Efficient Navigation
|
||
|
||
**Word and Line Movements**
|
||
- **Commands**: `w, b, e, 0, ^, $`
|
||
- **Description**: Navigate efficiently by words or to specific positions within a line.
|
||
- **Tip**: `5w` can save significant time by jumping five words forward, reducing repeated keystrokes.
|
||
|
||
**Document Navigation**
|
||
- **Commands**: `gg, G`
|
||
- **Description**: Quickly move to the beginning or end of a document, or directly to a specific line with `50G`.
|
||
- **Tip**: Use percentage jumps like `50%` to reach the midpoint of a document quickly.
|
||
|
||
### Advanced Text Manipulation
|
||
|
||
**Editing Commands**
|
||
- **Commands**: `dw, ciw, d$`
|
||
- **Description**: Efficient commands for deleting a word, changing inside a word, or deleting to the end of a line.
|
||
- **Tip**: `ci(` changes content inside parentheses, a common task in programming.
|
||
|
||
**Using Visual Mode for Complex Selections**
|
||
- **Commands**: `v, V, Ctrl-v`
|
||
- **Description**: Select text for manipulation in various modes: character, line, or block.
|
||
- **Tip**: Use `>` or `<` to indent selected blocks quickly, crucial in code formatting.
|
||
|
||
### Search and Replace
|
||
|
||
**Finding and Replacing Text**
|
||
- **Commands**: `:s/old/new/g`, `/%s/old/new/g`
|
||
- **Description**: Replace 'old' text with 'new' globally or within the current line.
|
||
- **Tip**: Use `*` to search for the word under the cursor quickly.
|
||
|
||
**Navigational Searches**
|
||
- **Commands**: `f<char>, F<char>, t<char>, T<char>`
|
||
- **Description**: Jump to the next or previous occurrence of a character on the line.
|
||
- **Tip**: Use `;` and `,` to repeat the last `f` or `t` search efficiently.
|
||
|
||
### Enhanced Motion for Programming and Structured Data
|
||
|
||
**Paragraph and Section Motions**
|
||
- **Commands**: `{`, `}`, `[[`, `]]`
|
||
- **Description**: Navigate quickly between paragraphs or code blocks. Ideal for structured data and code structures.
|
||
|
||
**Screen Motions**
|
||
- **Commands**: `H`, `M`, `L`, `Ctrl-d`, `Ctrl-u`
|
||
- **Description**: Manage on-screen text positioning and rapid scrolling effectively.
|
||
|
||
**Document Motions**
|
||
- **Commands**: `gg`, `G`
|
||
- **Description**: Essential for moving quickly through large files or to specific lines, critical in debugging and reviewing.
|
||
|
||
### Tips for Using Motions in Structured Data and Programming
|
||
|
||
- Combine motions with searches for efficient navigation within XML, JSON
|
||
|
||
, or YAML, especially useful in large data files or complex codebases.
|
||
- Record macros for repetitive edits across similar structures, optimizing time and ensuring consistency.
|
||
- Utilize `Ctrl-v` for block visual mode, particularly effective for column-based editing or configuration adjustments.
|
||
|
||
---
|
||
|
||
This expanded guide not only provides a comprehensive look at using Vim effectively but also integrates practical tips directly applicable to programming and structured data editing, ensuring users can leverage Vim's power to its fullest.
|
||
|
||
---
|
||
|
||
Certainly! Let's flesh out your Vim guide with enriched content and contextual details, structured in Markdown format. This enriched version will delve deeper into each section, offering clearer explanations and practical examples to ensure users grasp the concepts and can apply them effectively.
|
||
|
||
---
|
||
|
||
# Vim Guide
|
||
|
||
## 1. Introduction to Vim's Philosophy
|
||
|
||
Vim, distinguished by its modal editing capabilities, allows users to switch between various modes for different editing tasks. This design is fundamental for increasing editing speed and efficiency as it enables users to execute commands and navigate files with minimal keystrokes. Each mode in Vim is tailored to a specific purpose—inserting text, navigating files, or executing commands—making it highly efficient once mastered.
|
||
|
||
## 2. Quick Reference Guide
|
||
|
||
### Most Used Commands and Modes
|
||
|
||
- **Navigating**
|
||
- `h, j, k, l` - Move left, down, up, right
|
||
- `gg, G` - Jump to the top or bottom of the document
|
||
- **Editing**
|
||
- `i, a, o` - Enter insert mode at cursor, after cursor, or a new line
|
||
- `d, c, y` - Delete, change, or yank (copy) text
|
||
- **Searching**
|
||
- `/pattern, ?pattern` - Search forward or backward for a pattern
|
||
- `n, N` - Repeat search in same or opposite direction
|
||
|
||
## 3. Core Guides with Integrated Efficiency Tips
|
||
|
||
### Basic Editing and File Management
|
||
|
||
**Opening, Saving, and Exiting Files**
|
||
- **Commands**: `vim filename`, `:w`, `:wq`, `:q!`
|
||
- `vim filename` opens a file or creates a new one if it doesn't exist.
|
||
- `:w` saves changes, `:wq` saves and quits, and `:q!` quits without saving.
|
||
- **Tip**: Use `ZZ` to save and quit Vim quickly, which is a more efficient alternative to `:wq`.
|
||
|
||
**Navigating Within Files**
|
||
- **Commands**: `h, j, k, l`
|
||
- Navigate precisely within lines with minimal movement.
|
||
- **Tip**: Combine these with `Ctrl` (e.g., `Ctrl-f` and `Ctrl-b`) to scroll faster through documents, balancing precise and rapid movement.
|
||
|
||
### Efficient Navigation
|
||
|
||
**Word and Line Movements**
|
||
- **Commands**: `w, b, e, 0, ^, $`
|
||
- `w` jumps to the start of the next word, `b` to the beginning of the current or previous word, and `e` to the end of the current or next word.
|
||
- `0`, `^`, and `$` navigate to the start, first non-blank character, and end of the line, respectively.
|
||
- **Tip**: Use `5w` to jump five words forward, saving time compared to repeated presses.
|
||
|
||
**Document Navigation**
|
||
- **Commands**: `gg, G`
|
||
- `gg` jumps to the beginning, and `G` to the end of the document. Use `50G` to jump directly to line 50.
|
||
- **Tip**: Jump to specific percentages of your document with `50%` to quickly reach the midpoint.
|
||
|
||
### Advanced Text Manipulation
|
||
|
||
**Editing Commands**
|
||
- **Commands**: `dw, ciw, d$`
|
||
- `dw` deletes a word, `ciw` changes inside a word, and `d$` deletes to the end of a line.
|
||
- **Tip**: Use `ci(` to change inside parentheses, demonstrating how command combinations can cater to specific coding needs.
|
||
|
||
**Using Visual Mode for Complex Selections**
|
||
- **Commands**: `v, V, Ctrl-v`
|
||
- `v` starts visual mode for character selection, `V` for line, and `Ctrl-v` for a block.
|
||
- **Tip**: After selecting text in Visual mode, use `>` or `<` to quickly indent blocks of code.
|
||
|
||
### Search and Replace
|
||
|
||
**Finding and Replacing Text**
|
||
- **Commands**: `:s/old/new/g`, `/%s/old/new/g`
|
||
- Replace 'old' with 'new' in the current line or entire document.
|
||
- **Tip**: Use `*` to search for the word under the cursor, enhancing workflow speed.
|
||
|
||
**Navigational Searches**
|
||
- **Commands**: `f<char>, F<char>, t<char>, T<char>`
|
||
- `f<char>` moves to the next occurrence of `<char>` on the line, `F<char>` moves to the previous.
|
||
- **Tip**: Combine `;` and `,` to repeat the last `f` or `t` search forward or backward, optimizing character searching.
|
||
Absolutely, let's expand on the specific Vim motions that are especially useful for programming and working with structured data files like XML, JSON, and YAML. This additional information will seamlessly integrate into your existing guide, providing focused insights on navigating and manipulating code structures effectively.
|
||
|
||
#### Paragraph and Section Motions
|
||
|
||
**Commands**: `{`, `}`, `[[`, `]]`
|
||
- **Description**:
|
||
- `{` and `}` allow you to move quickly between blocks of text separated by blank lines, which is common in documentation blocks within code.
|
||
- `[[` and `]]` are particularly useful for jumping through sections of code delimited by braces (`{}`), which is a common structure in many programming languages. This makes them ideal for navigating functions, classes, and other code blocks.
|
||
|
||
#### Screen Motions
|
||
|
||
**Commands**: `H`, `M`, `L`, `Ctrl-d`, `Ctrl-u`
|
||
- **Description**:
|
||
- `H` (High) moves the cursor to the top of the screen, `M` (Middle) to the center, and `L` (Low) to the bottom. This helps in quickly relocating the visible area of your code without scrolling.
|
||
- `Ctrl-d` (down) and `Ctrl-u` (up) scroll the view half a screen at a time. This is useful for a rapid yet controlled scan through your code, allowing you to maintain context without losing your place.
|
||
|
||
#### Document Motions
|
||
|
||
**Commands**: `gg`, `G`
|
||
- **Description**:
|
||
- `gg` quickly jumps to the beginning of the document, which is helpful when you need to refer to initial configurations or declarations in programming files.
|
||
- `G` moves to the end of the document. You can also use `G` with a number, like `50G`, to jump directly to a specific line, facilitating precise navigation when you're debugging or reviewing logs that reference specific lines.
|
||
|
||
### Tips for Using Motions in Structured Data and Programming
|
||
|
||
- **Combining Motions with Searches**: When navigating through structured data like XML or JSON, combine section or paragraph motions with searches. For example, use `/tagName` followed by `n` and `{` to jump directly to specific tags and then navigate around their blocks.
|
||
- **Macro Usage**: Consider recording macros when performing repetitive tasks across similar structures. For instance, if you are refactoring code or need to update multiple sections of a JSON file in the same manner, record a macro of the process using `q`, perform the task, and then replay it with `@`.
|
||
- **Visual Block Mode**: Utilize `Ctrl-v` to enter visual block mode, which can be incredibly effective for column-based editing in structured files like CSV or configuration blocks in YAML files.
|
||
|
||
Adding these specific motions and tips to your Vim guide will not only enrich the content but also enhance the practical utility for developers and data engineers, ensuring they can navigate and edit their files with greater speed and precision.
|
||
|
||
---
|
||
|
||
Certainly! Let’s delve deeper into the modal editing philosophy of Vim, which forms the core of its operation and differentiates it from other text editors. This detailed guide will cover the primary modes—Normal, Insert, and Visual—along with a few additional modes you might encounter, such as Command-line and Replace modes. Understanding these modes and when to use them is fundamental to mastering Vim.
|
||
|
||
### 1. Normal Mode
|
||
**Purpose**: Navigation, text manipulation, and command execution.
|
||
- **Entering Normal Mode**: This is the default mode when you open Vim. You can always return to Normal mode from other modes by pressing `Esc`.
|
||
- **Key Operations**:
|
||
- **Navigation**: Use `h`, `j`, `k`, `l` to move left, down, up, and right, respectively. Advanced movements include `w` (next word), `b` (beginning of word), and `$` (end of line).
|
||
- **Editing**: Commands like `dd` (delete line), `cc` (change line), and `yy` (yank or copy line) are activated here.
|
||
- **Complex Commands**: Combining commands to perform complex text manipulations, like `d3w` (delete next three words) or `2dd` (delete two lines).
|
||
|
||
### 2. Insert Mode
|
||
**Purpose**: Typing and editing text directly.
|
||
- **Entering Insert Mode**: Press `i` to insert at the cursor, `I` to insert at the beginning of the line, `a` to append after the cursor, and `A` to append at the end of the line.
|
||
- **Key Operations**:
|
||
- **Text Entry**: Typing behaves as in conventional text editors.
|
||
- **Exiting**: Press `Esc` to return to Normal mode.
|
||
|
||
### 3. Visual Mode
|
||
**Purpose**: Text selection for manipulation.
|
||
- **Entering Visual Mode**: Press `v` to start character-wise selection, `V` for line-wise selection, or `Ctrl-v` for block-wise selection.
|
||
- **Key Operations**:
|
||
- **Expand Selection**: Move the cursor to expand the selection area.
|
||
- **Operations on Selection**: Once text is selected, operations like `d` (delete), `y` (yank), and `c` (change) can be applied.
|
||
|
||
### 4. Command-Line Mode
|
||
**Purpose**: Entering editor commands, searching, and more.
|
||
- **Entering Command-Line Mode**: Press `:` from Normal mode.
|
||
- **Key Operations**:
|
||
- **Commands Execution**: Type commands like `:w` (save), `:q` (quit), and `:/pattern` (search for a pattern).
|
||
|
||
### 5. Replace Mode
|
||
**Purpose**: Replace existing text without entering Insert mode.
|
||
- **Entering Replace Mode**: Press `R` to start replacing text under the cursor until `Esc` is pressed.
|
||
|
||
### Transitioning Between Modes
|
||
Mastering Vim involves fluidly switching between these modes as needed. Here’s a quick reference on transitioning:
|
||
- **Normal to Insert**: `i`, `I`, `a`, `A`, etc.
|
||
- **Normal to Visual**: `v`, `V`, `Ctrl-v`.
|
||
- **Any to Normal**: `Esc` or `Ctrl-[`.
|
||
|
||
### Practical Tips
|
||
- **Mode Indicators**: Many users customize their Vim status line to indicate the current mode visually.
|
||
- **Learning Tools**: `vimtutor` is an excellent resource for beginners to practice these modes in a tutorial format.
|
||
|
||
Understanding and becoming proficient in these modes unlocks the true power of Vim, allowing you to edit and navigate with efficiency and precision that few other editors can match.
|
||
|
||
---
|
||
|
||
## `.vimrc` File: Structured Guide with Documentation
|
||
|
||
### Compatibility and Initial Setup
|
||
```vim
|
||
" Ensure compatibility with older Vim versions
|
||
if version < 700
|
||
echo "You need Vim 7.0 or greater"
|
||
finish
|
||
endif
|
||
|
||
" Prevent loading this file more than once
|
||
if exists("g:loaded_vimrc")
|
||
finish
|
||
endif
|
||
let g:loaded_vimrc = 1
|
||
```
|
||
- Checks for Vim version compatibility.
|
||
- Prevents multiple loads of the `.vimrc` file in a single session.
|
||
|
||
### General Settings
|
||
```vim
|
||
" Set UTF-8 encoding for text and files
|
||
set encoding=utf-8
|
||
set fileencoding=utf-8
|
||
|
||
" Use system clipboard to easily copy/paste outside of Vim
|
||
set clipboard=unnamedplus
|
||
|
||
" Enable syntax highlighting
|
||
syntax on
|
||
|
||
" Indentation settings for a consistent coding style
|
||
set tabstop=4 softtabstop=4
|
||
set shiftwidth=4
|
||
set expandtab
|
||
set autoindent
|
||
set smartindent
|
||
|
||
" Line number settings for easier navigation
|
||
set number
|
||
set relativenumber
|
||
|
||
" Highlight the line cursor is on
|
||
set cursorline
|
||
|
||
" Enable mouse support across all modes
|
||
set mouse=a
|
||
|
||
" Disable swap files to avoid clutter
|
||
set noswapfile
|
||
```
|
||
- Configures basic editing behaviors and preferences.
|
||
- Sets up indentation and line number visibility for ease of reading and navigation.
|
||
|
||
### Search Enhancements
|
||
```vim
|
||
" Improve search functionality
|
||
set hlsearch " Highlight search results
|
||
set ignorecase " Case-insensitive searching
|
||
set smartcase " Case-sensitive if contains uppercase
|
||
set incsearch " Incremental search
|
||
```
|
||
- Enhances search functionality within Vim, making it easier to find text.
|
||
|
||
### Visual Customizations
|
||
```vim
|
||
" Visual settings for a better editing experience
|
||
colorscheme desert " Set color scheme
|
||
set t_Co=256 " Enable 256 colors
|
||
set laststatus=2 " Always display the status line
|
||
```
|
||
- Customizes the appearance of Vim, including color schemes and the status bar.
|
||
|
||
### Plugin Management
|
||
```vim
|
||
" Plugin management using Vim's native package loading
|
||
execute "set runtimepath^=~/.vim/pack/plugins/start"
|
||
```
|
||
- Outlines the method for managing plugins with Vim 8+ or Neovim's built-in package feature.
|
||
|
||
### Plugins Configuration (Examples)
|
||
```vim
|
||
" Example plugins that enhance Vim's functionality
|
||
" Plug 'tpope/vim-surround' " Easier manipulation of surrounding characters
|
||
" Plug 'preservim/nerdtree' " File system explorer
|
||
" Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " Fuzzy file, buffer, mru, tag, etc. finder.
|
||
```
|
||
- Demonstrates how to include plugins in your `.vimrc`. Plugins like `vim-surround`, `nerdtree`, and `fzf` are popular choices for boosting productivity.
|
||
|
||
### Key Bindings
|
||
```vim
|
||
" Custom key bindings for faster workflow
|
||
let mapleader=" " " Set space as the leader key
|
||
nnoremap <leader>n :NERDTreeToggle<CR> " Toggle NERDTree with <leader>n
|
||
```
|
||
- Customizes key mappings, including setting a leader key for shortcuts.
|
||
|
||
### Custom Functions and Autocommands
|
||
```vim
|
||
" Place for custom Vim functions and autocommands
|
||
autocmd vimexit * if !argc() | NERDTreeClose | endif
|
||
" Example: Auto-close NERDTree on Vim exit if it's the last window
|
||
```
|
||
- A section for defining custom functions and autocommands for automating tasks.
|
||
|
||
### Filetype-specific Enhancements and Quality-of-Life Improvements
|
||
```vim
|
||
" Enhancements for specific file types and additional settings
|
||
au BufRead,BufNewFile *.py,*.js,*.md,*.lua setlocal syntax=on
|
||
" Enable syntax highlighting based on file type
|
||
|
||
" Quality-of-Life Improvements
|
||
set splitright " Vertical splits to the right
|
||
set splitbelow " Horizontal splits below
|
||
set clipboard=unnamedplus " Integrate Vim clipboard with the system clipboard
|
||
```
|
||
- Adjusts settings for specific file types and adds general improvements to make editing more pleasant.
|
||
|
||
This guide breaks down the `.vimrc` file into manageable sections, making it easier to understand and customize according to your needs. Remember, the best `.vimrc` is one that evolves with you, fitting your workflow and preferences as they develop over time.
|
||
|
||
---
|
||
|
||
```bash
|
||
" Basic Vim configuration file
|
||
|
||
" Author: [Your Name]
|
||
" Last Updated: [Date]
|
||
|
||
" Prevent older Vim versions from running this config
|
||
if version < 700
|
||
echo "Upgrade to Vim 7.0 or later."
|
||
finish
|
||
endif
|
||
|
||
" Ensure the file is loaded only once
|
||
if exists("g:loaded_vimrc")
|
||
finish
|
||
endif
|
||
let g:loaded_vimrc = 1
|
||
|
||
" ==============================================================================
|
||
" General Settings
|
||
" ==============================================================================
|
||
set nocompatible " Disable Vi compatibility mode
|
||
filetype plugin indent on " Enable filetype detection and plugin
|
||
set encoding=utf-8 " Set default encoding to UTF-8
|
||
set fileencoding=utf-8 " Set file encoding to UTF-8
|
||
set clipboard=unnamedplus " Use system clipboard
|
||
syntax enable " Enable syntax highlighting
|
||
set tabstop=4 " Set tab width to 4 spaces
|
||
set shiftwidth=4 " Set width for auto-indents
|
||
set expandtab " Use spaces instead of tabs
|
||
set smartindent " Enable smart indent
|
||
set number " Show line numbers
|
||
set relativenumber " Show relative line numbers
|
||
set cursorline " Highlight current line
|
||
set mouse=a " Enable mouse support
|
||
set noswapfile " Disable swap file creation
|
||
set nobackup " Disable backup file creation
|
||
set undofile " Enable persistent undo
|
||
set incsearch " Enable incremental search
|
||
set hlsearch " Highlight search results
|
||
set ignorecase " Case insensitive searching...
|
||
set smartcase " ...unless there's a capital letter in the query
|
||
|
||
" ==============================================================================
|
||
" Visual Settings
|
||
" ==============================================================================
|
||
set showmatch " Highlight matching parentheses
|
||
colorscheme desert " Set colorscheme
|
||
set laststatus=2 " Always display the status line
|
||
set showcmd " Display incomplete commands
|
||
set wildmenu " Visual autocomplete for command menu
|
||
set ruler " Show cursor position
|
||
|
||
" ==============================================================================
|
||
" Key Bindings
|
||
" ==============================================================================
|
||
let mapleader = " " " Set <Space> as the leader key
|
||
nnoremap <leader>w :w!<CR> " Quick save command
|
||
nnoremap <leader>q :q!<CR> " Quick quit command
|
||
|
||
" ==============================================================================
|
||
" Plugin Management
|
||
" ==============================================================================
|
||
" Placeholder for plugin management system initialization
|
||
" e.g., vim-plug, Vundle, or native Vim 8+ package management
|
||
|
||
" ==============================================================================
|
||
" Plugins Configuration
|
||
" ==============================================================================
|
||
" Example configurations for installed plugins
|
||
|
||
" ==============================================================================
|
||
" Custom Functions and Autocommands
|
||
" ==============================================================================
|
||
" Example: Clean trailing whitespace on save
|
||
autocmd BufWritePre * %s/\s\+$//e
|
||
|
||
" ==============================================================================
|
||
" Final Touches
|
||
" ==============================================================================
|
||
" Additional custom settings and tweaks
|
||
|
||
" Ensure settings apply to all file types
|
||
filetype plugin on
|
||
|
||
" Enable spell checking for text files
|
||
autocmd FileType text setlocal spell
|
||
|
||
" End of .vimrc
|
||
```
|
||
---
|
||
|
||
It sounds like Vim is using folding to collapse sections of your Markdown document. You can unfold the document to see all the lines. Here's how you can manage folding in Vim:
|
||
|
||
### Unfolding Lines in Vim
|
||
|
||
1. **Open your Markdown file in Vim:**
|
||
```sh
|
||
vim filename.md
|
||
```
|
||
|
||
2. **Unfold the current fold:**
|
||
Press `z` followed by `o` to open the current fold under the cursor.
|
||
|
||
3. **Unfold all folds in the document:**
|
||
Press `z` followed by `R` to open all folds in the document.
|
||
|
||
4. **Close the current fold:**
|
||
Press `z` followed by `c` to close the current fold under the cursor.
|
||
|
||
5. **Close all folds in the document:**
|
||
Press `z` followed by `M` to close all folds in the document.
|
||
|
||
### Disable Folding for Markdown Files
|
||
|
||
To permanently disable folding for Markdown files, you can add the following line to your `.vimrc` file:
|
||
|
||
1. **Open your `.vimrc` file:**
|
||
```sh
|
||
vim ~/.vimrc
|
||
```
|
||
|
||
2. **Add the line to disable folding for Markdown files:**
|
||
```vim
|
||
let g:vim_markdown_folding_disabled = 1
|
||
```
|
||
|
||
3. **Save and exit your `.vimrc` file:**
|
||
Press `Esc`, then type `:wq` and hit `Enter`.
|
||
|
||
### Example `.vimrc` for Markdown
|
||
|
||
Here's an example `.vimrc` configuration with folding disabled and other useful settings for Markdown:
|
||
|
||
```vim
|
||
" Enable syntax highlighting
|
||
syntax on
|
||
|
||
" Set line numbers
|
||
set number
|
||
|
||
" Enable filetype detection and plugins
|
||
filetype plugin on
|
||
filetype indent on
|
||
|
||
" Set basic editing settings
|
||
set tabstop=4
|
||
set shiftwidth=4
|
||
set expandtab
|
||
set autoindent
|
||
set smartindent
|
||
|
||
" Enable mouse support
|
||
set mouse=a
|
||
|
||
" Initialize Vim-Plug
|
||
call plug#begin('~/.vim/plugged')
|
||
|
||
" Markdown plugin for syntax highlighting and other features
|
||
Plug 'plasticboy/vim-markdown'
|
||
|
||
call plug#end()
|
||
|
||
" Disable folding for Markdown files
|
||
let g:vim_markdown_folding_disabled = 1
|
||
```
|
||
|
||
### Applying Changes
|
||
|
||
After saving your `.vimrc` file with the new settings, restart Vim or source the `.vimrc` file to apply the changes:
|
||
|
||
```vim
|
||
:source ~/.vimrc
|
||
```
|
||
|
||
By following these steps, you should be able to manage and disable folding in Vim, allowing you to see your entire Markdown document without any collapsed sections.
|