new file structure for nvim

This commit is contained in:
Harri Lahtinen 2019-11-15 16:13:05 +02:00
parent 7368476dea
commit 29aa367095
7 changed files with 507 additions and 66 deletions

View File

@ -12,7 +12,7 @@ IFS=$'\n\t'
cur_workspace=$(i3-msg -t get_workspaces | jq -r '.[] | select(.visible == true) | .name')
# extract workspace name which is defined between two underscored
workspaces=$(ls -l ~/.i3/i3-resurrect/*.json | grep -Po '.*_\K(.*)_' | sed 's/_//' | uniq)
workspaces=$(ls -l ~/.config/i3-resurrect/*.json | grep -Po '.*_\K(.*)_' | sed 's/_//' | uniq)
echo "Found workspaces: $workspaces"
# restore workspaces

View File

@ -9,7 +9,7 @@ IFS=$'\n\t'
# example suggested usage: i3-resurrect-save-all
# remove old saves
rm -f ~/.i3/i3-resurrect/*
rm -f ~/.config/i3-resurrect/*
# find running workspaces
workspaces=$(i3-msg -t get_workspaces | jq '.[] | .name')

View File

@ -0,0 +1,151 @@
"***********************************************************************************
" __ ___ _ ____ __ __ _
" / |/ / ___ _ (_) ___ / __/ ___ / /_ / /_ (_) ___ ___ _ ___
" / /|_/ / / _ `/ / / / _ \ _\ \ / -_)/ __// __/ / / / _ \ / _ `/ (_-<
"/_/ /_/ \_,_/ /_/ /_//_/ /___/ \__/ \__/ \__/ /_/ /_//_/ \_, / /___/
" /___/
"
"***********************************************************************************
" Colorscheme
colorscheme wal
augroup specify_filetype
autocmd!
autocmd BufRead,BufNewFile *.md set filetype=markdown
autocmd BufRead,BufNewFile *.txt set filetype=text
augroup END
" Longer leader key timeout
set timeout timeoutlen=1500
" Enable spell-checking for certain files
autocmd FileType text,markdown setlocal spell
" Limit line length for text files
autocmd FileType text,markdown,tex setlocal textwidth=180
" Don't automatically collapse markdown
set conceallevel=0
" Don't display mode in command line (airline already shows it)
set noshowmode
" Automatically re-read file if a change was detected outside of vim
set autoread
" no case-sensitive search unless uppercase is present
set ignorecase
set smartcase
" Enable mouse scroll
set mouse=a
" Allow a new buffer to be opened without saving current
set hidden
" Statusline Config
set statusline+=%F
set cmdheight=1
" Tab Settings
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
set smarttab
set autoindent
set smartindent
set shiftround
" Enable syntax highlighting
syntax on
" Print syntax highlighting.
set printoptions+=syntax:y
" Matching braces/tags
set showmatch
" Keep a backup file.
"set backup
" Save undo tree.
"set undofile
" Do not back up temporary files.
set backupskip=/tmp/*,/private/tmp/*"
" Store backup files in one place.
set backupdir^=$HOME/.config/nvim//storage/backups//
" Store swap files in one place.
set dir^=$HOME/.config/nvim//storage/swaps//
" Store undo files in one place.
set undodir^=$HOME/.config/nvim/storage/undos//
" No line wrapping
set nowrap
" Turns on detection for fyletypes, indentation files and plugin files
filetype plugin indent on
" Split window appears right the current one.
set splitright
" Make sure compatible mode is disabled
set nocompatible
" Share yank buffer with system clipboard
set clipboard=unnamedplus
" Show next 3 lines while scrolling.
if !&scrolloff
set scrolloff=3
endif
" Show next 5 columns while side-scrolling.
if !&sidescrolloff
set sidescrolloff=5
endif
" Jump to the last known position when reopening a file.
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
endif
" Relative line numbers
set number
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
augroup END
" Subscript digraphs for maths
"alphsubs ---------------------- {{{
execute "digraphs ks " . 0x2096
execute "digraphs as " . 0x2090
execute "digraphs es " . 0x2091
execute "digraphs hs " . 0x2095
execute "digraphs is " . 0x1D62
execute "digraphs ks " . 0x2096
execute "digraphs ls " . 0x2097
execute "digraphs ms " . 0x2098
execute "digraphs ns " . 0x2099
execute "digraphs os " . 0x2092
execute "digraphs ps " . 0x209A
execute "digraphs rs " . 0x1D63
execute "digraphs ss " . 0x209B
execute "digraphs ts " . 0x209C
execute "digraphs us " . 0x1D64
execute "digraphs vs " . 0x1D65
execute "digraphs xs " . 0x2093
"}}}

View File

@ -0,0 +1,119 @@
"###################################################################################
" __ ___ _
" / |/ /____ _ ____ ____ (_)____ ____ _ _____
" / /|_/ // __ `// __ \ / __ \ / // __ \ / __ `// ___/
" / / / // /_/ // /_/ // /_/ // // / / // /_/ /(__ )
" /_/ /_/ \__,_// .___// .___//_//_/ /_/ \__, //____/
" /_/ /_/ /____/
"
"###################################################################################
"***********************************************************************************
" Main Vim Keybinds
"***********************************************************************************
" Set leader to space bar
let mapleader = " "
let maplocalleader = " "
" Window Navigation
" Navigate to left window.
nnoremap <C-h> <C-w>h
" Navigate to down window.
nnoremap <C-j> <C-w>j
" Navigate to top window.
nnoremap <C-k> <C-w>k
" Navigate to right window.
nnoremap <C-l> <C-w>l
" Horizontal split then move to bottom window.
nnoremap <Leader>- <C-w>s
" Vertical split then move to right window.
nnoremap <Leader>\| <C-w>v<C-w>l
" Cycle tabs with Tab and Shift+Tab
nnoremap<silent> <Tab> :bnext<CR>
nnoremap<silent> <S-Tab> :bprevious<CR>
" Kill buffer with Space+bk
nnoremap<silent> <Space>bk :bdelete<CR>
"Faster ESC.
inoremap jk <ESC>
inoremap kj <ESC>
" Indent controls
" Reselect text ater indent/unindent.
vnoremap < <gv
vnoremap > >gv
" Tab to indent in visual mode.
vnoremap <Tab> >gv
" Shift+Tab to unindent in visual mode.
vnoremap <S-Tab> <gv
" Text alignment
nnoremap <Leader>Al :left<CR>
nnoremap <Leader>Ac :center<CR>
nnoremap <Leader>Ar :right<CR>
vnoremap <Leader>Al :left<CR>
vnoremap <Leader>Ac :center<CR>
vnoremap <Leader>Ar :right<CR>
"***********************************************************************************
" Plugin specific keybinds
"***********************************************************************************
" Git status
nnoremap <Leader>gs :Gstatus<cr>
" Git diff in split window
nnoremap <Leader>gd :Gdiffsplit<cr>
" Git commit
nnoremap <Leader>gc :Gcommit<cr>
" Git push
nnoremap <Leader>gP :Gpush<cr>
" Git pull
nnoremap <Leader>gp :Gpull<cr>
" Git move
nnoremap <Leader>gm :Gmove<cr>
" Git merge
nnoremap <Leader>gM :Gmerge<cr>
" browse current file on web
nnoremap <Leader>gb :Gbrowse<cr>
" browse current line on web
nnoremap <Leader>gbl :CocCommand git.browserOpen<cr>
" View chunk information in preview window.
nnoremap <Leader>gh :CocCommand git.chunkInfo<cr>
" View commit information in preview window.
nnoremap <Leader>gsc :CocCommand git.showCommit<cr>
" Toggle git gutter sign columns
nnoremap <Leader>gg :CocCommand git.toggleGutters<cr>
" NERD Commenter
" Toggle comments in visual or normal mode
nnoremap <leader>n :call NERDComment(0,"toggle")<cr>
vnoremap <leader>n :call NERDComment(1,"toggle")<cr>
" Toggle a sexy comment
nnoremap <leader>ns :call NERDComment(0,"sexy")<cr>
vnoremap <leader>ns :call NERDComment(1,"sexy")<cr>
" append a comment
nnoremap <leader>na :call NERDComment(0,"append")<cr>
vnoremap <leader>na :call NERDComment(1,"append")<cr>
" uncomment section
nnoremap <leader>nu :call NERDComment(0,"uncomment")<cr>
vnoremap <leader>nu :call NERDComment(1,"uncomment")<cr>
" invert comments
nnoremap <leader>ni :call NERDComment(0,"invert")<cr>
vnoremap <leader>ni :call NERDComment(1,"invert")<cr>
" comment section
nnoremap <leader>nc :call NERDComment(0,"comment")<cr>
vnoremap <leader>nc :call NERDComment(1,"comment")<cr>
"
" Fuzzy Finding
" fuzzy find files
nnoremap <silent> <Leader>ff :Files<CR>
" fuzzy find tags
nnoremap <silent> <Leader>ft :Vista finder ctags<CR>

View File

@ -0,0 +1,138 @@
"*****************************************************************************************
" ___ __ _ ____ __ __ _
" / _ \ / / __ __ ___ _ (_) ___ / __/ ___ / /_ / /_ (_) ___ ___ _ ___
" / ___/ / / / // / / _ `/ / / / _ \ _\ \ / -_)/ __// __/ / / / _ \ / _ `/ (_-<
"/_/ /_/ \_,_/ \_, / /_/ /_//_/ /___/ \__/ \__/ \__/ /_/ /_//_/ \_, / /___/
" /___/ /___/
"
"*****************************************************************************************
"""""""""""
" Tmuxline"
" """""""""
let g:tmuxline_preset = {
\'a' : '#S',
\'b' : '#W',
\'c' : ['#(~/.config/Scripts/showip)'],
\'win' : ['#I', '#W'],
\'cwin' : ['#I', '#W', '#F'],
\'y' : ['%R', '%a', '%Y'],
\'z' : '#H'}
"""""""""""
" Goyo "
"""""""""""
nmap <F6> :Goyo<CR>
"""""""""""
" Vista "
"""""""""""
nmap <F8> :Vista!!<CR>
let g:vista_executive_for = {
\ 'c': 'coc',
\ }
nnoremap <silent><leader>vf :Vista finder coc<CR>
let g:vista_icon_indent = ["╰─▸ ", "├─▸ "]
let g:vista#renderer#enable_icon = 1
let g:vista_sidebar_width = 50
""""""""""""
"NerdTree "
""""""""""""
" if nerdtree is only window, kill nerdtree so buffer can die
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | :bdelete | endif
map <F7> :NERDTreeToggle<CR>
let nerdtreequitonopen = 0
let NERDTreeShowHidden=1
let nerdchristmastree=1
let g:NERDTreeMinimalUI = 1
let g:nerdtreewinsize = 25
let g:NERDTreeDirArrowExpandable = '▷'
let g:NERDTreeDirArrowCollapsible = '▼'
let NERDTreeAutoCenter=1
let g:NERDTreeIndicatorMapCustom = {
\ "modified" : "✹",
\ "staged" : "✚",
\ "untracked" : "✭",
\ "renamed" : "➜",
\ "unmerged" : "═",
\ "deleted" : "✖",
\ "dirty" : "✗",
\ "clean" : "✔︎",
\ 'ignored' : '☒',
\ "unknown" : "?"
\ }
""""""""""""
"Airline "
""""""""""""
"main settings
let g:airline_theme='wpgtk'
let g:airline_powerline_fonts = 1
let g:airline_symbols = {}
let g:airline_skip_empty_sections = 1
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols_branch = ''
let g:airline_powerline_fonts = 1
let g:airline_symbols.crypt = ''
let g:airline_symbols.linenr = '☰'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = '␤'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.spell = 'Ꞩ'
let g:airline_symbols.notexists = 'Ɇ'
let g:airline_symbols.whitespace = 'Ξ'
let g:airline_symbols.modified = ' '
let g:airline_section_error = '%{airline#util#wrap(airline#extensions#coc#get_error(),0)}'
let g:airline_section_warning = '%{airline#util#wrap(airline#extensions#coc#get_warning(),0)}'
"extensions
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#ale#enabled = 1
let g:airline#extensions#coc#enabled = 1
let g:airline#extensions#unicode#enabled = 1
let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#vista#enabled = 1
let g:airline#extensions#hunks#enabled = 1
"extension settings
let airline#extensions#coc#stl_format_err = '%E{[%e(#%fe)]}'
let airline#extensions#coc#stl_format_warn = '%W{[%w(#%fw)]}'
let airline#extensions#coc#warning_symbol = ':'
let airline#extensions#coc#error_symbol = ':'
let g:airline#extensions#hunks#hunk_symbols = [':', ':', ':']
let g:airline#extensions#branch#format = 2
"""""""""""""
"Devicons "
"""""""""""""
let g:webdevicons_enable = 1
let g:webdevicons_enable_unite = 1
let g:webdevicons_enable_denite = 1
let g:webdevicons_enable_nerdtree = 1
let g:webdevicons_enable_airline_tabline = 1
let g:webdevicons_enable_vimfiler = 1
let g:WebDevIconsUnicodeDecorateFileNodes = 1
let g:WebDevIconsUnicodeDecorateFolderNodes = 1
let g:WebDevIconsUnicodeGlyphDoubleWidth = 1
let g:webdevicons_enable_airline_statusline = 1
let g:WebDevIconsNerdTreeGitPluginForceVAlign = 1
let g:WebDevIconsUnicodeGlyphDoubleWidth = 1
let g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol = ''
let g:DevIconsDefaultFolderOpenSymbol = ''
"""""""""""""""""
"Comfy-Scroll "
"""""""""""""""""
noremap <silent> <ScrollWheelDown> :call comfortable_motion#flick(40)<CR>
noremap <silent> <ScrollWheelUp> :call comfortable_motion#flick(-40)<CR>
let g:comfortable_motion_friction = 50.0
let g:comfortable_motion_air_drag = 1.0

View File

@ -0,0 +1,89 @@
"#####################################################################################################
" ____ __ _
" / __ \ / / __ __ ____ _ (_) ____ _____
" / /_/ / / / / / / / / __ `/ / / / __ \ / ___/
" / ____/ / / / /_/ / / /_/ / / / / / / / (__ )
" /_/ /_/ \__,_/ \__, / /_/ /_/ /_/ /____/
" /____/
"######################################################################################################
" Install vim-plugged if not already installed
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
" Git wrapper
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-rhubarb'
" Nerd Commenter
Plug 'scrooloose/nerdcommenter'
" Autosaving
Plug '907th/vim-auto-save'
" Vim Surround
Plug 'tpope/vim-surround'
" Auto pairs
Plug 'jiangmiao/auto-pairs'
" Multiple Cursors
Plug 'terryma/vim-multiple-cursors'
" Fuzzy finding
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --no-bash' }
Plug 'junegunn/fzf.vim'
" i3 syntax
Plug 'PotatoesMaster/i3-vim-syntax'
" Tmuxline
Plug 'edkolev/tmuxline.vim'
" Custom start page
Plug 'mhinz/vim-startify'
" Status bar
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Tabular auto-align
Plug 'godlygeek/tabular'
" Comfy scroll
Plug 'yuttie/comfortable-motion.vim'
" Add DevIcons
Plug 'ryanoasis/vim-devicons'
" Tagbar
Plug 'liuchengxu/vista.vim'
" NERDTree
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
" goyo distraction free mode
Plug 'junegunn/goyo.vim'
" Wal theme
Plug 'dylanaraps/wal.vim'
Plug 'deviantfero/wpgtk.vim'
" Colorschemes
Plug 'chase/focuspoint-vim'
Plug 'liuchengxu/space-vim-theme'
Plug 'kadekillary/Turtles'
Plug 'arcticicestudio/nord-vim'
Plug 'whatyouhide/vim-gotham'
Plug 'itchyny/landscape.vim'
Plug 'nanotech/jellybeans.vim'
call plug#end()

View File

@ -1,64 +1,8 @@
set nocompatible " Disable compatibility to old-time vi
set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
set mouse=v " middle-click paste with mouse
set hlsearch " highlight search results
set tabstop=4 " number of columns occupied by a tab character
set softtabstop=4 " see multiple spaces as tabstops so <BS> does the right thing
set expandtab " converts tabs to white space
set shiftwidth=4 " width for autoindents
set autoindent " indent a new line the same amount as the line just typed
set number " add line numbers
set wildmode=longest,list " get bash-like tab completions
set autoread " refresh file
if (has("termguicolors"))
set termguicolors
endif
syntax on
" allows auto-indenting depending on file type
filetype plugin indent on
call plug#begin('~/.local/share/nvim/site/autoload')
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'dylanaraps/wal'
Plug 'PotatoesMaster/i3-vim-syntax'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'mhinz/vim-startify'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-obsession'
Plug 'junegunn/gv.vim'
Plug 'junegunn/goyo.vim'
Plug 'edkolev/tmuxline.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'chrisbra/colorizer'
Plug 'chase/focuspoint-vim'
Plug 'liuchengxu/space-vim-theme'
Plug 'kadekillary/Turtles'
Plug 'arcticicestudio/nord-vim'
Plug 'whatyouhide/vim-gotham'
Plug 'deviantfero/wpgtk.vim'
Plug 'itchyny/landscape.vim'
call plug#end()
map <C-n> :NERDTreeToggle<CR>
colorscheme wal
let g:airline_powerline_fonts = 1
let g:airline_theme='nord'
let g:tmuxline_preset = {
\'a' : '#S',
\'b' : '#W',
\'c' : ['#(~/.config/Scripts/showip)'],
\'win' : ['#I', '#W'],
\'cwin' : ['#I', '#W', '#F'],
\'y' : ['%R', '%a', '%Y'],
\'z' : '#H'}
" Run xrdb whenever Xdefaults or Xresources are updated.
autocmd BufWritePost *Xresources,*Xdefaults !xrdb %
" This script contains general neovim settings
source $HOME/.config/nvim/config/main.vim
" This script contains a list of Vim-Plugged plugins
source $HOME/.config/nvim/config/plugins.vim
" This script contains plugin specific settings
source $HOME/.config/nvim/config/plugin-settings.vim
" This script contains mappings
source $HOME/.config/nvim/config/mappings.vim