This repository has been archived by the owner on May 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.vim
112 lines (87 loc) · 3.61 KB
/
init.vim
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
packadd minpac
call minpac#init()
call minpac#add('k-takata/minpac', {'type': 'opt'})
call minpac#add('junegunn/fzf')
call minpac#add('tpope/vim-unimpaired')
call minpac#add('tpope/vim-surround')
call minpac#add('neovim/nvim-lspconfig')
call minpac#add('elixir-editors/vim-elixir')
call minpac#add('mhinz/vim-mix-format')
call minpac#add('vim-airline/vim-airline')
call minpac#add('mileszs/ack.vim')
call minpac#add('preservim/nerdtree')
call minpac#add('christoomey/vim-tmux-navigator')
call minpac#add('windwp/nvim-autopairs')
command! PackUpdate call minpac#update()
command! PackClean call minpac#clean()
let mapleader = "-"
nnoremap <leader>o :<C-u>FZF<CR>
lua << EOF
require('nvim-autopairs').setup{}
local nvim_lsp = require('lspconfig')
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
-- Enable completion triggered by <c-x><c-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings
local opts = { noremap=true, silent=true }
-- See `:help vim.lsp.* for documentation on any of the below functions
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
end
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
nvim_lsp.elixirls.setup {
on_attach = on_attach,
cmd = { "/home/tristan/sources/elixir-ls/rel/language_server.sh" }
}
EOF
let g:mix_format_on_save = 1
nnoremap / /\v
vnoremap / /\v
nnoremap <leader><space> :nohl<CR>
" tab settings
set tabstop=2
set softtabstop=2
set shiftwidth=2
set smarttab
set expandtab
set number
set history=1000
set noswapfile
set mouse=a
" invisible characters
set listchars=tab:▸\ ,eol:¬,trail:·,extends:#,nbsp:·
setlocal list
" deletes trailing whitespaces
autocmd BufWritePre * %s/\s\+$//e
" buffers
noremap <C-Tab> :bnext<CR>
noremap <C-S-Tab> :bprev<CR>
noremap <C-n> :bnext<CR>
noremap <C-p> :bprev<CR>
noremap <leader>d <Esc>:bdel<CR>
map <C-s> :w<CR>
nnoremap <leader>t :NERDTreeToggle<CR>
" ack.vim --- {{{
let g:ackprg = 'rg --vimgrep --type-not sql --smart-case'
nnoremap <leader>a :Ack<Space>
" }}}
nnoremap <silent> <C-[> :cprevious<CR>
nnoremap <silent> <C-]> :cnext<CR>