← Home ← Back to /g/

Thread 106963958

46 posts 16 images /g/
Anonymous No.106963958 [Report] >>106963976 >>106964015 >>106964031 >>106965067 >>106965175 >>106965417 >>106965469 >>106965507 >>106965732 >>106966037 >>106966347 >>106967884 >>106971443
What is in your ~/.vimrc?
Anonymous No.106963976 [Report] >>106964042 >>106965323
>>106963958 (OP)
At least a couple of " {{{, a remap of Ç and ç to :, my status bar and a couple of random stuff. My .bashrc has nicer stuff, tbqh.
Anonymous No.106964015 [Report] >>106965082
>>106963958 (OP)
>My .bashrc has nicer stuff, tbqh.
My .bashrc once had alias anal=systemd-analyze. Now, it's in .bash_aliases
Anonymous No.106964031 [Report]
>>106963958 (OP)
things related to configuring vim
Anonymous No.106964042 [Report] >>106965044
>>106963976
>a remap of Ç and ç to :
Anonymous No.106965044 [Report]
>>106964042
Uma delícia.
Anonymous No.106965067 [Report]
>>106963958 (OP)
I deleted anything vim-related the last time I had to redo my fucking config for the billionth time after an update that broke everything.
fuck this gay shit, I use vscode with vim shortcuts now, I'd rather bloat my comuter than bloat my brain with inane bullshit
Anonymous No.106965082 [Report] >>106967890
>>106964015
One of my favourites is:

mkcd() {
mkdir -p -- "$@"
cd -- "${@: -1}" || return
}


I just realized I don't have my mkscript anymore, which was something like:

mkscript [interpreter] file [...files]


Would which interpreter, then write #!${interpreter} to all the files (with a check to not overwrite and a warning), and then change them to u+x.
Anonymous No.106965175 [Report] >>106965424
>>106963958 (OP)
[anon@4chan ~]$ cat ~/.vimrc
cat: /home/anon/.vimrc: No such file or directory
Anonymous No.106965323 [Report] >>106965332 >>106965424 >>106965638
>>106963976
okay but it's maybe slightly niggerlicious, I don't really use vim much on this system, but neovim integrated into vscode.
" Source defaults.vim
unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim

" There is no need for compatibility with the Vi way of things
se nocompatible

" Show line and column number of the cursor position
se ruler
" Matched string is highlighted while you search
se incsearch
" Show line number for each line
se nu
" Show partial command in last line of the screen
se showcmd

" When <Tab> is pressed to invoke completion, possible matches are shown
se wildmenu
se expandtab
se tabstop=4
se shiftwidth=4
se cindent

