aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/alacritty/alacritty.yml2
-rw-r--r--.config/i3/config12
-rw-r--r--.config/nvim/.luarc.json5
-rw-r--r--.config/nvim/init.lua59
-rw-r--r--.config/nvim/lua/autocomplete.lua34
-rw-r--r--.config/nvim/lua/lsp.lua20
-rw-r--r--.config/nvim/lua/plugins.lua8
-rw-r--r--.config/nvim/lua/remapping.lua25
-rw-r--r--.config/nvim/lua/set.lua26
9 files changed, 127 insertions, 64 deletions
diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml
index 9b3295d..1c3f557 100644
--- a/.config/alacritty/alacritty.yml
+++ b/.config/alacritty/alacritty.yml
@@ -7,7 +7,7 @@ window:
colors:
primary:
- background: "0x000000"
+ background: "0x222222"
normal:
black: "0x111111"
white: "0xAAAAAA"
diff --git a/.config/i3/config b/.config/i3/config
index 86a0ee1..fddda7f 100644
--- a/.config/i3/config
+++ b/.config/i3/config
@@ -32,9 +32,11 @@ exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
# and nm-applet is a desktop environment-independent system tray GUI for it.
exec --no-startup-id nm-applet
+exec xrandr --output DVI-D-0 --auto --right-of HDMI-A-0
exec setxkbmap -option "caps:super"
exec nitrogen --restore
exec alacritty --hold -e sudo pacman -Syu
+exec unclutter --timeout 2
# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
@@ -48,10 +50,10 @@ bindsym XF86AudioPrev exec --no-startup-id playerctl previous && $refresh_i3stat
# use these keys for focus, movement, and resize directions when reaching for
# the arrows is not convenient
-set $up j
-set $down k
-set $left l
-set $right semicolon
+set $up k
+set $down j
+set $left h
+set $right l
set $mod Mod4
# use Mouse+$mod to drag floating windows to their wanted position
@@ -102,7 +104,7 @@ bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
-bindsym $mod+h split h
+bindsym $mod+g split h
# split in vertical orientation
bindsym $mod+v split v
diff --git a/.config/nvim/.luarc.json b/.config/nvim/.luarc.json
new file mode 100644
index 0000000..f979d50
--- /dev/null
+++ b/.config/nvim/.luarc.json
@@ -0,0 +1,5 @@
+{
+ "diagnostics.globals": [
+ "vim"
+ ]
+}
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index 2702afb..8fb9f57 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -1,62 +1,9 @@
-
local packer_path = vim.fn.stdpath('config') .. '/site'
vim.o.packpath = vim.o.packpath .. ',' .. packer_path
require("plugins")
require("plugin_conf")
+require("autocomplete")
require("lsp")
-
--- OPTIONS
-local opt = vim.opt
-
-opt.number = true
-opt.relativenumber = false
-opt.cursorline = true
-opt.scrolloff = 4
-opt.signcolumn = "yes"
-
-opt.encoding = 'utf8'
-opt.fileencoding = 'utf8'
-opt.syntax = "ON"
-opt.termguicolors = true
-vim.api.nvim_command('colorscheme monokai-pro-spectrum')
-
-opt.ignorecase = true
-opt.smartcase = true
-opt.incsearch = true
-
-opt.expandtab = true
-opt.shiftwidth = 2
-opt.softtabstop = 2
-opt.tabstop = 2
-
-opt.splitright = true
-opt.splitbelow = true
-
--- KEYS
-
-local map = vim.api.nvim_set_keymap
-
-local key = '<space>'
-map('i', 'jk', '<escape>', {})
-map('n', key .. 'n', [[:NvimTreeToggle<cr>]], {})
-map('n', key .. 'f', [[:Telescope find_files<cr>]], {})
-map('n', key .. 'g', [[:Git<cr>]], {})
-map('n', key .. 'to', [[:TermOpen<cr><cr>]], {})
-map('n', key .. 'c', [[:noh<cr>]], {})
-
--- change pane
-map('n', '<C-h>', '<C-w>h', {})
-map('n', '<C-j>', '<C-w>j', {})
-map('n', '<C-k>', '<C-w>k', {})
-map('n', '<C-l>', '<C-w>l', {})
-
-map('o', 'as', 'a"', {})
-map('o', 'is', 'i"', {})
-map('o', 'it', 'i[', {})
-map('o', 'at', 'a[', {})
-
-map('t', '<escape>', '<C-\\><C-n>', {})
-map('t', 'jk', '<C-\\><C-n>', {})
-
-
+require("set")
+require("remapping")
diff --git a/.config/nvim/lua/autocomplete.lua b/.config/nvim/lua/autocomplete.lua
new file mode 100644
index 0000000..c45333c
--- /dev/null
+++ b/.config/nvim/lua/autocomplete.lua
@@ -0,0 +1,34 @@
+local cmp = require("cmp")
+
+cmp.setup({
+ snippet = {
+ -- REQUIRED - you must specify a snippet engine
+ expand = function(args)
+ vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
+ -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
+ -- require('snippy').expand_snippet(args.body) -- For `snippy` users.
+ -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
+ end,
+ },
+ mapping = {
+ ['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
+ ['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
+ ['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
+ ['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
+ ['<C-e>'] = cmp.mapping({
+ i = cmp.mapping.abort(),
+ c = cmp.mapping.close(),
+ }),
+ ['<tab>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
+ },
+ sources = cmp.config.sources({
+ { name = 'nvim_lsp' },
+ { name = 'vsnip' }, -- For vsnip users.
+ -- { name = 'luasnip' }, -- For luasnip users.
+ -- { name = 'ultisnips' }, -- For ultisnips users.
+ -- { name = 'snippy' }, -- For snippy users.
+ }, {
+ { name = 'buffer' },
+ })
+})
+
diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua
index 3fa5f48..3a4b605 100644
--- a/.config/nvim/lua/lsp.lua
+++ b/.config/nvim/lua/lsp.lua
@@ -1,5 +1,10 @@
local lsp = require('lspconfig')
-lsp.lua_ls.setup {
+
+local capabilities = require("cmp_nvim_lsp").default_capabilities(
+ vim.lsp.protocol.make_client_capabilities())
+
+lsp.lua_ls.setup({
+ capabilities=capabilities,
Lua = {
runtime = {
version = "LuaJIT",
@@ -8,6 +13,17 @@ lsp.lua_ls.setup {
enable = false,
}
}
+})
+
+
+lsp.clangd.setup {
+ capabilities=capabilities,
}
-lsp.clangd.setup {}
+lsp.rust_analyzer.setup({
+ capabilities=capabilities,
+ settings = {
+ ['rust-analyzer'] = {},
+ },
+})
+
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index eef6e01..350fd61 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -28,5 +28,13 @@ return require('packer').startup(function(use)
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
}
use { 'numToStr/Comment.nvim' }
+
+ use { 'hrsh7th/cmp-nvim-lsp' }
+ use { 'hrsh7th/cmp-buffer' }
+ use { 'hrsh7th/cmp-path' }
+ use { 'hrsh7th/cmp-cmdline' }
+ use { 'hrsh7th/nvim-cmp' }
+ use { 'hrsh7th/vim-vsnip' }
+
use { 'loctvl842/monokai-pro.nvim' }
end)
diff --git a/.config/nvim/lua/remapping.lua b/.config/nvim/lua/remapping.lua
new file mode 100644
index 0000000..79aaa81
--- /dev/null
+++ b/.config/nvim/lua/remapping.lua
@@ -0,0 +1,25 @@
+vim.g.mapleader = " "
+
+vim.keymap.set('i', 'jk', '<escape>', {})
+vim.keymap.set('n', '<leader>n', [[:NvimTreeToggle<cr>]], {})
+vim.keymap.set('n', '<leader>f', [[:Telescope find_files<cr>]], {})
+vim.keymap.set('n', '<leader>g', [[:Git<cr>]], {})
+vim.keymap.set('n', '<leader>to', [[:TermOpen<cr><cr>]], {})
+vim.keymap.set('n', '<leader>c', [[:noh<cr>]], {})
+
+vim.keymap.set('n', '<C-h>', '<C-w>h', {})
+vim.keymap.set('n', '<C-j>', '<C-w>j', {})
+vim.keymap.set('n', '<C-k>', '<C-w>k', {})
+vim.keymap.set('n', '<C-l>', '<C-w>l', {})
+
+vim.keymap.set('o', 'as', 'a"', {})
+vim.keymap.set('o', 'is', 'i"', {})
+vim.keymap.set('o', 'it', 'i[', {})
+vim.keymap.set('o', 'at', 'a[', {})
+vim.keymap.set('o', 'ic', 'i<', {})
+vim.keymap.set('o', 'ac', 'a<', {})
+
+vim.keymap.set('t', '<escape>', '<C-\\><C-n>', {})
+vim.keymap.set('t', 'jk', '<C-\\><C-n>', {})
+
+
diff --git a/.config/nvim/lua/set.lua b/.config/nvim/lua/set.lua
new file mode 100644
index 0000000..816ddb3
--- /dev/null
+++ b/.config/nvim/lua/set.lua
@@ -0,0 +1,26 @@
+vim.opt.number = true
+vim.opt.relativenumber = false
+vim.opt.cursorline = true
+vim.opt.scrolloff = 4
+vim.opt.signcolumn = "yes"
+
+vim.opt.encoding = 'utf8'
+vim.opt.fileencoding = 'utf8'
+vim.opt.syntax = "ON"
+vim.opt.termguicolors = true
+vim.api.nvim_command('colorscheme monokai-pro-spectrum')
+
+vim.opt.ignorecase = true
+vim.opt.smartcase = true
+vim.opt.incsearch = true
+
+vim.opt.expandtab = true
+vim.opt.shiftwidth = 2
+vim.opt.softtabstop = 2
+vim.opt.tabstop = 2
+
+vim.opt.splitright = true
+vim.opt.splitbelow = true
+vim.opt.cc = "80"
+
+