r_vim
70 subscribers
1.25K photos
60 videos
1 file
19.6K links
Download Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
Learning to program Vim textbuffers and made this LLM Plugin for Ollama
https://redd.it/1rkq7m6
@r_vim
This media is not supported in your browser
VIEW IN TELEGRAM
Learning to program Vim textbuffers and made this LLM Plugin for Ollama
https://redd.it/1rkq7m6
@r_vim
Question about vim behavior with hard linked files?

I have an include file that is hard linked, "ln <target> <link>" several times, 10+. The links are all on the same drive and file tree, /opt. A link on one of the files was reset to one. How does this happen?

Google search shows that if an editor uses a temp file for edit and then moves the temp file to the named file the link is often broken when the file is saved. Does the vim9 do this?

I use the cntl-z to stop programs when I'm editing. I have done this since the mid-1980s and had no problem. However, I've noticed that stopping a vim session often does not update the save disk files timestamp when I write the file before I cntl-Z. The ":w cntl-Z" is in muscle memory and happens very fast. A "sync" does flush for a while. It seems the save times kept in file buffers aren't connected to the real time on the disk???

Any ideas?

I have vim 9.198. The ":help version9" doesn't report compile libraries.

I'm on a ubuntu debian, POP!_OS 22.04 LTS on a System76 box that is kept up to date.

https://redd.it/1rl7vgr
@r_vim
I see different color when I type ":colorscheme default" INSIDE vim

Hello everyone, I'm very new to vim and need you guys' help.

I want to change the vim appearance to default, and this is what I wrote on \~/.vimrc

colorscheme default

But the color showing on vim is different from the color when I type ":colorscheme default" on vim. Here are the screenshots.

1. this is the color that applied after I wrote \\"colorscheme default\\" on \~\/.vimrc which is not what I expected

2. when I command \\":colorscheme default\\" on vim, it shows the following color, which is the appearance I want

Is something overriding the color or have I set the file wrong?

This is the \~/.vimrc file just in case if needed.

https://preview.redd.it/fuvmzt8lokmg1.png?width=649&format=png&auto=webp&s=268ffd3f41e00990b2ceca42e46e3ad2e564339b




https://redd.it/1rikzty
@r_vim
I want to improve my config

I have a pretty basic VIM configuration. I'm not the kind of person who likes updating Vim every day, I prefer a stable config. Recently I ran into a bit of a dilemma. I updated my config from Vimscript to Vim9, and during the process I added some settings.

The main thing I want to ask is: are there any modifications or additions you’d recommend for my config?

Another question is about plugins. I’ve never really used Vim plugins and I’m not sure if I need them. I’ve always felt that plugins like LSPs, advanced autocomplete, or surrounding features aren’t really my thing. But I might use something like a faster `:find`, or something similar to Emacs’ quickrun.

.vimrc:

