aboutsummaryrefslogtreecommitdiff
path: root/vimrc
blob: a41b5624f00a8f1f76a4120f1df23e3ef4d96324 (plain)
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
" Plugins
call plug#begin('~/.vim/plugged')
Plug 'w0rp/ale' " Async linting
Plug 'tpope/vim-commentary' " Better commenting commands
Plug 'tpope/vim-fugitive' " Git integration with vim
Plug 'tpope/vim-surround' " Helps with surrounding text
Plug 'morhetz/gruvbox' " Pretty colorscheme
Plug 'Valloric/YouCompleteMe' " Autocomplete
Plug 'ledger/vim-ledger' " Ledger plugin
Plug 'python-mode/python-mode' " Python awesomeness in vim
call plug#end()

" General Settings
set nocompatible " Disable vi-compatible
set wildmenu " Enable autocomple menu
set incsearch " Show search results as typing string
set hlsearch " Highlight matches to previos search string
set expandtab " In Insert mode: Use the appropriate number of spaces to insert <Tab>.
set tabstop=4 "Number of spaces that a <Tab> counts for
set shiftwidth=0 " Make shiftwidth value the same as tabstop
set relativenumber " Use relative numbers in the side bar
set nowrap " Turn off text wrapping long lines
set history=1000 " Set number of ':' commands
set wildmode=list:full " wildmenu show list complete to first result
set splitright " New windows split to the right of current one
set splitbelow " New windows split below the current one
set completeopt-=preview " Hide the preview/scratch window

" Custom status line
set statusline=
set statusline+=%1*\ %02c\                    " Color
set statusline+=%2*\ »                        " RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
set statusline+=%3*\ %<%F\                    " File+path
set statusline+=%2*\«                         " LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
set statusline+=%2*\ %=\ %l/%L\ (%02p%%)\     " Rownumber/total (%)

" Set spacing of filetypes
autocmd FileType sh,python setlocal tabstop=4
autocmd FileType make setlocal tabstop=4 noexpandtab
autocmd FileType ledger setlocal tabstop=2
autocmd FileType vim setlocal tabstop=2

" Setup colorscheme
syntax enable 
colorscheme gruvbox " Set the colorscheme
set background=dark " Use dark colorscheme

" Set vimdiff colors, make it easier to read
highlight DiffAdd    cterm=BOLD ctermfg=NONE ctermbg=22
highlight DiffDelete cterm=BOLD ctermfg=NONE ctermbg=52
highlight DiffChange cterm=BOLD ctermfg=NONE ctermbg=23
highlight DiffText   cterm=BOLD ctermfg=NONE ctermbg=23

" Highlight lines at 80 mark
highlight ColorColumn ctermbg=cyan
au BufNewFile,BufRead * call matchadd('ColorColumn', '\%81v', 100)

" Highlight lines at 120 mark
au BufNewFile,BufRead * call matchadd('Error', '\%121v', 100)

" My Shorcuts
let mapleader="\<Space>"
" type jj to get out of insert mode
inoremap jj <ESC>
" Ctags for python project
command! MakeTagsPython !ctags --languages=python --python-kinds=-i -R .
" Command for figuring out highlight group
map <leader>hi :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" . " FG:" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"fg#")<CR>
" Turn off syntax highlighting
nnoremap <leader><leader> :noh<CR>
" New tab
nnoremap <C-w>t :tabnew<CR>
" Visually select pasted text
nnoremap gp `[v`]
" Vimdiff commands
nnoremap <leader>du :diffupdate<CR>
nnoremap <leader>dd :diffget<CR>
nnoremap <leader>df :diffput<CR>
nnoremap _ [c
nnoremap = ]c
" Visually select line without ending
nnoremap <leader>v ^v$h
" Some very useful shortcuts for editing Ledger entries
" Copy the last entry
nnoremap <leader>ll G{jV}y}p10l
" Copy the current entry to the bottom, copy date from last entry
nnoremap <leader>lb {jV}yGp10l{{jvEy}jvEpl
" Copy the current entry to the next position
nnoremap <leader>ln {jV}y}p10l
" Jump down from line to replace dollar ammount
nnoremap <leader>ld j^f$lC
" After searching pull entry to current position
nnoremap <leader>ly vapy<C-o>p{{jvEy}jvEpl
" Accept current autocomplete suggestion
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>"


"-----------------------------------------------------------------------------------------------------------------------
" Ale
"-----------------------------------------------------------------------------------------------------------------------
let g:ale_lint_on_enter = 0
let g:ale_sign_column_always = 1
let g:ale_lint_on_text_changed = 'never'
let g:ale_python_mypy_options='--ignore-missing-imports'
let g:ale_history_enabled = 0 
highlight clear ALEErrorSign
highlight clear ALEWarningSign
" Change gutter color
highlight SignColumn cterm=NONE ctermfg=0 ctermbg=None
"-----------------------------------------------------------------------------------------------------------------------



"-----------------------------------------------------------------------------------------------------------------------
" Python Mode
"-----------------------------------------------------------------------------------------------------------------------
let g:pymode_run = 1
let g:pymode_indent = 1
let g:pymode_motion = 1
let g:pymode_options_colorcolumn = 0
let g:pymode_lint = 0
let g:pymode_rope = 0
let g:pymode_doc = 0
let g:pymode_breakpoint = 0
let g:pymode_lint = 0
let g:pymode_folding = 0
"-----------------------------------------------------------------------------------------------------------------------