From 016274b100d27ab6509c17f9a2762695bd1ee1ad Mon Sep 17 00:00:00 2001 From: Juni Kim Date: Fri, 15 Apr 2022 23:55:42 -0400 Subject: [PATCH] new configs added --- configuration.nix | 38 ++++++- dotfiles/.cwmrc | 33 ++++++ dotfiles/.xinitrc | 2 + dotfiles/.zshrc | 19 ++++ dotfiles/cwm.sh | 6 ++ dotfiles/init.vim | 201 +++++++++++++++++++++++++++++++++++++ dotfiles/kitty.conf | 35 +++++++ dotfiles/picom.conf | 8 ++ dotfiles/polybar/config | 173 +++++++++++++++++++++++++++++++ dotfiles/polybar/launch.sh | 16 +++ dotfiles/tmux.conf | 2 + home.nix | 72 +++++++++++++ 12 files changed, 600 insertions(+), 5 deletions(-) create mode 100644 dotfiles/.cwmrc create mode 100644 dotfiles/.xinitrc create mode 100644 dotfiles/.zshrc create mode 100755 dotfiles/cwm.sh create mode 100644 dotfiles/init.vim create mode 100644 dotfiles/kitty.conf create mode 100644 dotfiles/picom.conf create mode 100644 dotfiles/polybar/config create mode 100755 dotfiles/polybar/launch.sh create mode 100644 dotfiles/tmux.conf create mode 100644 home.nix diff --git a/configuration.nix b/configuration.nix index 3fe07a2..e87577b 100644 --- a/configuration.nix +++ b/configuration.nix @@ -72,21 +72,49 @@ users.users.junikim = { isNormalUser = true; extraGroups = [ "wheel" "video" "audio" "input" ]; # Enable ‘sudo’ for the user. + shell = pkgs.zsh; + }; + programs.zsh.enable = true; + programs.zsh.ohMyZsh.enable = true; + programs.zsh.autosuggestions.enable = true; + programs.zsh.shellAliases = { + "gac" = "git add . && git commit"; + "v" = "nvim"; + "c" = "clear"; + "s" = "ls"; + "e" = "exit"; + "sy" = "systemctl"; + "cp" = "cp -r"; + "vc" = "nvim ~/.config/nvim/init.vim"; + }; + programs.zsh.ohMyZsh.plugins = [ "git" "command-not-found" ]; + programs.zsh.syntaxHighlighting.enable = true; + + nixpkgs.config.allowUnfree = true; + environment.homeBinInPath = true; + environment.variables = { + "EDITOR" = "nvim"; }; # List packages installed in system profile. To search, run: # $ nix search wget + fonts.fonts = with pkgs; [ jetbrains-mono dejavu_fonts ]; environment.systemPackages = with pkgs; [ - vim neovim wget zsh brave + vim neovim neofetch tmux + fff + nodejs shellcheck + dash + wget brave + nfs-utils gcc gnumake ]; # Some programs need SUID wrappers, can be configured further or are # started in user sessions. # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; + programs.gnupg.agent = { + enable = true; + #enableSSHSupport = true; + }; # List services that you want to enable: diff --git a/dotfiles/.cwmrc b/dotfiles/.cwmrc new file mode 100644 index 0000000..ee9cfd4 --- /dev/null +++ b/dotfiles/.cwmrc @@ -0,0 +1,33 @@ +command term kitty + +bind-key 4-d dmenu_run +bind-key 4-f window-fullscreen +bind-key 4-Q window-close +bind-key 4-c window-cycle +bind-key 4-C window-rcycle +bind-key 4-h window-hide +bind-key 4-d "dmenu_run -fn \"JetBrains Mono:size=14\"" +bind-key 4-space "dmenu_run -fn \"JetBrains Mono:size=14\"" + +bind-key 4-W brave +bind-key 4-Return terminal + +bind-key M-Up "pactl set-sink-volume 0 +5%" +bind-key M-Down "pactl set-sink-volume 0 -5%" +bind-key M-m "pactl set-sink-mute 0 toggle" + +mousebind M-1 window_move +mousebind CM-1 window_resize + +bind-key 4-H window-htile +bind-key 4-V window-vtile + +sticky yes +bind-key 4-1 group-only-1 +bind-key 4-2 group-only-2 +bind-key 4-3 group-only-3 +bind-key 4S-1 window-movetogroup-1 +bind-key 4S-2 window-movetogroup-2 +bind-key 4S-3 window-movetogroup-3 + +gap 60 0 0 0 diff --git a/dotfiles/.xinitrc b/dotfiles/.xinitrc new file mode 100644 index 0000000..3919a04 --- /dev/null +++ b/dotfiles/.xinitrc @@ -0,0 +1,2 @@ +xrandr -s 1600x900 +exec dbus-run-session "$HOME/cwm.sh" diff --git a/dotfiles/.zshrc b/dotfiles/.zshrc new file mode 100644 index 0000000..b0eb7b3 --- /dev/null +++ b/dotfiles/.zshrc @@ -0,0 +1,19 @@ +set -o vi + +export MT_EDITOR=nvim +export VISUAL=nvim + +eval "$(starship init zsh)" + +f() { + fff "$@" + cd "$(cat "${XDG_CACHE_HOME:=${HOME}/.cache}/fff/.fff_d")" +} + +export PATH=~/cp:$PATH + +resetcursor() { + printf '\033]50;CursorShape=1\x7' +} +export PS1="$(resetcursor)$PS1" + diff --git a/dotfiles/cwm.sh b/dotfiles/cwm.sh new file mode 100755 index 0000000..d5be9aa --- /dev/null +++ b/dotfiles/cwm.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +command -V nitrogen && nitrogen --restore & +test -x ~/.config/polybar/launch.sh && ~/.config/polybar/launch.sh +picom & +cwm diff --git a/dotfiles/init.vim b/dotfiles/init.vim new file mode 100644 index 0000000..e0d8000 --- /dev/null +++ b/dotfiles/init.vim @@ -0,0 +1,201 @@ +map j gj +map k gk + +set mouse+=a + +"let g:airline_theme ='base16_atelier_heath_light' + +set number +set norelativenumber +set wrap +set linebreak + +" use indents of 4 spaces, and have them copied down lines: +set shiftwidth=2 +set tabstop=2 +set softtabstop=2 +set expandtab +set smarttab +set autoindent +set textwidth=80 +filetype indent off + +" enable filetype detection: +filetype on + +autocmd FileType markdown,tex,text set nosmarttab noautoindent +" for C-like programming, have automatic indentation: +autocmd FileType c,cpp,slang set cindent +" * Keystrokes -- Insert Mode +autocmd Filetype python set shiftwidth=4 tabstop=4 softtabstop=4 + +"Coc Stuff + +set encoding=utf-8 + +" TextEdit might fail if hidden is not set. +set hidden + +" Some servers have issues with backup files, see #649. +set nobackup +set nowritebackup + +" Give more space for displaying messages. +set cmdheight=2 + +" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable +" delays and poor user experience. +set updatetime=300 + +" Don't pass messages to |ins-completion-menu|. +set shortmess+=c + +" Always show the signcolumn, otherwise it would shift the text each time +" diagnostics appear/become resolved. +if has("nvim-0.5.0") || has("patch-8.1.1564") + " Recently vim can merge signcolumn and number column into one + set signcolumn=number +else + set signcolumn=yes +endif + +" Use tab for trigger completion with characters ahead and navigate. +" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by +" other plugin before putting this into your config. +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() +inoremap pumvisible() ? "\" : "\" + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Use to trigger completion. +if has('nvim') + inoremap coc#refresh() +else + inoremap coc#refresh() +endif + +" Make auto-select the first completion item and notify coc.nvim to +" format on enter, could be remapped by other vim plugin +inoremap pumvisible() ? coc#_select_confirm() + \: "\u\\=coc#on_enter()\" + +" Use `[g` and `]g` to navigate diagnostics +" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. +nmap [g (coc-diagnostic-prev) +nmap ]g (coc-diagnostic-next) + +" GoTo code navigation. +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" Use K to show documentation in preview window. +nnoremap K :call show_documentation() + +function! s:show_documentation() + if (index(['vim','help'], &filetype) >= 0) + execute 'h '.expand('') + elseif (coc#rpc#ready()) + call CocActionAsync('doHover') + else + execute '!' . &keywordprg . " " . expand('') + endif +endfunction + +" Highlight the symbol and its references when holding the cursor. +autocmd CursorHold * silent call CocActionAsync('highlight') + +" Symbol renaming. +nmap rn (coc-rename) + +" Formatting selected code. +xmap f (coc-format-selected) +nmap f (coc-format-selected) + +augroup mygroup + autocmd! + " Setup formatexpr specified filetype(s). + autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') + " Update signature help on jump placeholder. + autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') +augroup end + +" Applying codeAction to the selected region. +" Example: `aap` for current paragraph +xmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) + +" Remap keys for applying codeAction to the current buffer. +nmap ac (coc-codeaction) +" Apply AutoFix to problem on the current line. +nmap qf (coc-fix-current) + +" Run the Code Lens action on the current line. +nmap cl (coc-codelens-action) + +" Map function and class text objects +" NOTE: Requires 'textDocument.documentSymbol' support from the language server. +xmap if (coc-funcobj-i) +omap if (coc-funcobj-i) +xmap af (coc-funcobj-a) +omap af (coc-funcobj-a) +xmap ic (coc-classobj-i) +omap ic (coc-classobj-i) +xmap ac (coc-classobj-a) +omap ac (coc-classobj-a) + +" Remap and for scroll float windows/popups. +if has('nvim-0.4.0') || has('patch-8.2.0750') + nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" + inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" + inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" + vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" +endif + +" Use CTRL-S for selections ranges. +" Requires 'textDocument/selectionRange' support of language server. +nmap (coc-range-select) +xmap (coc-range-select) + +" Add `:Format` command to format current buffer. +command! -nargs=0 Format :call CocActionAsync('format') + +" Add `:Fold` command to fold current buffer. +command! -nargs=? Fold :call CocAction('fold', ) + +" Add `:OR` command for organize imports of the current buffer. +command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport') + +" Add (Neo)Vim's native statusline support. +" NOTE: Please see `:h coc-status` for integrations with external plugins that +" provide custom statusline: lightline.vim, vim-airline. +set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} + +" Mappings for CoCList +" Show all diagnostics. +nnoremap a :CocList diagnostics +" Manage extensions. +nnoremap e :CocList extensions +" Show commands. +nnoremap c :CocList commands +" Find symbol of current document. +nnoremap o :CocList outline +" Search workspace symbols. +nnoremap s :CocList -I symbols +" Do default action for next item. +nnoremap j :CocNext +" Do default action for previous item. +nnoremap k :CocPrev +" Resume latest coc list. +nnoremap p :CocListResume + +" END Coc diff --git a/dotfiles/kitty.conf b/dotfiles/kitty.conf new file mode 100644 index 0000000..06121ef --- /dev/null +++ b/dotfiles/kitty.conf @@ -0,0 +1,35 @@ +# vim:ft=conf + +font_family JetBrains Mono +font_size 11.5 + +background_opacity 0.8 +dynamic_background_opacity yes + +window_margin_width 5 +bell_path none +bell_on_tab no + +enable_audio_bell no + +background #2b2c2e +foreground #d2d8d9 +cursor #708183 +selection_background #e3e8ed +color0 #7c8a8f +color8 #888888 +color1 #b23a51 +color9 #f24840 +color2 #789a69 +color10 #80c46f +color3 #b9ab4a +color11 #ffeb62 +color4 #2a7fac +color12 #4095ff +color5 #bc4f5a +color13 #fb5175 +color6 #44a799 +color14 #52ccbd +color7 #d2d8d9 +color15 #d2d8d9 +selection_foreground #2b2c2e diff --git a/dotfiles/picom.conf b/dotfiles/picom.conf new file mode 100644 index 0000000..494f8fb --- /dev/null +++ b/dotfiles/picom.conf @@ -0,0 +1,8 @@ +#vim:ft=conf + +fade-in-step = 1.0; +fade-out-step = 1.0; + +rounded-corners-exclude = [ + "class_g = 'Polybar'" +] diff --git a/dotfiles/polybar/config b/dotfiles/polybar/config new file mode 100644 index 0000000..127abcb --- /dev/null +++ b/dotfiles/polybar/config @@ -0,0 +1,173 @@ +;========================================================== +; +; +; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗ +; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗ +; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝ +; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗ +; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║ +; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ +; +; +; To learn more about how to configure Polybar +; go to https://github.com/polybar/polybar +; +; The README contains a lot of information +; +;========================================================== + +[colors] +background = #222 +background-alt = #444 +;foreground = ${xrdb:color7:#222} +foreground = #dfdfdf +foreground-alt = #555 +primary = #cec0af +secondary = #242e35 +alert = #bd2c40 +black = #000 +white = #fff +grey = #aaa +darkgrey = #555 +red = #f00 +green = #0f0 +blue = #2d02d0 +yellow = #d2b55b + +[bar/main] +modules-center = date +font-0 = Jetbrains Mono:style=Regular +height = 30 +width = 320 +offset-x = 15 + +offset-y = 15 +background = ${colors.primary} +radius=5 +override-redirect=true + +[module/date] +type = internal/date +date = "%h-%d-20%y %r" +label-foreground = #000000 + +[bar/pulse] +modules-center = pulseaudio +height = 30 +width = 200 +offset-y = 15 +#offset-x = 1300 +offset-x = 350 +radius=5 +override-redirect=true +background = ${colors.secondary} +foreground = #fff +font-0 = Jetbrains Mono:style=Regular +font-1 = FontAwesome:style=Regular +font-2 = "Iosevka:pixelsize=12;0" +font-3 = RobotoMono Nerd Font:pixelsize=12;1 + +[module/xworkspaces] +type = internal/xworkspaces + +label-active = %name% +label-active-background = ${colors.background-alt} +label-active-underline= ${colors.primary} +label-active-padding = 1 + +label-occupied = %name% +label-occupied-padding = 1 + +label-urgent = %name% +label-urgent-background = ${colors.alert} +label-urgent-padding = 1 + +label-empty = %name% +label-empty-foreground = ${colors.disabled} +label-empty-padding = 1 + +[module/xwindow] +type = internal/xwindow +label = %title:0:60:...% + +[module/filesystem] +type = internal/fs +interval = 25 + +mount-0 = / + +label-mounted = %{F#F0C674}%mountpoint%%{F-} %percentage_used%% + +label-unmounted = %mountpoint% not mounted +label-unmounted-foreground = ${colors.disabled} + +[module/pulseaudio] +type = internal/pulseaudio + +format-volume-prefix = "VOL " +format-volume-prefix-foreground = ${colors.primary} +format-volume = + +label-volume = %percentage%% + +label-muted = muted +label-muted-foreground = ${colors.disabled} + +[module/xkeyboard] +type = internal/xkeyboard +blacklist-0 = num lock + +label-layout = %layout% +label-layout-foreground = ${colors.primary} + +label-indicator-padding = 2 +label-indicator-margin = 1 +label-indicator-foreground = ${colors.background} +label-indicator-background = ${colors.secondary} + +[module/memory] +type = internal/memory +interval = 2 +format-prefix = "RAM " +format-prefix-foreground = ${colors.primary} +label = %percentage_used:2%% + +[module/cpu] +type = internal/cpu +interval = 2 +format-prefix = "CPU " +format-prefix-foreground = ${colors.primary} +label = %percentage:2%% + +[network-base] +type = internal/network +interval = 5 +format-connected = +format-disconnected = +label-disconnected = %{F#F0C674}%ifname%%{F#707880} disconnected + +[module/wlan] +inherit = network-base +interface-type = wireless +label-connected = %{F#F0C674}%ifname%%{F-} %essid% %local_ip% + +[module/eth] +inherit = network-base +interface-type = wired +label-connected = %{F#F0C674}%ifname%%{F-} %local_ip% + +#[module/date] +#type = internal/date +#interval = 1 + +#date = %H:%M +#date-alt = %Y-%m-%d %H:%M:%S + +#label = %date% +#label-foreground = ${colors.primary} + +[settings] +screenchange-reload = true +pseudo-transparency = true + +; vim:ft=dosini diff --git a/dotfiles/polybar/launch.sh b/dotfiles/polybar/launch.sh new file mode 100755 index 0000000..44df691 --- /dev/null +++ b/dotfiles/polybar/launch.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +#!/bin/bash + +# Terminate already running bar instances +pkill polybar + +# Wait until the processes have been shut down +while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done + +# Launch Polybar, using default config location ~/.config/polybar/config + +polybar main & sleep 0.5 +polybar pulse & + +echo "Polybar launched..." diff --git a/dotfiles/tmux.conf b/dotfiles/tmux.conf new file mode 100644 index 0000000..1e3a362 --- /dev/null +++ b/dotfiles/tmux.conf @@ -0,0 +1,2 @@ +set -sg escape-time 0 +set -g mouse on diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..0f83453 --- /dev/null +++ b/home.nix @@ -0,0 +1,72 @@ +{ config, pkgs, ... }: + +{ + # Home Manager needs a bit of information about you and the + # paths it should manage. + home.username = "junikim"; + home.homeDirectory = "/home/junikim"; + + # This value determines the Home Manager release that your + # configuration is compatible with. This helps avoid breakage + # when a new Home Manager release introduces backwards + # incompatible changes. + # + # You can update Home Manager without changing this value. See + # the Home Manager release notes for a list of state version + # changes in each release. + home.stateVersion = "22.05"; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + programs.starship = { + enable = true; + }; + home.packages = with pkgs; [ + vim xclip neofetch tmux + fff + nodejs shellcheck + dash + wget brave + cwm polybarFull kitty nitrogen dmenu picom + nfs-utils gcc gnumake pulsemixer + ]; + + programs.neovim = { + enable = true; + plugins = with pkgs.vimPlugins; [ + coc-nvim + neovim-sensible + vim-airline + vim-airline-themes + vim-nix + ]; + extraConfig = builtins.readFile ./dotfiles/init.vim; + }; + + programs.git = { + package = pkgs.gitAndTools.gitFull; + enable = true; + userName = "Juni Kim"; + userEmail = "junikimm717@gmail.com"; + }; + + programs.zsh.oh-my-zsh.enable = true; + programs.zsh.oh-my-zsh.theme = "robbyrussell"; + + + home.file = { + #".config/nvim/init.vim".source = ./dotfiles/init.vim; + ".config/polybar" = { + source = ./dotfiles/polybar; + recursive = true; + }; + ".config/kitty/kitty.conf".source = ./dotfiles/kitty.conf; + ".config/picom/picom.conf".source = ./dotfiles/picom.conf; + ".cwmrc".source = ./dotfiles/.cwmrc; + "cwm.sh".source = ./dotfiles/cwm.sh; + ".xinitrc".source = ./dotfiles/.xinitrc; + ".zshrc".source = ./dotfiles/.zshrc; + ".tmux.conf".source = ./dotfiles/tmux.conf; + }; +}