Initial commit
This commit is contained in:
commit
2fc9999059
|
@ -0,0 +1 @@
|
|||
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
|
|
@ -0,0 +1,7 @@
|
|||
# ~/.bash_logout: executed by bash(1) when login shell exits.
|
||||
|
||||
# when leaving the console clear the screen to increase privacy
|
||||
|
||||
if [ "$SHLVL" = 1 ]; then
|
||||
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
|
||||
fi
|
|
@ -0,0 +1,127 @@
|
|||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
||||
# for examples
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
#shopt -s globstar
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# set variable identifying the chroot you work in (used in the prompt below)
|
||||
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
||||
debian_chroot=$(cat /etc/debian_chroot)
|
||||
fi
|
||||
|
||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||
case "$TERM" in
|
||||
xterm-color|*-256color) color_prompt=yes;;
|
||||
esac
|
||||
|
||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||
# off by default to not distract the user: the focus in a terminal window
|
||||
# should be on the output of commands, not on the prompt
|
||||
#force_color_prompt=yes
|
||||
|
||||
if [ -n "$force_color_prompt" ]; then
|
||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=yes
|
||||
else
|
||||
color_prompt=
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
|
||||
else
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
fi
|
||||
unset color_prompt force_color_prompt
|
||||
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# colored GCC warnings and errors
|
||||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
# some more ls aliases
|
||||
alias ll='ls -alF'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
|
||||
# Add an "alert" alias for long running commands. Use like so:
|
||||
# sleep 10; alert
|
||||
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
||||
|
||||
# Alias definitions.
|
||||
# You may want to put all your additions into a separate file like
|
||||
# ~/.bash_aliases, instead of adding them here directly.
|
||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
|
||||
# set EDITOR just in case
|
||||
export EDITOR=vim
|
||||
export BROWSER=/usr/bin/lynx
|
||||
|
||||
export GEM_HOME="$HOME/gems"
|
||||
export GEM_PATH="$HOME/gems:"
|
||||
|
||||
export PATH="$PATH:$GEM_HOME/bin/:"
|
||||
|
|
@ -0,0 +1,256 @@
|
|||
set showcmd
|
||||
set encoding=utf8
|
||||
set expandtab
|
||||
set textwidth=0
|
||||
set tabstop=4
|
||||
set softtabstop=4
|
||||
set shiftwidth=4
|
||||
set autoindent
|
||||
set backspace=indent,eol,start
|
||||
set incsearch
|
||||
set nohlsearch
|
||||
set ignorecase
|
||||
set smartcase
|
||||
set ruler
|
||||
set wildmenu
|
||||
set commentstring=\ #\ %s
|
||||
set shiftround
|
||||
set number
|
||||
set relativenumber
|
||||
set scrolloff=1
|
||||
set matchpairs+=<:>
|
||||
set cmdheight=2
|
||||
set lazyredraw
|
||||
set undofile
|
||||
syntax enable
|
||||
filetype plugin on
|
||||
set background=dark
|
||||
" set foldcolumn=2
|
||||
let mapleader="'"
|
||||
let maplocalleader="["
|
||||
command! Dir :e %:p:h
|
||||
|
||||
" key mappings --------------------- {{{
|
||||
" visual line movement --------------------- {{{
|
||||
" move vertically by visual line unless a count is specified
|
||||
nnoremap <expr> j (v:count == 0 ? 'gj' : 'j')
|
||||
nnoremap <expr> k (v:count == 0 ? 'gk' : 'k')
|
||||
|
||||
" Move to the beginning/end of the line
|
||||
nnoremap B ^
|
||||
nnoremap E $
|
||||
nnoremap ^ <nop>
|
||||
nnoremap $ <nop>
|
||||
|
||||
vnoremap B ^
|
||||
vnoremap E $
|
||||
vnoremap ^ <nop>
|
||||
vnoremap $ <nop>
|
||||
" }}}
|
||||
|
||||
" vimrc shortcuts --------------------- {{{
|
||||
" These two lines are shortcuts for editing
|
||||
" and sourcing my vimrc from any session
|
||||
nnoremap <leader>ev :split $MYVIMRC<cr>
|
||||
nnoremap <leader>sv :source $MYVIMRC<cr>
|
||||
" }}}
|
||||
|
||||
" readline-like bindings -------------------- {{{
|
||||
inoremap <c-d> <esc>ddi
|
||||
inoremap <c-a> <esc>I
|
||||
inoremap <c-e> <esc>A
|
||||
inoremap <c-k> <esc>lDa
|
||||
|
||||
" move the increment keybinding to +
|
||||
nnoremap + <c-a>
|
||||
" move the decrement keybinding to -
|
||||
nnoremap - <c-x>
|
||||
" }}}
|
||||
|
||||
" misc bindings -------------------- {{{
|
||||
" paste the current clipboard onto the cursor's line and keep the clipboard
|
||||
" contents the same
|
||||
nnoremap yp Vpyy
|
||||
" search for the yanked contents in the default (") register
|
||||
nnoremap g/ q/p<Enter>
|
||||
nnoremap gF <C-W>gf
|
||||
nnoremap gw <C-W>
|
||||
" space to run 'q' macro
|
||||
nnoremap <Space> @q
|
||||
" repeat the last macro used
|
||||
nnoremap Q @@
|
||||
" capitalize previously typed word
|
||||
inoremap ;u <esc>bveUea
|
||||
" shortcut to exit insert mode
|
||||
inoremap jk <esc>
|
||||
vnoremap jk <esc>
|
||||
cnoremap jk <esc>
|
||||
|
||||
" Cycle through buffers
|
||||
nnoremap <C-n> :bnext!<CR>:redraw<CR>:ls<CR>
|
||||
nnoremap <C-p> :bprevious!<CR>:redraw<CR>:ls<CR>
|
||||
nnoremap <C-q> :buffers<CR>:bdelete<Space>
|
||||
nnoremap <C-o> :buffers<CR>:buffer<Space>
|
||||
|
||||
" toggle tagbar
|
||||
nnoremap <C-t> :TagbarToggle<CR>
|
||||
" Follow tag
|
||||
nnoremap g] <C-]>
|
||||
" Jump back to previous location after following tag
|
||||
nnoremap g[ :pop<CR>
|
||||
" load previous session
|
||||
nnoremap gS :call LoadSession()<CR>
|
||||
" build
|
||||
nnoremap gm :make
|
||||
" }}}
|
||||
" }}}
|
||||
|
||||
" netrw -------------------- {{{
|
||||
let g:netrw_liststyle=3
|
||||
let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+'
|
||||
let g:netrw_winsize=200
|
||||
let g:netrw_altv = 1
|
||||
" }}}
|
||||
|
||||
" File settings -------------------- {{{
|
||||
" Vimscript file settings -------------------- {{{
|
||||
augroup vim_file
|
||||
autocmd!
|
||||
autocmd FileType vim setlocal foldmethod=marker
|
||||
autocmd FileType vim setlocal foldenable
|
||||
autocmd FileType vim setlocal foldlevelstart=0
|
||||
autocmd FileType vim nnoremap <buffer> <localleader>c I" <esc>^
|
||||
augroup END
|
||||
" }}}
|
||||
|
||||
" Conf file settings -------------------- {{{
|
||||
augroup conf_file
|
||||
autocmd!
|
||||
autocmd FileType conf nnoremap <buffer> <localleader>c I# <esc>^
|
||||
autocmd FileType conf nnoremap <buffer> <localleader>uc B2x <esc>^
|
||||
" autocmd FileType conf nnoremap <buffer> <localleader>b FlipBoolean
|
||||
augroup END
|
||||
" }}}
|
||||
|
||||
" Python file settings -------------------- {{{
|
||||
augroup python_file
|
||||
autocmd!
|
||||
autocmd FileType python nnoremap <buffer> <localleader>c I# <esc>^
|
||||
autocmd FileType python nnoremap <buffer> <localleader>uc ^2x^
|
||||
autocmd FileType python nnoremap <buffer> <localleader>r :call RunScript()<CR>
|
||||
augroup END
|
||||
" }}}
|
||||
|
||||
" Shell script file settings -------------------- {{{
|
||||
augroup shell_file
|
||||
autocmd!
|
||||
autocmd FileType sh nnoremap <buffer> <localleader>c I# <esc>^
|
||||
autocmd FileType sh nnoremap <buffer> <localleader>uc ^2x^
|
||||
augroup END
|
||||
" }}}
|
||||
|
||||
" Make file settings -------------------- {{{
|
||||
augroup make_file
|
||||
autocmd!
|
||||
autocmd FileType make setlocal noexpandtab
|
||||
augroup END
|
||||
" }}}
|
||||
|
||||
" Rust file settings -------------------- {{{
|
||||
augroup rust_file
|
||||
autocmd!
|
||||
autocmd FileType rust nnoremap <buffer> <localleader>c I// <esc>^
|
||||
autocmd FileType rust nnoremap <buffer> <localleader>uc ^3x^
|
||||
autocmd FileType rust nnoremap <buffer> gb :make build<CR>
|
||||
autocmd FileType rust nnoremap <buffer> <localleader>/ :execute "noautocmd vimgrep /" .expand("<cword>") ."/j src/**/*.rs" <Bar> cw<CR>
|
||||
augroup END
|
||||
" }}}
|
||||
|
||||
" Java file settings -------------------- {{{
|
||||
augroup java_file
|
||||
autocmd!
|
||||
autocmd BufNewFile *.java call CreateJavaFile()
|
||||
autocmd FileType java nnoremap <buffer> <localleader>c I// <esc>^
|
||||
autocmd FileType java nnoremap <buffer> <localleader>uc ^3x^
|
||||
augroup END
|
||||
" }}}
|
||||
|
||||
" JSP file settings -------------------- {{{
|
||||
augroup jsp_file
|
||||
autocmd!
|
||||
autocmd FileType jsp nnoremap <buffer> <localleader>c I<%-- <esc>A --%><esc>^
|
||||
autocmd FileType jsp nnoremap <buffer> <localleader>uc ^5x$4hD
|
||||
augroup END
|
||||
" }}}
|
||||
|
||||
" Gradle file settings -------------------- {{{
|
||||
augroup gradle_file
|
||||
autocmd!
|
||||
autocmd BufNewFile,BufRead *.gradle setlocal filetype=groovy
|
||||
augroup END
|
||||
" }}}
|
||||
|
||||
" Perl file settings -------------------- {{{
|
||||
augroup perl_file
|
||||
autocmd!
|
||||
autocmd FileType perl nnoremap <buffer> <localleader>c I# <esc>^
|
||||
autocmd FileType perl nnoremap <buffer> <localleader>uc ^2x^
|
||||
autocmd FileType perl nnoremap <buffer> <localleader>r :call RunScript()<CR>
|
||||
augroup END
|
||||
" }}}
|
||||
|
||||
" Quickfix settings -------------------- {{{
|
||||
augroup quickfix_file
|
||||
autocmd!
|
||||
autocmd FileType qf nnoremap <buffer> <localleader>q :cclose<CR>
|
||||
augroup END
|
||||
" }}}
|
||||
" }}}
|
||||
|
||||
" session management --------------------- {{{
|
||||
function! MakeSession()
|
||||
let b:sessiondir = $HOME . "/.vim/sessions" . getcwd()
|
||||
if (filewritable(b:sessiondir) != 2)
|
||||
exe 'silent !mkdir -p ' b:sessiondir
|
||||
redraw!
|
||||
endif
|
||||
let b:filename = b:sessiondir . '/session.vim'
|
||||
exe "mksession! " . b:filename
|
||||
endfunction
|
||||
|
||||
function! LoadSession()
|
||||
let b:sessiondir = $HOME . "/.vim/sessions" . getcwd()
|
||||
let b:sessionfile = b:sessiondir . "/session.vim"
|
||||
if (filereadable(b:sessionfile))
|
||||
exe 'source ' b:sessionfile
|
||||
else
|
||||
echo "No session loaded."
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Adding automatons for when entering or leaving Vim
|
||||
if(argc() == 0)
|
||||
au VimEnter * nested :call LoadSession()
|
||||
endif
|
||||
|
||||
au VimLeave * :call MakeSession()
|
||||
" }}}
|
||||
|
||||
" LanguageServer
|
||||
set runtimepath+=~/.vim/pack/plugins/start/LanguageClient-neovim
|
||||
set hidden
|
||||
let g:LanguageClient_autoStart = 0
|
||||
let g:LanguageClient_serverCommands = {
|
||||
\ 'rust': ['rustup', 'run', 'nightly', 'rls'],
|
||||
\ 'elixir': ['/home/dev/language-servers/elixir-ls/rel']
|
||||
\ }
|
||||
|
||||
nnoremap <leader>lcs :LanguageClientStart<CR>
|
||||
nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
|
||||
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
|
||||
nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
|
||||
|
||||
" completion
|
||||
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
||||
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
||||
inoremap <expr> <cr> pumvisible() ? "\<C-y>\<cr>" : "\<cr>"
|
Loading…
Reference in New Issue