updates incl bigass refresh of vim init

This commit is contained in:
Henrik Bakken
2020-10-08 20:25:41 +02:00
parent df57e62c5f
commit fc8392a528
8 changed files with 492 additions and 467 deletions
+8
View File
@@ -0,0 +1,8 @@
function fish_user_key_bindings
bind --preset _ beginning-of-line
bind \eh __fzf_reverse_isearch
bind \eF __fzf_open
bind -M insert \ec '__fzf_cd --hidden'
bind -M insert \ep __fzf_find_file
bind -M insert \ef '__fzf_open --editor'
end
+1 -3
View File
@@ -306,9 +306,7 @@ exec_always --no-startup-id fix_xcursor
exec --no-startup-id xrandr --output $display2 --primary --output $display3 --auto --rotate left --right-of $display2 --output $display1 --auto --rotate left --left-of $display2 exec --no-startup-id xrandr --output $display2 --primary --output $display3 --auto --rotate left --right-of $display2 --output $display1 --auto --rotate left --left-of $display2
# HB STARTUP ADDITIONS # HB STARTUP ADDITIONS
bindsym Shift+Pause exec --no-startup-id setxkbmap -option "caps:escape" exec --no-startup-id setxkbmap -layout no -variant nodeadkeys -option "caps:escape"
bindsym Shift+Scroll_Lock exec --no-startup-id setxkbmap -option
exec --no-startup-id setxkbmap -option "caps:escape"
exec --no-startup-id redshift-gtk exec --no-startup-id redshift-gtk
exec --no-startup-id dropbox start & exec --no-startup-id dropbox start &
exec --no-startup-id nvidia-settings -a GPUFanControlState=1 -a GPUTargetFanSpeed=60 exec --no-startup-id nvidia-settings -a GPUFanControlState=1 -a GPUTargetFanSpeed=60
+250 -443
View File
@@ -1,6 +1,6 @@
set shell=bash set shell=bash
" ----------------------------------------------------------------------------- " -----------------------------------------------------------------------------
" plugins " PLUGINS
" ----------------------------------------------------------------------------- " -----------------------------------------------------------------------------
if ! filereadable(expand('~/.config/nvim/autoload/plug.vim')) if ! filereadable(expand('~/.config/nvim/autoload/plug.vim'))
echo "Downloading junegunn/vim-plug to manage plugins..." echo "Downloading junegunn/vim-plug to manage plugins..."
@@ -20,39 +20,28 @@ call plug#begin('~/.config/nvim/plugged')
" tools " tools
Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'junegunn/fzf', {'dir': '~/.fzf', 'do': './install --all'} Plug 'junegunn/fzf', {'dir': '~/.fzf', 'do': './install --all'}
"Plug 'junegunn/fzf.vim'
Plug 'sheerun/vim-polyglot' " language syntax Plug 'sheerun/vim-polyglot' " language syntax
Plug 'godlygeek/tabular' " help aligning text on tabs
Plug 'tpope/vim-fugitive' Plug 'tpope/vim-fugitive'
Plug 'junegunn/gv.vim'
" markdown " markdown
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() } } Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() } }
Plug 'plasticboy/vim-markdown' " markdown helper. Plug 'plasticboy/vim-markdown' " markdown helper.
Plug 'ferrine/md-img-paste.vim'
" helpers " helpers
Plug 'scrooloose/nerdcommenter' " commenting tool Plug 'scrooloose/nerdcommenter' " commenting tool
Plug 'tpope/vim-surround' " parentheses helper Plug 'tpope/vim-surround' " parentheses helper
Plug 'mbbill/undotree' " Persistent undo Plug 'mbbill/undotree' " Persistent undo
Plug 'junegunn/vim-peekaboo' " show paste buffers
Plug 'farmergreg/vim-lastplace' " When reopen a buffer, puts the cursor where it was last time Plug 'farmergreg/vim-lastplace' " When reopen a buffer, puts the cursor where it was last time
Plug 'christoomey/vim-tmux-navigator' " integrate movement in tmux and vim Plug 'christoomey/vim-tmux-navigator' " integrate movement in tmux and vim
Plug 'haya14busa/vim-asterisk' " better asterisk motions Plug 'haya14busa/vim-asterisk' " better asterisk motions
Plug 'bfredl/nvim-miniyank' " nvim bugfix block copy Plug 'bfredl/nvim-miniyank' " nvim bugfix block copy
"Plug 'terryma/vim-multiple-cursors' " multiple cursors via 'C-n' Plug 'qpkorr/vim-bufkill' " delete buffer without closing window
"Plug 'michaeljsmith/vim-indent-object' " define indent as a group to operate on
"Plug 'liuchengxu/vim-which-key' " popuup for shortcuts like emacs
" aesthetics " aesthetics
Plug 'chriskempson/base16-vim' " base16 themes Plug 'chriskempson/base16-vim' " base16 themes
Plug 'junegunn/goyo.vim' " zen mode
Plug 'junegunn/limelight.vim' " highlight current paragraph
Plug 'PotatoesMaster/i3-vim-syntax' " syntax highlighting for i3 file
Plug 'chrisbra/Colorizer' " show color codes Plug 'chrisbra/Colorizer' " show color codes
Plug 'junegunn/rainbow_parentheses.vim' " colorize parentheses Plug 'junegunn/rainbow_parentheses.vim' " colorize parentheses
" file mgmt " file mgmt
Plug 'jeetsukumaran/vim-buffergator' Plug 'jeetsukumaran/vim-buffergator'
Plug 'scrooloose/nerdtree' Plug 'scrooloose/nerdtree'
"Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
"Plug 'vifm/vifm.vim'
"Plug 'rafaqz/ranger.vim'
" themes " themes
Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes' Plug 'vim-airline/vim-airline-themes'
@@ -60,45 +49,79 @@ Plug 'junegunn/seoul256.vim'
call plug#end() call plug#end()
" ----------------------------------------------------------------------------- " -----------------------------------------------------------------------------
" format " SETTINGS
" ----------------------------------------------------------------------------- " -----------------------------------------------------------------------------
set t_Co=256 " Use 256 colors " colors
if filereadable(expand("~/.vimrc_background")) if filereadable(expand("~/.vimrc_background"))
let base16colorspace=256 let base16colorspace=256
source ~/.vimrc_background source ~/.vimrc_background
endif endif
if has("nvim")
if $TERM =~ '^\(rxvt\)\(-.*\)\?$' if $TERM =~ '^\(rxvt\)\(-.*\)\?$'
set notermguicolors set notermguicolors
else else
set termguicolors set termguicolors
endif endif
endif
"let g:airline_theme='molokai'
let g:airline_theme='qwq'
"let g:airline_theme='badwolf'
"let g:airline_theme='silver'
"let g:airline_theme='raven'
" Transparent Background (For i3 and compton) " Transparent Background (For i3 and compton)
highlight Normal guibg=NONE ctermbg=NONE "highlight Normal guibg=NONE ctermbg=NONE
highlight LineNr guibg=NONE ctermbg=NONE "highlight LineNr guibg=NONE ctermbg=NONE
" ----------------------------------------------------------------------------- " seoul256 theme config (dark 233-239, light 252-256)
" settings let g:seoul256_background=233
" ----------------------------------------------------------------------------- colo seoul256
" general
set cmdheight=2 " height of command bar at the bottom. 1 is default
let g:BASH_Ctrl_j='off' " avoid 'C-j' being overridden to newline
let g:BASH_Ctrl_l='off' " avoid 'C-l' being overridden to newline
set updatetime=300
set timeoutlen=500
set lazyredraw
set shell=/usr/bin/bash
let $SHELL = "/usr/bin/bash"
set conceallevel=2
" fold config " statusline
set cmdheight=1
let g:airline_powerline_fonts=1
"let g:airline_theme='molokai'
"let g:airline_theme='qwq'
"let g:airline_theme='badwolf'
"let g:airline_theme='silver'
let g:airline_theme='raven'
let g:airline#extensions#tabline#enabled=1
let g:airline#extensions#tabline#show_splits=0
let g:airline#extensions#tabline#show_tabs=0
let g:airline#extensions#tabline#show_buffers=1
let g:airline#extensions#tabline#switch_buffers_and_tabs=0
" temporary files and undo
set directory=/tmp//,.
set backupdir=/tmp//,.
set undodir=~/.vim/undo/
set noswapfile
set nowritebackup
set undofile " Persistent undo
set undolevels=500 " Maximum number of changes that can be undone
set undoreload=5000 " Maximum number lines to save for undo on a buffer reload
" search
set ignorecase " Case insensitive search
set smartcase " ... but case sensitive when uc present
" cursor
set scrolljump=5 " Line to scroll when cursor leaves screen
set scrolloff=3 " Minumum lines to keep above and below cursor
" buffers
set splitright " Puts new vsplit windows to the right of the current
set splitbelow " Puts new split windows to the bottom of the current
set hidden " Allow buffer switching without saving
" buffer
set nowrap " Do not wrap long lines
set cursorline " Highlight current line
set number " Line numbers on
" parentheses
set showmatch " Show matching brackets/parentthesis
set matchtime=5 " Show matching time
" files and encodings
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set fileformats=unix,dos,mac
" indentation and folds
set smartindent
set foldmethod=indent set foldmethod=indent
set foldlevelstart=20 set foldlevelstart=20
" zm/M zr/R increase/increase foldlevel (max) " zm/M zr/R increase/increase foldlevel (max)
@@ -107,86 +130,145 @@ set foldlevelstart=20
" zi toggle folds " zi toggle folds
" zi zj move to next / prev fold " zi zj move to next / prev fold
" indentation " tabs
set ai " auto indent
set si " smart indent
" Automatically deletes all trailing whitespace on save.
autocmd BufWritePre * %s/\s\+$//e
" default new file is markdown
autocmd BufEnter * if &filetype == "" | setlocal ft=markdown | endif
set tabstop=4 set tabstop=4
set softtabstop=4 set softtabstop=4
set shiftwidth=4 set shiftwidth=4
set fileformat=unix
au Filetype python set
\ tabstop=4
\ softtabstop=4
\ shiftwidth=4
au Filetype markdown,yaml set
\ tabstop=2
\ softtabstop=2
\ shiftwidth=2
set expandtab set expandtab
"
" Disables automatic commenting on newline: " other
"autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o set lazyredraw
set updatetime=300
set timeoutlen=500
set conceallevel=2
set shell=/usr/bin/bash
let $SHELL="/usr/bin/bash"
let g:BASH_Ctrl_j='off' " avoid 'C-j' being overridden to newline
let g:BASH_Ctrl_l='off' " avoid 'C-l' being overridden to newline
highlight clear SignColumn " SignColumn should match background
set shortmess=atOI " No help Uganda information, and overwrite read messages to avoid PRESS ENTER prompts
set listchars=tab:→\ ,eol:↵,trail,extends:↷,precedes:↶
set fillchars=vert:│,stl:\ ,stlnc:\
" ----------------------------------------------------------------------------- " -----------------------------------------------------------------------------
" keybinds " KEYBINDS
" ----------------------------------------------------------------------------- " -----------------------------------------------------------------------------
" general
let mapleader="\<SPACE>" let mapleader="\<SPACE>"
let maplocalleader="," let maplocalleader=","
"nmap <silent> <leader> :WhichKey '<SPACE>'<cr> nnoremap q: <nop>
tmap <C-x> <C-\><C-n> nnoremap Q <nop>
vnoremap v <Esc>
nnoremap . :
nnoremap , .
nmap <esc><esc> :noh<cr> nmap <esc><esc> :noh<cr>
if has('nvim') nmap <M-d> :BD<cr>
nmap <leader>R :so ~/.config/nvim/init.vim<cr> nnoremap <leader>R :so ~/.config/nvim/init.vim<cr>
nmap <leader>E :tabe ~/.config/nvim/init.vim<cr> nnoremap <leader>E :tabe ~/.config/nvim/init.vim<cr>
else " nerdcommenter: '<leader>c ', '<leader>cl' aligned and '<leader>cu>' remove
nmap <leader>R :so ~/.vimrc<cr> " vim-surround: visual 'SA' to wrap in A. Surround 'csAB' to change from A to B, 'dsA' to remove A. Word 'ysiwA' to wrap with A
nmap <leader>E :tabe ~/.vimrc<cr>
endif
map q: <nop>
nmap Q <nop>
map p <Plug>(miniyank-autoput)
map P <Plug>(miniyank-autoPut)
" search for selected text in visual mode " *****************************
vnoremap // y/<C-R>"<CR> " CLIPBOARD (incl bugfix paste unnamedplus)
set clipboard+=unnamedplus
nmap p <Plug>(miniyank-autoput)
nmap P <Plug>(miniyank-autoPut)
" exit terminal " *****************************
:tnoremap <F2> <C-\><C-n> " TERMINAL
nmap <Leader>T :terminal<cr>
tmap <C-x> <C-\><C-n>
tmap <F2> <C-\><C-n>
" keep selection after indenting " *****************************
nmap <Tab> >>_ " SEARCH
nmap <S-Tab> <<_ set wildignorecase
vmap <Tab> >gv set wildignore+=*swp,*.class,*.pyc,*.png,*.jpg,*.gif,*.zip
vmap <S-Tab> <gv set wildignore+=*/tmp/*,*.o,*.obj,*.so " Unix
set wildignore+=*\\tmp\\*,*.exe " Windows
function! EnterSubdir()
call feedkeys("\<Down>", 't')
return ''
endfunction
cnoremap <C-h> <up>
cnoremap <C-j> <right>
cnoremap <C-k> <left>
cnoremap <expr> <C-l> EnterSubdir()
map * <Plug>(asterisk-z*)
map g* <Plug>(asterisk-gz*)
map g# <Plug>(asterisk-z#)
map gz# <Plug>(asterisk-gz#)
let g:asterisk#keeppos=1
" move between windows by hjkl " *****************************
" CURSOR
" vertical movement remapping ala US
map å (
map ¨ )
map Å {
map ^ }
map + [
map \ ]
" Treat long lines as break lines (useful when moving around in them)
nmap j gj
nmap k gk
vmap j gj
vmap k gk
" indenting
nnoremap <Tab> >>_
nnoremap <S-Tab> <<_
vnoremap <Tab> >gv
vnoremap <S-Tab> <gv
" Move start and end of line
noremap H _
noremap L $
" insert mode movement
inoremap <C-h> <Left>
inoremap <C-j> <Down>
inoremap <C-k> <Up>
inoremap <C-l> <Right>
inoremap <C-b> <BS>
inoremap <C-a> <Home>
inoremap <C-e> <End>
inoremap <C-d> <Delete>
" *****************************
" WINDOWS / BUFFERS
let g:tmux_navigator_no_mappings=1
nmap <silent> <M-h> :TmuxNavigateLeft<cr> nmap <silent> <M-h> :TmuxNavigateLeft<cr>
nmap <silent> <M-j> :TmuxNavigateDown<cr> nmap <silent> <M-j> :TmuxNavigateDown<cr>
nmap <silent> <M-k> :TmuxNavigateUp<cr> nmap <silent> <M-k> :TmuxNavigateUp<cr>
nmap <silent> <M-l> :TmuxNavigateRight<cr> nmap <silent> <M-l> :TmuxNavigateRight<cr>
" make splits and tabs " make splits and tabs
nmap <leader><BAR> :vsplit<cr> nnoremap <M-BAR> :vsplit<cr>
nmap <leader>- :split<cr> nnoremap <M-§> :vnew<cr>
nmap <leader>o :tabnew %<cr> nnoremap <M--> :split<cr>
nnoremap <M-_> :new<cr>
nnoremap <M-p> <C-w>T
nnoremap <M-P> :tabnew<cr>
" buffergator & nerdtree
nmap <M-N> :bprev<cr>
nmap <M-n> :bnext<cr>
nmap <M-T> :tabprev<cr>
nmap <M-t> :tabnext<cr>
" resize windows with hjkl " resize windows with hjkl
nmap <C-h> <C-w>< nnoremap <C-h> <C-w><
nmap <C-j> <C-w>- nnoremap <C-j> <C-w>-
nmap <C-k> <C-w>+ nnoremap <C-k> <C-w>+
nmap <C-l> <C-w>> nnoremap <C-l> <C-w>>
" buffergator & nerdtree
map <C-f> :NERDTreeToggle<cr>
map <C-b> :BuffergatorToggle<cr>
map <C-t> :BuffergatorTabsToggle<cr>
let g:buffergator_mru_cycle_loop=0
let g:buffergator_suppress_keymaps=1
let g:buffergator_autoupdate=1
let g:buffergator_sort_regime='bufnum'
let g:buffergator_display_regime='basename'
let g:buffergator_autodismiss_on_select=0
let g:buffergator_show_full_directory_path=0
let g:buffergator_tab_statusline=0
let g:buffergator_window_statusline=0
" other C-w commands to remember " other C-w commands to remember
" <C-w>BAR maximise
" <C-w>= equalize sizes " <C-w>= equalize sizes
" <C-w>T move buffer to new tab " <C-w>T move buffer to new tab
" move windows with <leader>+HJKL " move windows with <leader>+HJKL
@@ -195,164 +277,8 @@ nmap <C-l> <C-w>>
" <C-w>K " <C-w>K
" <C-w>L " <C-w>L
" remove buffer " *****************************
nmap <leader>d :bp<bar>sp<bar>bn<bar>bd<cr> " MARKDOWN
" nmap <leader>q :bd<cr>
" fullscreen mode and reset
map <M-g> :Goyo<cr>
map <M-w> <C-w>=
map <M-BAR> <C-w><BAR>
map <M--> <C-w>_
" tab management
nmap <leader>h :tabprevious<cr>
nmap <leader>l :tabnext<cr>
nmap <M-Left> :call MoveToNextTab()<cr>
nmap <M-Right> :call MoveToPrevTab()<cr>
nmap <silent> <C-Left> :execute 'silent! tabmove ' . (tabpagenr()-2)<cr>
nmap <silent> <C-Right> :execute 'silent! tabmove ' . (tabpagenr()+1)<cr>
" fzf
"nmap <C-p>g :GitFiles<ENTER>
"nmap <C-p>f :Files<ENTER>
"nmap <C-p>l :Ag<ENTER>
"nmap <C-p>L :Lines<ENTER>
"nmap <C-p>r :Rg<ENTER>
"nmap <C-p>b :Buffers<ENTER>
"nmap <C-p>c :Commands<ENTER>
"nmap <C-p>t :Colors<ENTER>
"nmap <C-p>m :Marks<ENTER>
"nmap <C-p>w :Windows<ENTER>
"nmap <F2> :Maps<ENTER>
nmap <M-w> :<C-u>CocCommand fzf-preview.ProjectGrep<Space>
xmap <M-w> "sy:CocCommand fzf-preview.ProjectGrep<Space>-F<Space>"<C-r>=substitute(substitute(@s, '\n', '', 'g'), '/', '\\/', 'g')<CR>"
nmap <M-W> :<C-u>CocCommand fzf-preview.ProjectGrep<Space>
nmap <silent> <M-e> :<C-u>CocCommand fzf-preview.Lines --add-fzf-arg=--no-sort --add-fzf-arg=--query="'"<CR>
nmap <silent> <M-E> :<C-u>CocCommand fzf-preview.Lines --add-fzf-arg=--no-sort --add-fzf-arg=--query="'<C-r>=expand('<cword>')<CR>"<CR>
nmap <silent> <M-r> :<C-u>CocCommand fzf-preview.MruFiles<CR>
nmap <silent> <M-R> :<C-u>CocCommand fzf-preview.ProjectMruFiles<CR>
nmap <silent> <M-f> :<C-u>CocCommand fzf-preview.DirectoryFiles<CR>
nmap <silent> <M-F> :<C-u>CocCommand fzf-preview.ProjectFiles<CR>
nmap <silent> <M-g> :<C-u>CocCommand fzf-preview.GitStatus<CR>
nmap <silent> <M-G> :<C-u>CocCommand fzf-preview.GitActions<CR>
nmap <silent> <M-b> :<C-u>CocCommand fzf-preview.Buffers<CR>
nmap <silent> <M-B> :<C-u>CocCommand fzf-preview.AllBuffers<CR>
" Close preview window when completion is done
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
" coc menus
imap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
imap <expr><S-Tab> pumvisible() ? "\<C-p>" : "\<C-h>"
imap <silent><expr> <C-space> coc#refresh()
" coc helpers
nmap gP <Plug>(coc-diagnostic-prev)
nmap gp <Plug>(coc-diagnostic-next)
nmap gd <Plug>(coc-definition)
nmap gy <Plug>(coc-type-definition)
nmap gi <Plug>(coc-implementation)
nmap gr <Plug>(coc-references)
nmap gR <Plug>(coc-refactor)
" coc git
nmap <leader>gn <Plug>(coc-git-nextchunk)
nmap <leader>gp <Plug>(coc-git-prevchunk)
nmap <leader>g<cr> <Plug>(coc-git-chunkinfo)
nmap <leader>gs :CocCommand git.chunkStage<CR>
vmap <leader>gs :CocCommand git.chunkStage<CR>
nmap <leader>gX :CocCommand git.chunkUndo<CR>
vmap <leader>gX :CocCommand git.chunkUndo<CR>
" vim-fugitive
" g? for fugitive help. :Gdiff, :Gblame, :Gstats '=' expand, '-' add/reset changes, :Gcommit % to commit current file with messag
nmap <leader>gg :vertical Gstatus<cr>:vertical resize 60<cr>
" nerdtree
map <C-f> :NERDTreeToggle<cr>
" nerdcommenter
" '<leader>c ', '<leader>cl' aligned and '<leader>cu>' remove
" vim-surround
" Visual: 'SA' to wrap in A. Surround: 'csAB' to change from A to B, 'dsA' to remove A. Word: 'ysiwA' to wrap with A
" tabular
" line up selected text by :Tabularize /[identifier]
" vim markdown
" vim asterisk
map * <Plug>(asterisk-*)
map # <Plug>(asterisk-#)
map g* <Plug>(asterisk-g*)
map g# <Plug>(asterisk-g#)
map z* <Plug>(asterisk-z*)
map gz* <Plug>(asterisk-gz*)
map z# <Plug>(asterisk-z#)
map gz# <Plug>(asterisk-gz#)
" buffergator
map <C-b> :BuffergatorToggle<cr>
map <C-t> :BuffergatorTabsToggle<cr>
nmap <leader>j :BuffergatorMruCyclePrev<cr>
nmap <leader>k :BuffergatorMruCycleNext<cr>
" -----------------------------------------------------------------------------
" plugin config
" -----------------------------------------------------------------------------
" tmux navigator
let g:tmux_navigator_no_mappings=1
" undotree defaults
set undodir=~/.vim/undo/
" Goyo plugin makes text more readable when writing prose:
let g:goyo_width=120
let g:goyo_height=85
let g:goyo_linenr=1
function! s:goyo_enter()
Limelight
endfunction
function! s:goyo_leave()
highlight Normal guibg=NONE ctermbg=NONE
highlight LineNr guibg=NONE ctermbg=NONE
Limelight!
endfunction
autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()
" Limelight
let g:limelight_conceal_ctermfg='gray' " Color name (:help cterm-colors) or ANSI code
let g:limelight_conceal_guifg='DarkGray' " Color name (:help gui-colors) or RGB color
let g:limelight_default_coefficient=0.7
let g:limelight_paragraph_span=0 " Number of preceding/following paragraphs to include (default: 0)
let g:limelight_priority=-1 " Highlighting priority (default: 10). Set it to -1 not to overrule hlsearch
let g:limelight_bop='^\n^'
let g:limelight_eop='\ze\n\n'
" NerdTree
" Nerd tree autostart if empty
" autocmd vimenter * NERDTree
"autocmd StdinReadPre * let s:std_in=1
"autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif
"autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Nerd tree binding
"autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Airline
let g:airline#extensions#tabline#enabled=1
let g:airline#extensions#tabline#show_splits=0
"let g:airline#extensions#tabline#show_tabs=0
let g:airline#extensions#tabline#show_buffers = 0
let g:airline#extensions#tabline#switch_buffers_and_tabs=0
let g:airline_powerline_fonts=1
" vim-markdown " vim-markdown
let g:vim_markdown_new_list_item_indent=0 let g:vim_markdown_new_list_item_indent=0
let g:vim_markdown_conceal=0 let g:vim_markdown_conceal=0
@@ -360,7 +286,6 @@ let g:vim_markdown_conceal_code_blocks=0
let g:vim_markdown_math=1 let g:vim_markdown_math=1
let g:vim_markdown_folding_disabled=0 let g:vim_markdown_folding_disabled=0
let g:vim_markdown_math=0 let g:vim_markdown_math=0
" markdown preview " markdown preview
let g:mkdp_auto_start=0 " auto start on moving into let g:mkdp_auto_start=0 " auto start on moving into
let g:mkdp_auto_close=0 " auto close on moving away let g:mkdp_auto_close=0 " auto close on moving away
@@ -375,40 +300,66 @@ let g:mkdp_preview_options={
" sync_scroll_type: 'middle', 'top' or 'relative' " sync_scroll_type: 'middle', 'top' or 'relative'
" hide_yaml_meta: if hide yaml metadata, default is 1 " hide_yaml_meta: if hide yaml metadata, default is 1
" md-img-paste " *****************************
autocmd FileType markdown nmap <buffer><silent> <leader>p :call mdip#MarkdownClipboardImage()<CR> " GIT
" vim-fugitive
" g? for fugitive help. :Gdiff, :Gblame, :Gstats '=' expand, '-' add/reset changes, :Gcommit % to commit current file with messag
nmap <leader>gg :vertical Gstatus<cr>:vertical resize 60<cr>
" gv.vim
map <leader>gv :GV<cr>
map <leader>gf :GV!<cr>
map <leader>gl :GV?<cr>
" coc git
nmap <leader>gn <Plug>(coc-git-nextchunk)
nmap <leader>gp <Plug>(coc-git-prevchunk)
nmap <leader>g<cr> <Plug>(coc-git-chunkinfo)
nmap <leader>gs :CocCommand git.chunkStage<cr>
vmap <leader>gs :CocCommand git.chunkStage<cr>
nmap <leader>gX :CocCommand git.chunkUndo<cr>
vmap <leader>gX :CocCommand git.chunkUndo<cr>
" coc fzf
nmap <silent> <M-g> :<C-u>CocCommand fzf-preview.GitStatus<cr>
nmap <silent> <M-G> :<C-u>CocCommand fzf-preview.GitActions<cr>
" peekaboo " *****************************
let g:peekaboo_window='vert bo 80new' " COC FZF
let g:peekaboo_delay=1000 nmap <M-w> :<C-u>CocCommand fzf-preview.ProjectGrep<Space>
let g:peekaboo_compact=0 xmap <M-w> "sy:CocCommand fzf-preview.ProjectGrep<Space>-F<Space>"<C-r>=substitute(substitute(@s, '\n', '', 'g'), '/', '\\/', 'g')<cr>"
nmap <M-W> :<C-u>CocCommand fzf-preview.ProjectGrep<Space>
nmap <silent> <M-e> :<C-u>CocCommand fzf-preview.Lines --add-fzf-arg=--no-sort --add-fzf-arg=--query="'"<cr>
nmap <silent> <M-E> :<C-u>CocCommand fzf-preview.Lines --add-fzf-arg=--no-sort --add-fzf-arg=--query="'<C-r>=expand('<cword>')<cr>"<cr>
nmap <silent> <M-r> :<C-u>CocCommand fzf-preview.MruFiles<cr>
nmap <silent> <M-R> :<C-u>CocCommand fzf-preview.ProjectMruFiles<cr>
nmap <silent> <M-f> :<C-u>CocCommand fzf-preview.DirectoryFiles<cr>
nmap <silent> <M-F> :<C-u>CocCommand fzf-preview.ProjectFiles<cr>
nmap <silent> <M-b> :<C-u>CocCommand fzf-preview.Buffers<cr>
nmap <silent> <M-B> :<C-u>CocCommand fzf-preview.AllBuffers<cr>
let g:fzf_preview_command='bat --color=always --plain {-1}' " Installed bat
let g:fzf_preview_grep_cmd='rg --smart-case --line-number --no-heading --color=never'
" coc " *****************************
" COC OTHER
" coc menus
let g:coc_node_path='/usr/bin/node'
function! s:check_back_space() abort function! s:check_back_space() abort
let col=col('.') - 1 let col=col('.') - 1
return !col || getline('.')[col - 1] =~# '\s' return !col || getline('.')[col - 1] =~# '\s'
endfunction endfunction
nmap <silent> K :call <SID>show_documentation()<CR> imap <silent><expr> <TAB>
let g:coc_node_path = '/usr/bin/node' \ pumvisible() ? "\<C-n>" :
let g:fzf_preview_command = 'bat --color=always --plain {-1}' " Installed bat \ <SID>check_back_space() ? "\<TAB>" :
let g:fzf_preview_grep_cmd = 'rg --smart-case --line-number --no-heading --color=never' \ coc#refresh()
imap <expr><S-Tab> pumvisible() ? "\<C-p>" : "\<C-h>"
" vim asterisk imap <silent><expr> <C-space> coc#refresh()
let g:asterisk#keeppos = 1 " coc helpers
nmap gP <Plug>(coc-diagnostic-prev)
" buffgator nmap gp <Plug>(coc-diagnostic-next)
let g:buffergator_mru_cycle_loop = 0 nmap gd <Plug>(coc-definition)
let g:buffergator_suppress_keymaps = 1 nmap gy <Plug>(coc-type-definition)
let g:buffergator_autoupdate = 1 nmap gi <Plug>(coc-implementation)
let g:buffergator_sort_regime = 'mru' nmap gr <Plug>(coc-references)
let g:buffergator_display_regime = 'basename' nmap gR <Plug>(coc-refactor)
let g:buffergator_autodismiss_on_select = 0 " show coc documentation in preview window
" -----------------------------------------------------------------------------
" functions
" -----------------------------------------------------------------------------
" coc
" show documentation in preview window
function! s:show_documentation() function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0) if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>') execute 'h '.expand('<cword>')
@@ -416,162 +367,18 @@ function! s:show_documentation()
call CocAction('doHover') call CocAction('doHover')
endif endif
endfunction endfunction
nmap <silent> K :call <SID>show_documentation()<cr>
" for moving of tabs " *****************************
if !exists("*MoveToPrevTab") " autocmd
function MoveToPrevTab() augroup myAu " A unique name for the group. DO NOT use the same name twice!
"there is only one window autocmd!
if tabpagenr('$') == 1 && winnr('$') == 1 autocmd FileType python set tabstop=4 softtabstop=4 shiftwidth=4
return autocmd FileType markdown,yaml set tabstop=2 softtabstop=2 shiftwidth=2
endif autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o " Disables automatic commenting on newline
"preparing new window autocmd FileType * RainbowParentheses()
let l:tab_nr=tabpagenr('$') autocmd BufEnter * if &filetype == "" | setlocal ft=markdown | endif " default new file is markdown
let l:cur_buf=bufnr('%') autocmd BufWritePre * %s/\s\+$//e " Automatically deletes all trailing whitespace on save.
if tabpagenr() != 1 autocmd BufReadPost quickfix nmap <buffer> <cr> <cr> " quickfix <cr>
close! autocmd CompleteDone * if pumvisible() == 0 | pclose | endif " bugfix
if l:tab_nr == tabpagenr('$') augroup end
tabprev
endif
sp
else
close!
exe "0tabnew"
endif
"opening current buffer in new window
exe "b".l:cur_buf
endfunc
endif
if !exists("*MoveToNextTab()")
function MoveToNextTab()
"there is only one window
if tabpagenr('$') == 1 && winnr('$') == 1
return
endif
"preparing new window
let l:tab_nr=tabpagenr('$')
let l:cur_buf=bufnr('%')
if tabpagenr() < tab_nr
close!
if l:tab_nr == tabpagenr('$')
tabnext
endif
sp
else
close!
tabnew
endif
"opening current buffer in new window
exe "b".l:cur_buf
endfunc
endif
" -----------------------------------------------------------------------------
" default settings config
" -----------------------------------------------------------------------------
" default.vim - Better vim than the default
" Maintainer: Liu-Cheng Xu <https://github.com/liuchengxu>
" Version: 1.0
" vim: et ts=2 sts=2 sw=2
set shortmess=atOI " No help Uganda information, and overwrite read messages to avoid PRESS ENTER prompts
set ignorecase " Case insensitive search
set wildignorecase
set smartcase " ... but case sensitive when uc present
set scrolljump=5 " Line to scroll when cursor leaves screen
set scrolloff=3 " Minumum lines to keep above and below cursor
set nowrap " Do not wrap long lines
set splitright " Puts new vsplit windows to the right of the current
set splitbelow " Puts new split windows to the bottom of the current
set mousehide " Hide the mouse cursor while typing
set hidden " Allow buffer switching without saving
set ruler " Show the ruler
set showcmd " Show partial commands in status line and Selected characters/lines in visual mode
set showmode " Show current mode in command-line
set showmatch " Show matching brackets/parentthesis
set matchtime=5 " Show matching time
set report=0 " Always report changed lines
set linespace=0 " No extra spaces between rows
set winminheight=0
set listchars=tab:→\ ,eol:↵,trail,extends:↷,precedes:↶
set whichwrap+=<,>,h,l " Allow backspace and cursor keys to cross line boundaries
set termencoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set wildignore+=*swp,*.class,*.pyc,*.png,*.jpg,*.gif,*.zip
set wildignore+=*/tmp/*,*.o,*.obj,*.so " Unix
set wildignore+=*\\tmp\\*,*.exe " Windows
" Visual shifting (does not exit Visual mode)
vnoremap < <gv
vnoremap > >gv
" Treat long lines as break lines (useful when moving around in them)
nmap j gj
nmap k gk
vmap j gj
vmap k gk
set nobackup
set noswapfile
set nowritebackup
set cursorline " Highlight current line
set fileformats=unix,dos,mac " Use Unix as the standard file type
set number " Line numbers on
set fillchars=vert:│,stl:\ ,stlnc:\
" Annoying temporary files
set directory=/tmp//,.
set backupdir=/tmp//,.
highlight clear SignColumn " SignColumn should match background
if has('unnamedplus')
set clipboard+=unnamedplus
else
set clipboard+=unnamed
endif
set undofile " Persistent undo
set undolevels=500 " Maximum number of changes that can be undone
set undoreload=5000 " Maximum number lines to save for undo on a buffer reload
" Insert mode shortcut
inoremap <C-h> <Left>
inoremap <C-j> <Down>
inoremap <C-k> <Up>
inoremap <C-l> <Right>
inoremap <C-b> <BS>
" Bash like
inoremap <C-a> <Home>
inoremap <C-e> <End>
inoremap <C-d> <Delete>
" Command mode shortcut
cnoremap <C-h> <BS>
cnoremap <C-j> <Down>
cnoremap <C-k> <Up>
cnoremap <C-b> <Left>
cnoremap <C-f> <Right>
cnoremap <C-a> <Home>
cnoremap <C-e> <End>
cnoremap <C-d> <Delete>
" Quit visual mode
vnoremap v <Esc>
" Move to the start of line
nmap H ^
" Move to the end of line
nmap L $
" Quick command mode
nmap <CR> :
" In the quickfix window, <CR> is used to jump to the error under the
" cursor, so undefine the mapping there.
autocmd BufReadPost quickfix nmap <buffer> <CR> <CR>
" Open shell in vim
map <Leader>' :terminal<CR>
+149
View File
@@ -0,0 +1,149 @@
#
# ~/.bashrc
#
[[ $- != *i* ]] && return
colors() {
local fgc bgc vals seq0
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
printf "Values 30..37 are \e[33mforeground colors\e[m\n"
printf "Values 40..47 are \e[43mbackground colors\e[m\n"
printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n"
# foreground colors
for fgc in {30..37}; do
# background colors
for bgc in {40..47}; do
fgc=${fgc#37} # white
bgc=${bgc#40} # black
vals="${fgc:+$fgc;}${bgc}"
vals=${vals%%;}
seq0="${vals:+\e[${vals}m}"
printf " %-9s" "${seq0:-(default)}"
printf " ${seq0}TEXT\e[m"
printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
done
echo; echo
done
}
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
# Change the window title of X terminals
case ${TERM} in
xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|interix|konsole*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"'
;;
screen*)
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"'
;;
esac
use_color=true
# Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS. Try to use the external file
# first to take advantage of user additions. Use internal bash
# globbing instead of external grep binary.
safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
match_lhs=""
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs} ]] \
&& type -P dircolors >/dev/null \
&& match_lhs=$(dircolors --print-database)
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
if ${use_color} ; then
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489
if type -P dircolors >/dev/null ; then
if [[ -f ~/.dir_colors ]] ; then
eval $(dircolors -b ~/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]] ; then
eval $(dircolors -b /etc/DIR_COLORS)
fi
fi
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\]\w\[\033[01;31m\] [\t] \$\[\033[00m\] '
else
PS1='\[\033[01;32m\]\w\[\033[01;32m\] [\t] \$\[\033[00m\] '
fi
alias ls='ls --color=auto'
alias grep='grep --colour=auto'
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'
else
if [[ ${EUID} == 0 ]] ; then
# show root@ when we don't have colors
PS1='\u@\h \w [\t] \$ '
else
PS1='\u@\h \w [\t] \$ '
fi
fi
unset use_color safe_term match_lhs sh
alias cp="cp -i" # confirm before overwriting something
alias df='df -h' # human-readable sizes
alias free='free -m' # show sizes in MB
alias np='nano -w PKGBUILD'
alias more=less
xhost +local:root > /dev/null 2>&1
complete -cf sudo
# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control. #65623
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize
shopt -s expand_aliases
# export QT_SELECT=4
# Enable history appending instead of overwriting. #139609
shopt -s histappend
#
# # ex - archive extractor
# # usage: ex <file>
ex ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
# Base16 Shell
BASE16_SHELL="$HOME/.config/base16-shell/"
[ -n "$PS1" ] && \
[ -s "$BASE16_SHELL/profile_helper.sh" ] && \
eval "$("$BASE16_SHELL/profile_helper.sh")"
source /usr/share/nvm/init-vnm.sh
+14
View File
@@ -0,0 +1,14 @@
export VISUAL=/usr/bin/nvim
export EDITOR=/usr/bin/nvim
export BROWSER=/usr/bin/chromium
export QT_QPA_PLATFORMTHEME="qt5ct"
export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
# cuda stuff
export CUDA_HOME=/opt/cuda
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${CUDA_HOME}/lib64
PATH=${CUDA_HOME}/bin:${PATH}
export PATH
# MKL AMD fix
export MKL_DEBUG_CPU_TYPE=5
+44
View File
@@ -0,0 +1,44 @@
# Lines configured by zsh-newuser-install
HISTFILE=~/.zhistory
HISTSIZE=10000
SAVEHIST=10000
setopt nomatch
unsetopt autocd
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/hjalmarlucius/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# more history stuff
REPORTTIME=3 # Report command running time if it is more than 3 seconds
setopt INC_APPEND_HISTORY # Add commands to history as they are entered, don't wait for shell to exit
setopt EXTENDED_HISTORY # Also remember command start time and duration
setopt HIST_IGNORE_ALL_DUPS # Do not keep duplicate commands in history
setopt HIST_IGNORE_SPACE # Do not remember commands that start with a whitespace
# default ls settings
alias ls='ls -hat --group-directories-first'
ls --color=auto &> /dev/null && alias ls='ls --color=auto'
export CLICOLOR=1
# fuzzy find
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
bindkey '^y' fzf-cd-widget
# configure custom command prompt
_setup_ps1() {
GLYPH="▲"
[ "x$KEYMAP" = "xvicmd" ] && GLYPH="▼"
PS1="%F{red}[%F{cyan}%*%F{red}] %(?.%F{cyan}.%F{red})$GLYPH%f %(1j.%F{cyan}[%j]%f .)%F{cyan}%~%f %(!.%F{red}#%f .)"
}
_setup_ps1
# Base16 Shell
BASE16_SHELL="$HOME/.config/base16-shell/"
[ -n "$PS1" ] && \
[ -s "$BASE16_SHELL/profile_helper.sh" ] && \
eval "$("$BASE16_SHELL/profile_helper.sh")"
+9 -9
View File
@@ -426,15 +426,15 @@ map gT tab_move -1
map gn tab_new ~ map gn tab_new ~
map gc tab_close map gc tab_close
map uq tab_restore map uq tab_restore
map <a-1> tab_open 1 map w1 tab_open 1
map <a-2> tab_open 2 map w2 tab_open 2
map <a-3> tab_open 3 map w3 tab_open 3
map <a-4> tab_open 4 map w4 tab_open 4
map <a-5> tab_open 5 map w5 tab_open 5
map <a-6> tab_open 6 map w6 tab_open 6
map <a-7> tab_open 7 map w7 tab_open 7
map <a-8> tab_open 8 map w8 tab_open 8
map <a-9> tab_open 9 map w9 tab_open 9
# Sorting # Sorting
map or set sort_reverse! map or set sort_reverse!
+12 -7
View File
@@ -29,6 +29,12 @@ set -g default-terminal "tmux-256color"
set -g base-index 1 set -g base-index 1
setw -g pane-base-index 1 setw -g pane-base-index 1
# pane title
setw -g pane-border-status top
setw -g pane-border-format ' #{=/-20/…:pane_title} [#{=/-20/…:pane_current_command}] #(pgrep -P "#{pane_pid}" | tr "\n" " ")#{pane_current_path} #{?alternate_on,<Alt Mode> ,}'
#set -g pane-border-format "#P: #{pane_current_command}"
# Automatically set window title # Automatically set window title
set-window-option -g automatic-rename on set-window-option -g automatic-rename on
set-option -g set-titles on set-option -g set-titles on
@@ -41,8 +47,8 @@ set-option -g set-titles on
# Set new prefix # Set new prefix
# Note : you can press super key by set M. # Note : you can press super key by set M.
# (tested with tty only) # (tested with tty only)
set -g prefix C-a set -g prefix M-a
bind C-a send-prefix bind M-a send-prefix
# First remove *all* keybindings # First remove *all* keybindings
unbind -a unbind -a
@@ -52,19 +58,18 @@ bind ? list-keys
bind d detach-client bind d detach-client
bind D choose-client bind D choose-client
bind : command-prompt bind : command-prompt
bind Enter command-prompt
#bind \ show-messages #bind \ show-messages
# Copy mode # Copy mode
bind c copy-mode bind v copy-mode
# clipboard control # clipboard control
bind P paste-buffer bind P paste-buffer
bind -T copy-mode-vi v send-keys -X begin-selection bind -T copy-mode-vi v send-keys -X begin-selection
#bind -T copy-mode-vi y send-keys -X copy-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard" bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard"
bind -T copy-mode-vi r send-keys -X rectangle-toggle bind -T copy-mode-vi r send-keys -X rectangle-toggle
bind -T copy-mode-vi Escape send-keys -X cancel
# Refresh client # Refresh client
bind R refresh-client \; display-message "Refresh already" bind R refresh-client \; display-message "Refresh already"
@@ -133,7 +138,7 @@ bind -n M-0 if-shell 'tmux select-window -t :10' '' 'new-window -t :10'
bind Q kill-pane bind Q kill-pane
# clear selected pane # clear selected pane
bind-key b send-keys -R \; clear-history bind-key b send-keys -R \; clear-history \; send-keys Enter
# present a menu of URLs to open from the visible pane. sweet. # present a menu of URLs to open from the visible pane. sweet.
bind u capture-pane \;\ bind u capture-pane \;\