-
-
Notifications
You must be signed in to change notification settings - Fork 36
/
oldinit
140 lines (128 loc) · 4.06 KB
/
oldinit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
" Plugin Loading
call plug#begin('~/.vim/plugged')
Plug 'itchyny/lightline.vim' "Highlights lines
Plug 'joshdick/onedark.vim' "The One Dark Theme
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim' "Fuzzy find plugin
Plug 'junegunn/goyo.vim' "Removes Line numbers for focusing
Plug 'mbbill/undotree' "Creates an undo tree
Plug 'preservim/nerdtree' "File browser inside vim
Plug 'godlygeek/tabular' "Auto formatting
Plug 'plasticboy/vim-markdown' "Markdown syntax highlighting
Plug 'ekickx/clipboard-image.nvim'
Plug 'wakatime/vim-wakatime' "Wakatime tracker
Plug 'ryanoasis/vim-devicons' "Cool icons for nerd tree
Plug 'Xuyuanp/nerdtree-git-plugin' "nerd tree customization
Plug '907th/vim-auto-save' "auto saves files as you edit
Plug 'jdhao/better-escape.vim' "remaps esc key to jj
call plug#end()
" Startup Settings
syntax on
let mapleader=" " "Maps Leader to space
let NERDTreeShowHidden=1
let g:auto_save = 1
let g:auto_save_events = ["InsertLeave", "TextChanged"]
let $FZF_DEFAULT_COMMAND = 'fdfind --type f --hidden --follow --exclude .git --ignore-file ~/.ignore'
set mouse=a "Allows mouse usage inside vim. Great for noobs.
set clipboard=unnamedplus "Remaps default copy paste to system clipboard
set hidden
set cursorline
highlight Normal guibg=none
set noerrorbells
set splitbelow splitright
set tabstop=2 softtabstop=2
set shiftwidth=2
set expandtab
set smartindent
set nofoldenable
set nowrap
set smartcase
set noswapfile
set nobackup
set incsearch
set history=5000
set nocompatible
set number relativenumber
colorscheme onedark
set background=dark
set termguicolors
filetype plugin on
set encoding=utf-8
set wildmenu
set wildmode=longest,list,full
set laststatus=2
if !has('gui_running')
set t_Co=256
endif
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
set spell spelllang=en_us
" Plugin Shortcuts
map <Leader>f :NERDTreeToggle<CR>
map <C-\> :Goyo<CR>
nnoremap <F5> :UndotreeToggle<CR> :UndotreeFocus<CR>
nnoremap <C-f> :Files!<CR>
nnoremap <Leader>l :Tabularize /
let g:better_escape_shortcut = 'jj'
let g:better_escape_interval = 250
" clipboard image to markdown
lua <<LUA
--
require'clipboard-image'.setup {
markdown = {
img_dir = {"content/images", "%:p:h:t", "%:t:r"},
img_dir_txt = {"/images", "%:p:h:t", "%:t:r"},
img_name = function ()
vim.fn.inputsave()
local name = vim.fn.input('Name: ')
vim.fn.inputrestore()
if name == nil or name == '' then
return os.date('%y-%m-%d-%H-%M-%S')
end
return name
end,
img_handler = function ()
return function (path)
return os.execute(string.format('~/.scripts/tinypng -s -f %s &', path))
end
end
}
}
LUA
nnoremap <Leader>p :PasteImg<CR>
" General Shortcuts
nnoremap S :%s//g<Left><Left>
nmap <Leader>r :w<CR>:so %<CR>
map <Leader>e $
" Persistent_undo
set undodir=~/.vim/undodir"
set undofile
let g:undotree_WindowLayout = 2
" Tabedit keybinds
nnoremap <Leader>1 1gt<CR>
nnoremap <Leader>2 2gt<CR>
nnoremap <Leader>3 3gt<CR>
nnoremap <Leader>4 4gt<CR>
nnoremap <Leader>5 5gt<CR>
nnoremap <Leader>t :tabnew<CR>
nnoremap <Leader>c :tabclose<CR>
" Markdown Edits
let g:vim_markdown_autowrite = 1
let g:vim_markdown_no_extensions_in_markdown = 1
let g:vim_markdown_conceal = 0
let g:vim_markdown_override_foldtext = 0
let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_new_list_item_indent = 0
" Markdown auto format tables
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
Tabularize/|/l1
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endif
endfunction
" transparent bg
autocmd vimenter * hi Normal guibg=NONE ctermbg=NONE