Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
zsh/secrets.zsh
1 change: 1 addition & 0 deletions git/.gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
autoCorrect = 1
[push]
default = current
autoSetupRemote = true
followTags = true
[pull]
rebase = merges
Expand Down
1 change: 1 addition & 0 deletions git/aliases.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ alias gcob='git checkout -b'
alias gcp="git cherry-pick -x"
alias gb='git branch'
alias gbr='git branch -D'
alias gbu='git branch -u origin/$(git rev-parse --abbrev-ref HEAD)'

alias lg='lazygit'
2 changes: 1 addition & 1 deletion install.conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
- link:
~/.zshrc: zsh/zshrc
~/.ideavimrc: nvim/ideavimrc
~/.config/nvim/init.vim: nvim/init.vim
~/.config/nvim/init.vim: nvim/vimrc
~/.gitignore: git/.gitignore
~/.gitconfig: git/.gitconfig
~/.gitconfig-sap: git/.gitconfig-sap
Expand Down
182 changes: 182 additions & 0 deletions nvim/configs/base.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
" --------------
" Base config (shared by all environments)
" --------------

nnoremap <SPACE> <Nop>
let mapleader = " "
inoremap jk <ESC>
tnoremap <ESC> <C-\><C-n>
nnoremap <leader>ve <cmd>tabedit $MYVIMRC<CR>
nnoremap <leader>vr <cmd>source $MYVIMRC<CR>

" Copy & Paste
map <leader>y "*y
map <leader>yy "*yy
map <leader>Y "*Y
map <leader>p "*p<CR>
map <leader>P "*P<CR>
nnoremap Y y$
" Maintain the cursor position when yanking a visual selection
vnoremap <expr>y "my\"" . v:register . "y`y"
vnoremap <expr>Y "my\"" . v:register . "Y`y"
vnoremap p "_dP

" Save & Quit
nnoremap <leader>w :w<CR>
nnoremap <leader>q :q<CR>
nnoremap <leader>Q :qa<CR>

" Line ending/start on home row
nnoremap H ^
nnoremap L $

" Settings toggles
nnoremap <ESC> :set hlsearch!<CR>

" Faster scrolling
nnoremap J 6j
nnoremap K 6k
vnoremap K 6k
vnoremap J 6j

" Stay in normal mode after inserting a new line
noremap o o <Esc>
noremap O O <Esc>

" Un-/indent using TAB
nnoremap <TAB> >>
nnoremap <S-TAB> <<
vnoremap <TAB> >
vnoremap <S-TAB> <

" LSP keymaps (to be extended in env-specific configs)

" --------------
" General settings
" --------------
syntax on
filetype plugin indent on
set number
set relativenumber
set undolevels=1000
set noshowmode
set completeopt=menu,menuone,noselect
set mouse=a

" Backup
set noswapfile
set nobackup
set nowritebackup

" Search
set hlsearch
set ignorecase
set incsearch
set smartcase

" Indentation
set tabstop=2
set softtabstop=0
set shiftwidth=2
set expandtab
set autoindent
set foldmethod=indent
set foldlevel=99
set foldlevelstart=99
set listchars=space:·,tab:>-,eol:↴,precedes:«,extends:»,trail:~
set list
set fillchars+=diff:╱

" Splits
set splitbelow
set splitright

" --------------
" Utility functions
" --------------
function! Cond(cond, ...)
let opts = get(a:000, 0, {})
return a:cond ? opts : extend(opts, { 'on': [], 'for': [] })
endfunction

" --------------
" Plugins (shared and environment-specific)
" --------------

" Install vim-plug if not found
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif

" Run PlugInstall if there are missing plugins
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | q
\| endif

call plug#begin(stdpath('data') . '/plugged')
" Plugins
Plug 'tpope/vim-surround' " Provides mappings to easily change surroundings in pairs.
Plug 'wellle/targets.vim' " Adds various text objects to give you more targets to operate on.
Plug 'tpope/vim-repeat' " Makes plugin actions repeatable using dot.
Plug 'tpope/vim-sleuth' " Automatically adjusts 'shiftwidth' and 'expandtab' heuristically based on the current file.
Plug 'unblevable/quick-scope' " Highlight unique character in every word to help with f, F.
Plug 'justinmk/vim-sneak' " Jump vertically using two characters.