vim9script
# =========================
# Theme
# =========================
colorscheme lain
set listchars=tab:·\ ,trail:·,nbsp:␣
set laststatus=2
g:cwd_tail = fnamemodify(getcwd(), ':t')
autocmd DirChanged * let g:cwd_tail = fnamemodify(getcwd(), ':t')
set statusline=%#StatusLine#\ %f\ %m%r%=%{g:cwd_tail}\ %L\ %l:%c\
# =========================
# General Settings
# =========================
set path=.,**
set wildignore+=*.exe,*.dll,*.pdb,*.class,*.o,*.d
set wildignore+=*/.git/*,*/node_modules/*,*/dist/*,*/build/*,*/target/*
set wildignorecase
set splitbelow splitright
set shortmess+=IcC
set ttimeout ttimeoutlen=25
set updatetime=300 redrawtime=1500
set hidden confirm lazyredraw
set backspace=indent,eol,start
set tabstop=4 shiftwidth=4 expandtab
set autoindent softtabstop=-1
set hlsearch incsearch ignorecase smartcase
set clipboard=unnamedplus
set nowrap
set breakindent breakindentopt=sbr,list:-1
set linebreak
set nojoinspaces
set display=lastline
set smoothscroll
set sidescroll=1 sidescrolloff=3
set fileformat=unix
set fileformats=unix,dos
set nrformats=bin,hex,unsigned
set completeopt=menu,popup
set complete=o^10,.^10,w^5,b^5,u^3,t^3
set virtualedit=block nostartofline
set switchbuf=useopen
filetype plugin indent on
# =========================
# NetRW / Tree Settings
# =========================
g:netrw_banner = 0
g:netrw_keepdir = 0
g:netrw_winsize = 17
g:netrw_liststyle = 3
g:netrw_localcopydircmd = 'cp -r'
# =========================
# Keymaps
# =========================
g:mapleader = ' '
nnoremap <leader>f :find<Space>
nnoremap <silent> <leader>q :copen<CR>
nnoremap <silent> <leader>n :cnext<CR>
nnoremap <silent> <leader>p :cprev<CR>
nnoremap <silent> <leader>e :Lexplore<CR>
nnoremap <silent> <Tab> :bnext<CR>
nnoremap <silent> <S-Tab> :bprevious<CR>
nnoremap <silent> <leader>/ :nohlsearch<CR>

Color-scheme:

vim9script
# Base
set termguicolors
syntax on
set background=dark
hi Normal guifg=#ffffff guibg=#000000 ctermfg=15 ctermbg=0
hi CursorLine guibg=#000000 ctermbg=0
hi LineNr guifg=#ffffff ctermfg=15
hi StatusLine guifg=#ffffff guibg=#000000 ctermfg=15 ctermbg=0
hi VertSplit guifg=#ffffff guibg=#000000 ctermfg=15 ctermbg=0
# All gropus
const groups = [
\ "Constant", "String", "Character", "Number", "Boolean", "Float",
\ "Identifier", "Function",
\ "Statement", "Conditional", "Repeat", "Label", "Operator", "Keyword", "Exception",
\ "PreProc", "Include", "Define", "Macro", "PreCondit",
\ "Type", "StorageClass", "Structure", "Typedef",
\ "Special", "SpecialChar", "Tag", "Delimiter", "SpecialComment", "Debug",
\ "Underlined", "Ignore", "Error", "Todo"
\ ]
for g in groups
exec $"hi {g} guifg=#ffffff ctermfg=15"
endfor
hi Comment guifg=#7d7d7d ctermfg=8
hi String guifg=#8a8a8a ctermfg=8
hi StatusLine guifg=#cccccc ctermfg=8
hi StatusLineNC guifg=#cccccc ctermfg=8
hi EndOfBuffer guifg=#000000 ctermfg=15
hi NonText guifg=#555555 ctermfg=15
hi Pmenu guifg=#ffffff guibg=#0f0f0f ctermfg=15 ctermbg=0
hi
PmenuSel guifg=#000000 guibg=#cccccc ctermfg=0 ctermbg=8
hi PmenuSbar guifg=#ffffff guibg=#555555 ctermfg=15 ctermbg=8
hi PmenuThumb guifg=#ffffff guibg=#aaaaaa ctermfg=15 ctermbg=7
hi WildMenu guifg=#ffffff guibg=#0f0f0f ctermfg=0 ctermbg=8
hi VertSplit guifg=#000000 guibg=#ffffff ctermfg=15 ctermbg=0
hi WinSeparator guifg=#000000 guibg=#ffffff ctermfg=7 ctermbg=0

https://redd.it/1rr434b
@r_vim
Change locale for one mapping in .vimrc only

Hello,

I have the following lines in my \~/.vimrc

" map timestamp in RFC822 format to F9 key

nnoremap <F9> "=strftime("%a, %d %b %Y %H:%M:%S %z")<CR>P

inoremap <F9> <C-R>=strftime("%a, %d %b %Y %H:%M:%S %z")<CR>

The mapping works, but as I have set my locales in my operating system (Debian GNU/Linux 13 Trixie) to German

(de_DE.UTF-8), the created timestamp uses German names for days and months. Is it possible to use the locale en_US.UTF-8 only for the mapping in Vim? I would like to have the timestamp in English.

https://redd.it/1rqvpnr
@r_vim
Tips on taking note in Vim

Hi everyone, I been using Vim for a while but mainly for coding. This is the first time I use Vim to take note for a course. Any advice is appreciated :)) I only use raw Vim with no plugins btw.

https://redd.it/1rp35da
@r_vim
How to access file with vim when there is + before directory name
https://redd.it/1rwmg9t
@r_vim
Oil.nvim like file manager for vim

i switch between vim and neovim. i have a special love for vim so i try to bring some neovim features that i miss into vim. one, for example, is the oil.nvim plugin for neovim. i made myself a plugin just like it.

I can create, rename, move, copy, delete files as if i am editing a vim buffer. of course since i made it for myself it is not bug free and not 100% complete.

my question is does the vim community want such plugin? or are they happy with using the already available file managers?

UPDATE:

i have made the plugin and it is ready to use. I am calling it VimExplorer. please try to forgive me for any bugs that you might encounter. help me by reporting it and i will find time to work on it.

Link to repo: https://github.com/Ashik80/VimExplorer

https://redd.it/1rvaop3
@r_vim
Give me tips for my programming setup

I am a CS student. Our main language in our courses is Java. When I was still using Windows, jGRASP was the main IDE I was using in the beginning. This was the one recommended to us. After jGRASP, I started using VScodium.

In the past year, I started using terminal-based editors because I switched to Linux and honestly I feel more productive and less distracted.

I use tmux as my terminal multiplexer. On the left side, the main pane has Vim opened. On the right side, I have two panes one on top of the other. One of them I use to display the files in the directory. The other one I use for javac/ running commands. I don’t have any plugins installed. I like to run things vanilla first before doing modifications. Do you think my set up is good or do you think I make things hard for myself by not using plugins? Thank you very much guys!

https://redd.it/1rvazal
@r_vim
Tempfile pattern for more Unix philosophy points

Vim usually composes well with Unix utilities. However some tools, like paste and comm accept two file arguments and there is only one stdin. So it requires file saving in some capacity.

The pattern is “use stdin for one file and save an alternate file to a tempfile”. Some of this can be automated, of course. Then utilize :h :_# placeholder for an alternate file and :help :range! to replace current buffer with the result of the CLI utility.

Here's an asciinema with an example https://asciinema.org/a/857466

Edit: I guess there is another pattern here that's more interesting. Delete lines that prevent you from making your edit into another file, perform an edit, place the removed lines back.

https://redd.it/1ryqoit
@r_vim
The Awesome Vim9 list now supports GitHub and Codeberg links.

You can now add

https://github.com/user/repo

or

https://codeberg.org/user/repo

... links to contributions.md.

I will accept PRs (see CONTRIBUTING.md) for users wishing to add new Codeberg links or update their own GitHub links to Codeberg.

99 projects on the list as I write this.

https://github.com/saccarosium/awesome-vim9

https://redd.it/1rtn9nk
@r_vim
vim-format - a vimscript code formatter written in C++

I love tools like clang-format and black. I was not aware of any vimscript code formatter in existence, so I decided to make my own.

https://github.com/twcarbone/vim-format

https://redd.it/1rtid58
@r_vim
built an open-source tool to pair program without leaving vim

hey r/vim, i got tired of being told to "just use vs code liveshare" every time someone wanted to pair, so i built shadow.

it works at the filesystem level — syncs file changes over an encrypted websocket connection. no vim plugin needed, it just picks up your writes automatically.

start a session, share a link, your partner joins in whatever editor they use. both of you edit live.

e2e encrypted (server never sees your code)
CLI tool (works on any OS) + mac menu bar app
free and open-source (MIT)
works for pair programming, code reviews, mock interviews

github: https://github.com/go-johnnyhe/shadow

would love feedback from vim users.

https://redd.it/1rt1b2h
@r_vim
Gruber-Darker Theme Port For Vim

Hey r/vim,

I’ve spent the last 3 years jumping between C++, Rust, Java, and C#, and I finally got tired of "rainbow-puke" themes that distract me from the logic.

I've always loved the Gruber Darker palette (originally by Jason Blevins and Alexey Kutepov, also known as Tsoding or rexim, made for GNU Emacs), so I built a faithful, robust, highly configurable, pixel perfect Vim port that focuses on readability and zero-distraction.

Why use this?

Low-level friendly: Great contrast for pointers, macros, and memory management in C/C++/Rust.
No unnecessary bloat: Just a clean .vim file.
Multi-plugin support: This port supports Airline, Lightline, and also has support for most Plugin Managers.
Mahoosive Help Documentation: I have written a very detailed and brief help documentation on this theme of a total of 1472 lines. Check the repo for more details.

Screenshot:

https://preview.redd.it/veexqthc77qg1.png?width=1918&format=png&auto=webp&s=8da29ca4c64c37fc82425218279a724cfcf3315f

Repo: https://github.com/ThunderBoltCODMYT/gruber-darker.vim

I'd love to hear what you guys think, especially if you spend 8+ hours a day in the terminal. Issues and Discussions are also open on the github repo, maybe if you want to suggest some features or find some bugs, I'll be happy to fix them!

https://redd.it/1ryvk9d
@r_vim
Is there an easy way to change the color of specific characters.

In monospaced fonts far too many characters look alike, dashes and hyphens, and the dashes different lengths are some examples. Same for spaces. Also the breaking status. I'd like to mark them with color. Is there a simple way to do this.

https://redd.it/1rzadg3
@r_vim
Formating tables : Some weird vimscript bug

Hello everybody,

I am currently trying to write a vimscript to act on a visual range.

**Here is the whole idea :**

1. I filter visual selection through pandoc command (not relevant here I think, but it transforms my multiline-table markdown table to simple line)
2. because I lost visual selection (and because a:lastline is now wrong), i select my table again
3. I remove the === and --- lines.

**Here is the following script :**

1: function! FuncFormatPandocTable()
2: '<,'>!pandoc -t markdown-multiline_tables --wrap=none -o -
3: endfunction
4:
5: function! FuncFormatListTable()
6: call FuncFormatPandocTable()
7: normal vip
8: '<,'>g/^[ =+-]*$/d
9: endfunction

**Here is the problem :**
The full script doesnt work.

1. If i comment line 8, I do have my table formated and the (new) table is selected.
2. If i comment line 6, I do have my '===' and '---' lines removed.
3. I can not chain both, for some mysterious reason

Does somebody can explain this sorcery to me ?

https://redd.it/1ryy8wm
@r_vim