summaryrefslogtreecommitdiff
path: root/.config/nvim/init.vim
blob: 25fe8d6e653a66339aa7be67d5b9e50b655108e7 (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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
autocmd! bufwritepost .vimrc source %

call plug#begin('~/.vim/plugged')

Plug 'cespare/vim-toml', { 'branch': 'main' }
Plug 'rust-lang/rust.vim'
Plug 'nvim-lua/plenary.nvim'
Plug 'lewis6991/gitsigns.nvim'
Plug 'nvim-lualine/lualine.nvim'
Plug 'kyazdani42/nvim-web-devicons'
Plug 'luochen1990/rainbow' " color parentheses
Plug 'mg979/vim-visual-multi', {'branch': 'master'}
Plug 'tpope/vim-fugitive' " git extension for commit logs and etc.
Plug 'editorconfig/editorconfig-vim'
Plug 'ap/vim-css-color'
Plug 'Yggdroot/indentLine'

Plug 'google/vim-searchindex'

Plug 'kazhala/close-buffers.nvim'
Plug 'numToStr/Comment.nvim'

Plug 'matze/vim-move'

Plug 'togglebyte/togglerust' " Debug Rust projects

if has('nvim')
    Plug 'rktjmp/lush.nvim'
    Plug 'dcariotti/gruvbox.nvim'

    Plug 'nvim-telescope/telescope.nvim'
    Plug 'neovim/nvim-lspconfig'
    Plug 'ms-jpq/coq_nvim', {'branch': 'coq'}
    Plug 'ms-jpq/coq.artifacts', {'branch': 'artifacts'}
    Plug 'kyazdani42/nvim-tree.lua'
    Plug 'ray-x/lsp_signature.nvim'
    Plug 'folke/todo-comments.nvim'
    Plug 'saecki/crates.nvim'
    "Plug 'gelguy/wilder.nvim', { 'do': ':UpdateRemotePlugins' }
    Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}

    "Plug 'sakhnik/nvim-gdb', { 'do': ':!./install.sh' }

    Plug 'jose-elias-alvarez/null-ls.nvim'
    Plug 'folke/trouble.nvim'
    Plug 'folke/lsp-colors.nvim'

    Plug 'sindrets/diffview.nvim'

    Plug 'windwp/nvim-ts-autotag'

    " Used as light theme
    Plug 'yorik1984/newpaper.nvim'
endif


call plug#end()            " required

syntax on

set runtimepath+=~/.vim-plugins/LanguageClient-neovim

set completeopt=menu,menuone,noselect

set clipboard=unnamed
set mouse=a " click with mouse
set wildmenu
set wildmode=full
set wildignore=*~,*.png,*.jpg,*.gif,Thumbs.db,*.min.js,*.swp,*.o,vendor

set number " number of the current line
set relativenumber " relative number, ..-2 -1 x 1 2, where x is current line
set textwidth=80
set colorcolumn=80
set nowrap
set fo-=t

set tabstop=4
set shiftwidth=4
set expandtab " convert tabs in spaces

set ai " auto indent
set autoread

set encoding=UTF-8
set history=1000
set wildignore+=*.pyc

set hlsearch " highlight search
set incsearch

set nowritebackup
set laststatus=2

set list " spaces as characters
set listchars=eol:⏎,tab:»·,trail:ˑ,nbsp:⎵

set foldmethod=indent

set splitright " split on right side
set splitbelow
set lazyredraw
set ttyfast

set noswapfile

" rust
"   let g:rustfmt_autosave = 1
"   let g:rustfmt_emit_files = 1
"   let g:rustfmt_fail_silently = 0
"   let g:rust_clip_command = 'xclip -selection clipboard'

set termguicolors
set background=dark

if has('nvim')
    colorscheme gruvbox

    lua require('git')
    let g:coq_settings = { 'auto_start': v:true }
    lua require('lsp_conf')

    lua require('nvim-tree').setup()
    lua require('todo-comments').setup()
    lua require('crates').setup()

    lua require('nvim-treesitter.configs').setup({ highlight = { enable = true, }, })

    lua require('lsp-colors').setup()

    lua require('Comment').setup()

    lua require('diffview').setup()
    ca do DiffviewOpen
    ca dc DiffviewClose
    ca dh DiffviewFileHistory

    set cursorline " need for Neovim 0.6 for highlight CursorLineNr
else
    colorscheme gruvbox
endif

" Figure out the system Python for Neovim.
if exists("$VIRTUAL_ENV")
    let g:python3_host_prog=substitute(system("which -a python3 | head -n2 | tail -n1"), "\n", '', 'g')
else
    let g:python3_host_prog=substitute(system("which python3"), "\n", '', 'g')
endif

" indentline
let g:indentLine_char = '¦'
let g:vim_json_syntax_conceal = 0

let g:netrw_liststyle=1

filetype plugin indent on
set nocompatible

set showcmd " show commands at bottom

" nvim-tree
let g:nvim_tree_quit_on_open = 1
let g:nvim_tree_highlight_opened_files = 1
nnoremap <C-t> :NvimTreeToggle<CR>

" vim-move
let g:move_key_modifier = 'C'

" ------------
" MAPS
" -----------
let mapleader = ","

nnoremap j gj
nnoremap k gk

nnoremap tn :tabnew<cr>
ca rt RainbowToggle

nnoremap <leader>xx :TroubleToggle<cr>

" buffers
nnoremap ]b :bnext<CR>
nnoremap [b :bprev<CR>
nnoremap <leader>b <cmd>Telescope buffers<cr>

" tabs
nnoremap ]t :tabn<CR>
nnoremap [t :tabp<CR>

" only one window
nnoremap <leader>o :only<CR>


nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>

nnoremap <leader>pa :set paste<CR>
nnoremap <leader>npa :set nopaste<CR>


nmap <leader>cr :Cargo run<CR>
nmap <F6> :EditorConfigReload<CR>

if &diff
  "Get from remote
  nnoremap dr :diffget<Space>RE<CR>
  "Get from base
  nnoremap db :diffget<Space>BA<CR>
  "Get from local
  nnoremap dl :diffget<Space>LO<CR>
endif

packadd termdebug
let g:termdebug_wide = 1
let g:TermDebugging = 0