" Enable certain plugins IdeaVIM
if has('ide')
Plug 'tpope/vim-commentary' " Same as Comment.nvim but written in vimscript and without treesitter
endif

" Disable certain plugins IdeaVIM
if !has('ide')
Plug 'm4xshen/hardtime.nvim' "Break bad habits, master Vim motions.
Plug 'numToStr/Comment.nvim' " Smart and Powerful commenting plugin for neovim
endif

" Disable certain plugins for VSCode and IdeaVIM
if !exists('g:vscode') && !has('ide')
Plug 'nvim-lua/plenary.nvim' " Dependency for a lot of lua plugins. Packages many lua utility functions.
Plug 'nvim-telescope/telescope.nvim' " Fuzzy file finder.
Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' } " Makes fuzzy finding in telescope faster.
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " Syntax highlighting and other stuff.
Plug 'neovim/nvim-lspconfig' " Used to configure neovim lsp for different lsp servers.
Plug 'nvim-lualine/lualine.nvim' " Statusbar
Plug 'junegunn/vim-peekaboo' " Displays a right buffer to view register content & select the desired register before pasting.
Plug 'windwp/nvim-autopairs' " Automatically inserts matching brackets & quotes.
Plug 'kyazdani42/nvim-tree.lua' " Sidebar which displays the current working-tree (files).
Plug 'kyazdani42/nvim-web-devicons' " Icons for nvim-tree.
Plug 'hrsh7th/nvim-cmp' " Autocompletion plugin.
Plug 'hrsh7th/vim-vsnip' " Snipped engine used by nvim-cmp. Used to insert code snippets.
Plug 'hrsh7th/cmp-nvim-lsp' " LSP source for nvim-cmp. Is required to display lsp content in the autocomplete popover.
Plug 'hrsh7th/cmp-vsnip' " VSnip source for nvim-cmp.
Plug 'hrsh7th/cmp-buffer' " Buffer source for nvim-cmp.
Plug 'ray-x/lsp_signature.nvim' " Shows function signature when you type.
Plug 'onsails/lspkind-nvim' " Adds pictograms to completion popups.
Plug 'lukas-reineke/indent-blankline.nvim' " Display indentation lines.
Plug 'folke/trouble.nvim' " Display diagnostics in a pretty list.
Plug 'voldikss/vim-floaterm' " Use the terminal in a floating/popup window.
Plug 'sindrets/diffview.nvim' " Single tabpage interface for easily cycling through git diffs.
Plug 'rmagatti/auto-session' " Automatically creates sessions on exit & restores them as soon as vim is started.

" Themes
Plug 'catppuccin/nvim'
endif
call plug#end()

" Plugin Configs
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
let g:sneak#label = 1

if !has('ide')
lua <<EOF
-- Hardtime
require('hardtime').setup {
disable_mouse = false
}

-- Comment
require('Comment').setup {}
EOF
endif
33 changes: 33 additions & 0 deletions nvim/configs/idea.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
https://www.cyberwizard.io/posts/the-ultimate-ideavim-setup/

" Go to code
nmap gh <Action>(QuickJavaDoc)
nmap <leader>gd <Action>(GotoDeclaration)
nmap <leader>gD <Action>(GotoTypeDeclaration)
nmap <leader>gi <Action>(GotoImplementation)
nmap <leader>gr <Action>(ShowUsages)
nmap <leader>gt <Action>(GotoTest)
nmap <leader>gf <Action>(Back)
nmap <leader>gb <Action>(Forward)

" File navigation
nmap <leader>ff <action>(GotoFile)
nmap <leader>fr <action>(RecentFiles)
nmap <leader>fc <action>(FindInPath)
nmap <leader><leader> <Action>(RecentFiles)
nmap <leader>fl <action>(RecentLocations)
nmap <leader>fs <action>(NewScratchFile)

" Refactoring
nmap <leader>rn <Action>(RenameElement)
nmap <leader>rm <Action>(ExtractMethod)
nmap <leader>rv <Action>(IntroduceVariable)
nmap <leader>rf <Action>(IntroduceField)
nmap <leader>rs <Action>(ChangeSignature)
nmap <leader>rr <Action>(Refactorings.QuickListPopupAction)

" Window navigation
nmap <C-h> <Action>(PrevSplitter)
nmap <C-l> <Action>(NextSplitter)

set highlightedyank
Loading