From 8b7739b9a96ddc5cf3bdaffa6b23a229acf5c259 Mon Sep 17 00:00:00 2001 From: Plaza521 Date: Fri, 27 Oct 2023 16:02:26 +0300 Subject: [PATCH] Add configs Add configs for: - X.org - zsh - neovim --- nvim/init.vim | 100 ++++++++++++++++++++++++++++++++++ nvim/snippets/c.snippets | 64 ++++++++++++++++++++++ nvim/snippets/python.snippets | 12 ++++ x/.zprofile | 3 + x/01-touchpad.conf | 9 +++ x/10-dri.conf | 0 zsh/.zshrc | 29 ++++++++++ 7 files changed, 217 insertions(+) create mode 100644 nvim/init.vim create mode 100644 nvim/snippets/c.snippets create mode 100644 nvim/snippets/python.snippets create mode 100644 x/.zprofile create mode 100644 x/01-touchpad.conf create mode 100644 x/10-dri.conf create mode 100644 zsh/.zshrc diff --git a/nvim/init.vim b/nvim/init.vim new file mode 100644 index 0000000..89fb9a9 --- /dev/null +++ b/nvim/init.vim @@ -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 y :NERDTreeToggle +" Navigate in splits +nmap k :wincmd k +nmap j :wincmd j +nmap h :wincmd h +nmap l :wincmd l +" Switch tabs +nmap H :tabp +nmap L :tabn +" Edit size of split +nmap :resize +5 +nmap :resize -5 +nmap :vertical resize -5 +nmap :vertical resize +5 +" Hide search highlighting +nmap n :nohlsearch +" Saving time to not write ":Git " +nmap g :Git + +" Terminal +nnoremap t :terminali +tnoremap + +" For snippets +imap snippy#can_expand_or_advance() ? '(snippy-expand-or-advance)' : '' +imap snippy#can_jump(-1) ? '(snippy-previous)' : '' +smap snippy#can_jump(1) ? '(snippy-next)' : '' +smap snippy#can_jump(-1) ? '(snippy-previous)' : '' +xmap (snippy-cut-text) + +" Create blank like below or above +nmap zj ok +nmap zk Oj + + +" Setupping +colorscheme catppuccin-frappe +lua require('nvim-surround').setup() +lua require('nvim-autopairs').setup() +" lua require('toggleterm').setup() + diff --git a/nvim/snippets/c.snippets b/nvim/snippets/c.snippets new file mode 100644 index 0000000..840183e --- /dev/null +++ b/nvim/snippets/c.snippets @@ -0,0 +1,64 @@ +snippet mcs + #include + #include + + 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> diff --git a/nvim/snippets/python.snippets b/nvim/snippets/python.snippets new file mode 100644 index 0000000..b2cce7d --- /dev/null +++ b/nvim/snippets/python.snippets @@ -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} diff --git a/x/.zprofile b/x/.zprofile new file mode 100644 index 0000000..8683cb7 --- /dev/null +++ b/x/.zprofile @@ -0,0 +1,3 @@ +if [ "$(tty)" = "/dev/tty1" ]; then + startx +fi diff --git a/x/01-touchpad.conf b/x/01-touchpad.conf new file mode 100644 index 0000000..6e268d2 --- /dev/null +++ b/x/01-touchpad.conf @@ -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 diff --git a/x/10-dri.conf b/x/10-dri.conf new file mode 100644 index 0000000..e69de29 diff --git a/zsh/.zshrc b/zsh/.zshrc new file mode 100644 index 0000000..bde93df --- /dev/null +++ b/zsh/.zshrc @@ -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