summaryrefslogtreecommitdiff
path: root/files/config/nvim/init.vim
blob: 567e5bdb318c28689a3884f1e61af8d7108ec2d7 (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
syntax on

" Sets file format and encoding
set fileformat=unix
set encoding=UTF-8

" Highlights the current line
highlight CursorLine guibg=#5f0087
set cursorline

" Enable search highlighting
set hlsearch

" Show the status bar
set laststatus=2

" Tab and indentation settings
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
set autoindent
set smartindent
set smarttab

" Line numbering
set number
set relativenumber

" Keep 8 lines visible above/below the cursor when scrolling
set scrolloff=8

" Improved split navigation
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l

augroup reload_vimrc
  autocmd!
  autocmd BufWritePost init.vim source $MYVIMRC
augroup END

" Use system clipboard
set clipboard=unnamedplus

call plug#begin('~/.config/nvim/plug')

" List your plugins here
Plug 'junegunn/goyo.vim', { 'for': 'markdown' }
Plug 'vimwiki/vimwiki'


call plug#end()

" Vimwiki settings
let g:vimwiki_list = [{
      \ 'path': '~/Documents/Notes/',
      \ 'syntax': 'markdown',
      \ 'ext': '.md'
      \ }]


" Goyo settings
function! s:goyo_enter()
  set noshowmode
  set noshowcmd
  set scrolloff=999
  set linebreak
endfunction

function! s:goyo_leave()
  if executable('tmux') && strlen($TMUX)
    silent !tmux set status on
    silent !tmux list-panes -F '\#F' | grep -q Z && tmux resize-pane -Z
  endif
  set showmode
  set showcmd
  set scrolloff=5
  set nolinebreak
  " ...
endfunction

let g:goyo_width='80%'
let g:goyo_height='80%'

autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()