mirror of
				https://github.com/ItsDrike/dotfiles.git
				synced 2025-11-04 01:16:35 +00:00 
			
		
		
		
	Merge branch 'arch' into gentoo
This commit is contained in:
		
						commit
						775a3baf23
					
				
					 4 changed files with 41 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
"set viminfofile=$XDG_CACHE_HOME/vim/viminfo
 | 
			
		||||
 | 
			
		||||
" Disable automatic commenting on newline
 | 
			
		||||
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
 | 
			
		||||
autocmd FileType * setlocal formatoptions-=cro
 | 
			
		||||
 | 
			
		||||
" Have Vim jump to the last position when reopening a file
 | 
			
		||||
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
 | 
			
		||||
| 
						 | 
				
			
			@ -10,3 +10,6 @@ autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "norm
 | 
			
		|||
" Automatically deletes all trailing whitespace on save
 | 
			
		||||
autocmd BufWritePre * %s/\s\+$//e
 | 
			
		||||
 | 
			
		||||
" Enable spellcheck for certain file types
 | 
			
		||||
autocmd FileType tex,latex,markdown,gitcommit setlocal spell spelllang=en_us
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,20 +4,24 @@ nnoremap <Left> <nop>
 | 
			
		|||
nnoremap <Right> <nop>
 | 
			
		||||
nnoremap <Up> <nop>
 | 
			
		||||
 | 
			
		||||
" Stop search highlight on esc (until next search)
 | 
			
		||||
map <silent> <esc> :noh<CR>
 | 
			
		||||
" Stop search highlight on Ctrl+l (until next search)
 | 
			
		||||
map <silent> <C-l> :noh<CR>
 | 
			
		||||
 | 
			
		||||
" System clipboard interactions
 | 
			
		||||
map <C-c> "+y
 | 
			
		||||
vnoremap <C-v> "+p
 | 
			
		||||
 | 
			
		||||
" Spell-check set to <leader>o, 'o' for 'orthography'
 | 
			
		||||
map <leader>o :setlocal spell! spelllang=en_US<CR>
 | 
			
		||||
" Start spell-check
 | 
			
		||||
map <leader>s :setlocal spell! spelllang=en_us<CR>
 | 
			
		||||
 | 
			
		||||
" Use shift to move 10 lines up/down quickly
 | 
			
		||||
noremap <silent> K 10k
 | 
			
		||||
noremap <silent> J 10j
 | 
			
		||||
 | 
			
		||||
" Enable/Disable auto comment
 | 
			
		||||
map <leader>c :setlocal formatoptions-=cro<CR>
 | 
			
		||||
map <leader>C :setlocal formatoptions=cro<CR>
 | 
			
		||||
 | 
			
		||||
" Tab navigation
 | 
			
		||||
nnoremap <Tab> gt
 | 
			
		||||
nnoremap <S-Tab> gT
 | 
			
		||||
| 
						 | 
				
			
			@ -27,12 +31,6 @@ nnoremap <silent> <A-1> :tabmove -<CR>
 | 
			
		|||
nnoremap <A-p> :tabp<CR>
 | 
			
		||||
nnoremap <A-n> :tabn<CR>
 | 
			
		||||
 | 
			
		||||
" Alias replace all
 | 
			
		||||
nnoremap <A-s> :%s//gI<Left><Left><Left>
 | 
			
		||||
 | 
			
		||||
" Save file as sudo when no write permissions
 | 
			
		||||
cmap w!! w !sudo tee > /dev/null %
 | 
			
		||||
 | 
			
		||||
" Remap splits navigation to just CTRL + hjkl
 | 
			
		||||
nnoremap <C-h> <C-w>h
 | 
			
		||||
nnoremap <C-j> <C-w>j
 | 
			
		||||
| 
						 | 
				
			
			@ -45,7 +43,18 @@ noremap <silent> <C-Right> :vertical resize -3<CR>
 | 
			
		|||
noremap <silent> <C-Up> :resize +3<CR>
 | 
			
		||||
noremap <silent> <C-Down> :resize -3<CR>
 | 
			
		||||
 | 
			
		||||
" Alias replace all
 | 
			
		||||
nnoremap <A-s> :%s//gI<Left><Left><Left>
 | 
			
		||||
 | 
			
		||||
" Save file as sudo when no write permissions
 | 
			
		||||
cmap w!! w !sudo tee > /dev/null %
 | 
			
		||||
 | 
			
		||||
" Don't leave visual mode after indenting
 | 
			
		||||
vmap < <gv
 | 
			
		||||
vmap > >gv
 | 
			
		||||
 | 
			
		||||
" Compile opened file (using custom comp script)
 | 
			
		||||
nnoremap <A-c> :w \| !comp <c-r>%<CR>
 | 
			
		||||
 | 
			
		||||
" Shell check
 | 
			
		||||
nnoremap <leader>p :!shellcheck %<CR>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ set guioptions-=T           " Remove toolbar
 | 
			
		|||
set guioptions-=r           " Remove right-hand scrollbar
 | 
			
		||||
set guioptions-=L           " Remove left-hand scrollbar
 | 
			
		||||
 | 
			
		||||
if empty($DISPLAY) " Don't use true colors (256) in TTY
 | 
			
		||||
" Use more noticable cursor line color
 | 
			
		||||
highlight CursorLine guibg=#2b2b2b
 | 
			
		||||
 | 
			
		||||
" Don't use true colors in TTY
 | 
			
		||||
if empty($DISPLAY)
 | 
			
		||||
    set notermguicolors
 | 
			
		||||
else
 | 
			
		||||
    set termguicolors
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										13
									
								
								home/.local/bin/scripts/comp
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										13
									
								
								home/.local/bin/scripts/comp
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,13 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
# Compile given file
 | 
			
		||||
 | 
			
		||||
file=$(readlink -f "$1")
 | 
			
		||||
base="$(dirname "$file")/$(basename "$file" | sed 's/\..*//')"
 | 
			
		||||
 | 
			
		||||
case "$file" in
 | 
			
		||||
    *.md) pandoc --filter pandoc-crossref "$file" -o "$base".pdf ;;
 | 
			
		||||
    *.asm) nasm -f elf64 "$file" -o "$base".o && ld "$base".o -o "$base" ;;
 | 
			
		||||
    *.c) gcc "$file" -o "$base" ;;
 | 
			
		||||
    *.cpp) g++ "$file" -o "$base" ;;
 | 
			
		||||
    *) echo "Can't compile!" && exit 1 ;;
 | 
			
		||||
esac
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue