Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Configuration adjustment. #1

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 71 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,71 @@
## Custom vim configuration

```
runtime! archlinux.vim " Run plugin archlinux.vim in Vim
set number " display line numbers
syntax on " enable syntax highlighting
set showmatch " highlight matching [{( characters
set textwidth=79 " set maximum text width to 79 characters
set nowrap " disable line wrapping
set mouse=r " enable mouse support in the terminal
set incsearch " enable incremental search
set nu " shortcut for number
set ts=4 " set tabstop to 4 spaces
set sw=4 " set shiftwidth to 4 spaces
set autoindent " enable autoindentation
```
# Vim Configuration

This repository contains a custom Vim configuration designed to enhance usability, provide flexible indentation settings for various file types, and improve the overall coding experience.

## Features

- **Search and Encoding**:
- Highlights all matches in search results.
- Ignores case in search patterns (`ignorecase`).
- Sets file encoding to UTF-8.
- Disables incremental search (`noincsearch`).

- **Mouse Support**:
- Enables mouse functionality if available.

- **Filetype-Specific Indentation**:
- HTML: 2 spaces for tabs and indentation.
- Python: 4 spaces for tabs and indentation.
- YAML: 2 spaces for tabs and indentation with custom indent keys.

- **Autocommands**:
- Exits Insert mode if idle for a defined period.
- Automatically applies filetype-specific indentation.

- **Status Line**:
- Displays file information, working directory, and cursor position.

## Configuration Details

```vim
syntax on
filetype plugin indent on

" Search and encoding settings
set noincsearch " Disables incremental search
set ignorecase " Ignores case in search patterns
set encoding=utf8 " Sets file encoding to UTF-8
set laststatus=2 " Always display the status line
set hlsearch " Highlights all matches in search results
set showmatch " Highlights matching parenthesis/brackets

" Mouse support
if has("mouse")
set mouse=v " Enables mouse support in visual mode
endif

" Filetype-specific indentation
function HtmlConfig()
set tabstop=2 softtabstop=2 expandtab shiftwidth=2
endfunction

function PythonConfig()
set tabstop=4 softtabstop=4 expandtab shiftwidth=4
endfunction

function YamlConfig()
set tabstop=2 softtabstop=2 expandtab shiftwidth=2
set indentkeys-=0# indentkeys-=<:>
endfunction

" Autocommands
autocmd CursorHoldI * stopinsert " Exit Insert mode if idle
autocmd FileType html call HtmlConfig()
autocmd FileType python call PythonConfig()
autocmd FileType yaml,yml call YamlConfig()

" Status line
set statusline=\ File:\ %F%m%r%h\ %w\ \ Working\ Directory:\ %r%{getcwd()}%h\ -\ Line:\ %l\ -\ Column:\ %c

" Prevent defaults.vim from overwriting these settings
let g:skip_defaults_vim = 1
61 changes: 47 additions & 14 deletions etc/vimrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,47 @@
" Custom vim configuration

runtime! archlinux.vim " Run plugin archlinux.vim in Vim
set number " display line numbers
syntax on " enable syntax highlighting
set showmatch " highlight matching [{( characters
set textwidth=79 " set maximum text width to 79 characters
set nowrap " disable line wrapping
set mouse=r " enable mouse support in the terminal
set incsearch " enable incremental search
set nu " shortcut for number
set ts=4 " set tabstop to 4 spaces
set sw=4 " set shiftwidth to 4 spaces
set autoindent " enable autoindentation
syntax on
filetype plugin indent on

" Search and encoding settings
set noincsearch " Disables incremental search; highlights only on Enter
set ignorecase " Ignores case in search patterns
set encoding=utf8 " Sets file encoding to UTF-8
set laststatus=2 " Always display the status line at the bottom
set hlsearch " Highlights all matches in search results
set showmatch

" Enables mouse support if available
if has("mouse")
set mouse=v
endif


" Configures indentation settings specifically for HTML files
function HtmlConfig()
set tabstop=2 softtabstop=2 expandtab shiftwidth=2
" Sets tab, soft tab, and indentation width to 2 spaces for HTML files
endfunction

" Configures indentation settings specifically for Python files
function PythonConfig()
set tabstop=4 softtabstop=4 expandtab shiftwidth=4
" Sets tab, soft tab, and indentation width to 4 spaces for Python files
endfunction

" Configures indentation settings specifically for YAML files
function YamlConfig()
set tabstop=2 softtabstop=2 expandtab shiftwidth=2 indentkeys-=0# indentkeys-=<:>
" Sets tab, soft tab, and indentation width to 2 spaces for YAML files,
" with custom indent keys
endfunction

" Autocommands for automatic behavior
autocmd CursorHoldI * stopinsert " Exits Insert mode if cursor is idle for updatetime duration
autocmd FileType html call HtmlConfig() " Applies HtmlConfig() for HTML files
autocmd FileType python call PythonConfig() " Applies PythonConfig() for Python files
autocmd FileType yaml,yml call YamlConfig() " Applies YamlConfig() for YAML files

" Status line configuration to show paste mode status, file information, working directory,
" and cursor position details
set statusline=\ File:\ %F%m%r%h\ %w\ \ Working\ Directory:\ %r%{getcwd()}%h\ -\ Line:\ %l\ -\ Column:\ %c
" Prevents defaults.vim from overwriting these settings
let g:skip_defaults_vim = 1