Skip to content

Instantly share code, notes, and snippets.

@eyalk11
eyalk11 / fixindent.vim
Last active April 23, 2025 03:20
fix indentation of python code in vim
function! AlignWithTopLine() range
" Handle case when selection is at the start of the file
if a:firstline <= 1
" If at the start of file, use default indentation (0)
let reference_indent = 0
let above_line = ""
else
" Find the first non-empty line above the selection
let above_line_num = a:firstline - 1
while above_line_num >= 1 && getline(above_line_num) =~ '^\s*$'
@eyalk11
eyalk11 / inserts.vim
Created May 9, 2023 01:39
Fetch recently typed things in vim/neovim
" Never lose what you wrote! Allows one to fetch the recent things you either typed in insert mode or copied - (by buffers and time).
" Allows you to fetch the last 1000 inserts for any buffer using FZF (open buffers / current buffers )
" Optimizations for speed and memory
"To use - fill:
" let g:vimloc =" location to save inserts.cache"
"requires fzf.vim
" to use call EnableTrackInserts on .vimrc
" Enable some of these mappings:
@eyalk11
eyalk11 / fuzzyloc.ps1
Last active June 30, 2023 09:33
Go into visited locations by fuzzy search
# Depends on FZF
# Remove the default cd alias
Remove-Alias cd
# Create a new cd function
function MyCD {
Set-Location @args
$curtime =$(Get-Date -Format "yyyy-MM-dd HH:mm:ss")
$dict = @{
Id = "30"