Add configs

Add configs for:
- X.org
- zsh
- neovim
master
Plaza521 2023-10-27 16:02:26 +03:00
commit 8b7739b9a9
Signed by untrusted user who does not match committer: nakidai
GPG Key ID: 914675D395210A97
7 changed files with 217 additions and 0 deletions

100
nvim/init.vim Normal file
View File

@ -0,0 +1,100 @@
" Set variables
set number
set relativenumber
set autoindent
set expandtab
set tabstop=4
set shiftwidth=4
set smarttab
set softtabstop=4
set mouse=a
set termguicolors
" Use system clipboard
set clipboard+=unnamedplus
" My leader key is space
let mapleader = " "
" Close NERDTree when I open something in it
let g:NERDTreeQuitOnOpen = 1
" C is cool
let g:c_syntax_for_h = 1
let g:lightline = {
\ 'colorscheme': 'catppuccin',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'gitbranch': 'FugitiveHead'
\ },
\ }
" Plugins
call plug#begin()
Plug 'catppuccin/nvim', { 'as': 'catppuccin' }
" Status & tab bars
Plug 'itchyny/lightline.vim'
" Automaticly create closing bracket
Plug 'windwp/nvim-autopairs'
" Plugin for comfortable navigating
Plug 'preservim/nerdtree'
" Plugin for surround text in something faster
Plug 'kylechui/nvim-surround'
" Plugin for snippets
Plug 'dcampos/nvim-snippy'
" Plugin for git integration
Plug 'tpope/vim-fugitive'
call plug#end()
autocmd VimEnter *
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | q
\| endif
autocmd TermOpen * setlocal nonumber norelativenumber
" Set mappings
" Toggle files tree
nmap <silent> <Leader>y :NERDTreeToggle<CR>
" Navigate in splits
nmap <silent> <Leader>k :wincmd k<CR>
nmap <silent> <Leader>j :wincmd j<CR>
nmap <silent> <Leader>h :wincmd h<CR>
nmap <silent> <Leader>l :wincmd l<CR>
" Switch tabs
nmap <silent> H :tabp<CR>
nmap <silent> L :tabn<CR>
" Edit size of split
nmap <silent> <c-k> :resize +5<CR>
nmap <silent> <c-j> :resize -5<CR>
nmap <silent> <c-h> :vertical resize -5<CR>
nmap <silent> <c-l> :vertical resize +5<CR>
" Hide search highlighting
nmap <silent> <Leader>n :nohlsearch<CR>
" Saving time to not write ":Git "
nmap <Leader>g :Git
" Terminal
nnoremap <silent> <Leader>t :terminal<CR>i
tnoremap <silent> <C-c><C-c> <C-\><C-n>
" For snippets
imap <expr> <Tab> snippy#can_expand_or_advance() ? '<Plug>(snippy-expand-or-advance)' : '<Tab>'
imap <expr> <S-Tab> snippy#can_jump(-1) ? '<Plug>(snippy-previous)' : '<S-Tab>'
smap <expr> <Tab> snippy#can_jump(1) ? '<Plug>(snippy-next)' : '<Tab>'
smap <expr> <S-Tab> snippy#can_jump(-1) ? '<Plug>(snippy-previous)' : '<S-Tab>'
xmap <Tab> <Plug>(snippy-cut-text)
" Create blank like below or above
nmap <silent> zj o<Esc>k
nmap <silent> zk O<Esc>j
" Setupping
colorscheme catppuccin-frappe
lua require('nvim-surround').setup()
lua require('nvim-autopairs').setup()
" lua require('toggleterm').setup()

64
nvim/snippets/c.snippets Normal file
View File

@ -0,0 +1,64 @@
snippet mcs
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
$0
return 0;
}
snippet guards
#ifndef ${1:NAME}
#define ${1:NAME}
${0:/* code */}
#endif /* ${1:NAME} */
snippet comment
/* $0 */
snippet func
${1:void} ${2:function}(${3:void})
{
${0:/* code */}
}
snippet proto
${1:void} ${2:function}(${0:void});
snippet if1
(${1:true}) : ${2:/* if true */} ? ${0:/* if false */}
snippet if
if (${1:true})
{
${0:/* code */}
}
snippet ife
if (${1:true})
{
${2:/* code */}
} else
{
${0:/* code */}
}
snippet eif
else if (${1:true})
{
${0:/* code */}
}
snippet el
else
{
${0:/* code */}
}
snippet wh
while (${1:true})
{
${0:/* code */}
}
snippet forr
for (${1:i} = 0; ${1:i} < ${2:n}; ++${1:i})
{
${0:/* code */}
}
snippet inc
#include "$0"
snippet Inc
#include <$0>

View File

@ -0,0 +1,12 @@
snippet ifmain
def main() -> None:
${0:pass}
if __name__ == "__main__":
main()
snippet from
from ${1:library} import ${0:object}
snippet forrange
for ${1:i} in range(${2:0}, ${3:n}):
${0:pass}

3
x/.zprofile Normal file
View File

@ -0,0 +1,3 @@
if [ "$(tty)" = "/dev/tty1" ]; then
startx
fi

9
x/01-touchpad.conf Normal file
View File

@ -0,0 +1,9 @@
Section "InputClass"
Identifier "libinput touchpad catchall"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Option "Tapping" "True"
Option "TappingDrag" "True"
Option "NaturalScrolling" "True"
Driver "libinput"
EndSection

0
x/10-dri.conf Normal file
View File

29
zsh/.zshrc Normal file
View File

@ -0,0 +1,29 @@
export ZSH="$HOME/.oh-my-zsh"
export EDITOR=nvim
XDG_CONFIG_HOME="~/.config"
plugins=(git)
source ~/headline.zsh-theme
source $ZSH/oh-my-zsh.sh
source ~/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Functions
function reset-cursor()
{
printf "\e[3 q" > $TTY
}
function precmd()
{
reset-cursor
}
# Aliases
alias dem="doas emerge"
alias stdn="doas shutdown -ah 0"
alias rbot="doas reboot"
alias vi=nvim
alias dv=doas nvim
# Autoexec
clear; mycfetch