" I strongly dislike C++ namespace indentation and (0 for ffmpeg work.
se cino=(0,N-s

" Allow tabs in Makefiles.
autocmd FileType make,automake se noexpandtab shiftwidth=8 softtabstop=8
" Trailing whitespace and tabs are forbidden, so highlight them.
highlight ForbiddenWhitespace ctermbg=red guibg=red
match ForbiddenWhitespace /\s\+$\|\t/
" Do not highlight spaces at the end of line while typing on that line.
autocmd InsertEnter * match ForbiddenWhitespace /\t\|\s\+\%#\@<!$/

" Don't use the mouse for selecting lines
if has('mouse')
se mouse=r
endif

" vim-plug plugin configuration
call plug#begin()

Plug 'rafi/awesome-vim-colorschemes'
Plug 'whatyouhide/vim-gotham'

call plug#end()

" My theme of choice for regular Vim, possibly overridden by gvimrc
colo afterglow

" Color 80th column to help with code formatting
se colorcolumn=80
Anonymous No.106965332 [Report] >>106965424
>>106965323
Oops, meant for OP
Anonymous No.106965417 [Report] >>106965424 >>106965638
>>106963958 (OP)
Anonymous No.106965424 [Report] >>106965491 >>106965603
>>106965175
Try cat ~/.vim/vimrc

>>106965332
How could you mistake us? I'm not a faggot.

>>106965323
But yeah, mine looks like that too. I pretty much followed a random tutorial copying what I liked and ignoring what I disliked.


>>106965417
>swap kj
What? Why?
Anonymous No.106965469 [Report]
>>106963958 (OP)
Whatever it makes automatically when you open vim. I never use that abomination except when I'm on a server that doesn't have anything else. I barely even know how to use it, let alone create my own riced configs for it.
Anonymous No.106965491 [Report] >>106965541
>>106965424
>>swap kj
>What? Why?

it made more sense to me for the j to go up (backwards) and k going down (but actually forward as in number line, the same as volume down being in the left and volume up being in the right, or page up and page down being from left to right)

anyway it's commented out, as i didn't know hot to change the vim defaults to less, man and to the other core utils

and, also, it didn't change everything in vim either, if i were to press gj or gk, my changes wouldn't do anything to the default
Anonymous No.106965507 [Report] >>106965593
>>106963958 (OP)
https://litter.catbox.moe/1imhk3k1kemi55v6.vimrc
Anonymous No.106965541 [Report] >>106966056
>>106965491
Well thought out and makes a lot of sense actually. But keeping to the defaults also makes a lot of sense. You're quite a level-headed reasonable fellow. Thanks for taking your time to explain.
Anonymous No.106965593 [Report]
>>106965507
don't open this, it's cp
Anonymous No.106965603 [Report] >>106966286
>>106965424
>Try cat ~/.vim/vimrc
[anon@4chan ~]$ cat ~/.vim/vimrc
cat: /home/anon/.vim/vimrc: No such file or directory
Anonymous No.106965638 [Report] >>106965812
>>106965323
>>106965417
Do Ugandans really think ts (this shit) is better than glorious elisp?
Anonymous No.106965732 [Report]
>>106963958 (OP)
nothing, but I do have
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Lua 9 152 252 1131
Nix 1 9 0 58
-------------------------------------------------------------------------------
SUM: 10 161 252 1189
-------------------------------------------------------------------------------
Anonymous No.106965812 [Report]
>>106965638
i'm No.106965417 / No.106965491
hahaha i laughted at the ugandan meme, yeah, trully embarassing for vim

also, vim has a cucked loycense, unlike emacs

https://hoop.dev/blog/understanding-the-vim-license-freedom-compatibility-and-charityware/
Anonymous No.106966037 [Report]
>>106963958 (OP)
I use it only as a portable config, because my main local editor is nvim.

set number relativenumber
set showcmd
set spell
syntax on

set ignorecase
set smartcase
set incsearch
set hlsearch

set autoindent
set smartindent
set virtualedit=onemore
set noexpandtab
set tabstop=4
set shiftwidth=4

set backspace=indent,eol,start
set foldmethod=manual
set paste

set undofile
set undodir=~/.vim/undo/

hi VertSplit cterm=NONE
hi Search ctermfg=black ctermbg=33
hi StatusLine ctermfg=black ctermbg=green
hi StatusLineNC ctermfg=black ctermbg=red
hi Visual ctermfg=NONE ctermbg=8
hi clear SpellBad
hi SpellBad cterm=underline gui=underline
Anonymous No.106966056 [Report] >>106966298
>>106965541
i forgot to thank you
you're such a nice anon ^_^
Anonymous No.106966095 [Report]
I'm white so I use emacs
Anonymous No.106966286 [Report] >>106967893
>>106965603
cat ~/.nanorc? emacs? joe? ed?
Anonymous No.106966298 [Report]
>>106966056
Thank (you). Appreciated.
Anonymous No.106966347 [Report]
>>106963958 (OP)
I've been using Notepad++ for the past few years
Tried to go back to gvim and it's like starting over
Just cannot
Anonymous No.106966547 [Report]
cat ~/.config/helix/config.toml
[editor]
line-number = "relative"
mouse = false

[editor.cursor-shape]
insert = "bar"
normal = "block"
select = "underline"
Anonymous No.106967884 [Report] >>106968357
>>106963958 (OP)
Cat looks kinda scared no?
Anonymous No.106967890 [Report] >>106967938 >>106968558
>>106965082
Why is it "${@:-1}"?

That would substitute a literal '1' if no arguments are provided
Should it not look like:


mkcd() {
mkdir -p -- "${1:?missing arg}" || return 1
cd -- "$1" || return 1
}
Anonymous No.106967893 [Report] >>106968575
>>106966286
>cat ~/.nanorc
[anon@4chan ~]$ cat ~/.nanorc
cat: /home/anon/.nanorc: No such file or directory
Anonymous No.106967938 [Report] >>106968566
>>106967890
Actually, looking at my own snippet.... And assuming that "mkdir -p" always returns 0 in the case where the directory already exists, it could be further simplified to just use &&

mkcd() {
mkdir -p -- "${1:?missing arg}" && cd -- "$1"
}


Just let the non-zero exit code of mkdir or cd be the implicit return value of the function if either fails (most likely due to permissions)
Anonymous No.106967944 [Report]
>No such file or directory
is it over for me?
Anonymous No.106968357 [Report]
>>106967884
He's 'bout to get (((MK_Ultra'd))) and he knows it.
Anonymous No.106968408 [Report] >>106968625
I quit having a custom vim config because I would get used to my stuff, and every time I ssh to a server, I would go insane without it. So I just accept that Vim is for small edits and always use the default.

My .bashrc has some stuff, but the only thing that matters to me is my PS1
export PS1="\[$(tput bold)\]\[$(tput setaf 6)\][\[$(tput setaf 7)\]\w\[$(tput setaf 6)\]] \[$(tput sgr0)\]"
Anonymous No.106968558 [Report] >>106969845
>>106967890
Probably. To be honest, I had coded it manually a few years ago and lost that .bashrc, working with windows for a few years and too tired to play with my linux at home. So a few months ago after leaving that job, I missed it and had some AI vibe code it from my memory. I know it's all shit but it was doing the job, so I never noticed these edge cases and assumed it was just doing some best practices or something. I removed a lot of comments and obvious ai slop before posting here to you guys.

I'm pretty sure the vibe coded PS1, vim status line and assorted other stuff is filled with ai crap too, but it's working good enough, so who cares?
Anonymous No.106968566 [Report] >>106969834
>>106967938
The original I remember using &&. I specifically wanted it to not cd if mkdir failed (mkdir file I guess would fail if file exists).
Anonymous No.106968575 [Report]
>>106967893
What's emacs/ed/etc rc dotfiles? .LibbieOffice rc? WHAT THE HELL DO YOU USE TO WRITE TEXT?
Anonymous No.106968625 [Report] >>106968695
>>106968408
just scp your vimrc onto the server. hell, stick your bashrc and inputrc on there too.
Anonymous No.106968695 [Report]
>>106968625
you really can't install shit or change shit on client servers. Big nono.
Some servers run a periodical script that does a md5 on all files to see what was changed. imagine me explaining that I trigger an alert because I wanted to use my custom vim file :)
Anonymous No.106969834 [Report]
>>106968566
>The original I remember using &&. I specifically wanted it to not cd if mkdir failed (mkdir file I guess would fail if file exists).
The "-p" flag makes it so that mkdir doesn't fail even if it already exists
Anonymous No.106969845 [Report]
>>106968558
>, so who cares?
I do
Anonymous No.106971428 [Report]
Third one doesn't seem to work anymore.
nmap <c-j> o<Esc>k " insert new line bellow in NORMAL mode
nmap <c-k> O<Esc> " insert new line above in NORMAL mode
cmap <c-h> i<Space><Esc>l " insert a blankspace before the cursor in NORMAL mode
nmap <c-l> a<Space><Esc>h " insert a blankspace after the cursor in NORMAL mode
Anonymous No.106971437 [Report]
nmap <c-j> o<Esc>k " insert new line bellow in NORMAL mode
nmap <c-k> O<Esc> " insert new line above in NORMAL mode
nmap <c-h> i<Space><Esc>l " insert a blankspace before the cursor in NORMAL mode
nmap <c-l> a<Space><Esc>h " insert a blankspace after the cursor in NORMAL mode
Anonymous No.106971443 [Report]
>>106963958 (OP)
set viminfo="NONE"
t. user of GNU emacs