Git Product home page Git Product logo

nvim-cc-module's Introduction

NVIM-CC-MODULE

a simple module that enable better compile command stuff for neovim

USAGE

CONFIGURATION AND DESC

Module configuration

Configuration Var Desc
Nvim_cc_auto_reload = false (bool) define this global var before calling require for auto set_compile_command_from_file()
Nvim_cc_auto_sync = false (bool) define this global var before calling require for auto sync_directory_to_buffer()
Nvim_cc_file_name = "nvim-cc.txt" (str) define this global var before calling require for custom file name to read
Nvim_cc_split_size = 15 (int) define this global var before calling require for custom split size
Nvim_cc_term_buffn = nil (int) this var will be populated with the buffnr when the term buffer is spawned
Nvim_cc_vsplit_mode = false (bool) this var will decide what split will the cc term came out (vertical/horizontal)
  • this module will add couple of function
Name Desc
set_compile_command_from_file() automatically read a file called nvim-cc.txt in the current buffer path with removing /src/
input_compile_command() ask the user about what will the compile command would be
run_compile_command() running the compile command specified with split and terminal window
run_compile_command_silent() running the compile command specified with the default :!
sync_directory_to_buffer() will set the current buffer path to the cwd
export_compile_command() will save the current compile command to the current pwd

Example Usage:

$PATH_TO_NVIM_CONF/lua/keys.lua

-- assign the var for the module configuration
Nvim_cc_auto_reload = false
Nvim_cc_auto_sync = true
-- load module
local nvim_cc = require('nvim-cc')

-- your other config

-- some binding

-- run compile command with only 1 term buffer allowed
vim.keymap.set("n", "<leader>cc", function ()
    if Nvim_cc_term_buffn == nil or vim.fn.bufexists(Nvim_cc_term_buffn) ~= 1 then
        nvim_cc.run_compile_command()
    else
        print("The compile command buff already running...")
    end
end)
-----------------------------------------------------

-- default behavior
-- vim.keymap.set("n", "<leader>cc", function() nvim_cc.input_compile_command() end)
------------------
vim.keymap.set("n", "<leader>cC", function() nvim_cc.run_compile_command() end)
vim.keymap.set("n", "<leader>cs", function() nvim_cc.run_compile_command_silent() end)
vim.keymap.set("n", "<leader>sd", function() nvim_cc.sync_directory_to_buffer() end)
vim.keymap.set("n", "<leader>cS", function() nvim_cc.set_compile_command_from_file() end)
vim.keymap.set("n", "<leader>cw", function() nvim_cc.export_compile_command() end)

-- your other config

$PROJECT_PATH/nvim-cc.txt

cargo run

NOTE

this is not a plugin but just a simple module

nvim-cc-module's People

Contributors

commrade-goad avatar

Stargazers

Yuta Katayama avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.